Skip to content

Commit b583960

Browse files
Merge pull request #226 from ibuildthecloud/disable-cache
change: switch --cache to --disable-cache
2 parents e669ba7 + 0cfab52 commit b583960

File tree

2 files changed

+5
-8
lines changed

2 files changed

+5
-8
lines changed

pkg/cache/cache.go

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,17 +18,14 @@ type Client struct {
1818
}
1919

2020
type Options struct {
21-
Cache *bool `usage:"Disable caching" default:"true"`
22-
CacheDir string `usage:"Directory to store cache (default: $XDG_CACHE_HOME/gptscript)"`
21+
DisableCache bool `usage:"Disable caching of LLM API responses"`
22+
CacheDir string `usage:"Directory to store cache (default: $XDG_CACHE_HOME/gptscript)"`
2323
}
2424

2525
func Complete(opts ...Options) (result Options) {
2626
for _, opt := range opts {
2727
result.CacheDir = types.FirstSet(opt.CacheDir, result.CacheDir)
28-
result.Cache = types.FirstSet(opt.Cache, result.Cache)
29-
}
30-
if result.Cache == nil {
31-
result.Cache = &[]bool{true}[0]
28+
result.DisableCache = types.FirstSet(opt.DisableCache, result.DisableCache)
3229
}
3330
if result.CacheDir == "" {
3431
result.CacheDir = filepath.Join(xdg.CacheHome, version.ProgramName)
@@ -54,7 +51,7 @@ func New(opts ...Options) (*Client, error) {
5451
}
5552
return &Client{
5653
dir: opt.CacheDir,
57-
noop: !*opt.Cache,
54+
noop: opt.DisableCache,
5855
}, nil
5956
}
6057

pkg/openai/client.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ func complete(opts ...Options) (result Options, err error) {
6868

6969
if result.Cache == nil {
7070
result.Cache, err = cache.New(cache.Options{
71-
Cache: new(bool),
71+
DisableCache: true,
7272
})
7373
}
7474

0 commit comments

Comments
 (0)