File tree Expand file tree Collapse file tree 3 files changed +15
-14
lines changed
Expand file tree Collapse file tree 3 files changed +15
-14
lines changed Original file line number Diff line number Diff line change @@ -18,17 +18,14 @@ type Client struct {
1818}
1919
2020type 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
2525func 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
Original file line number Diff line number Diff line change @@ -22,12 +22,13 @@ type GPTScript struct {
2222}
2323
2424type Options struct {
25- Cache cache.Options
26- OpenAI openai.Options
27- Monitor monitor.Options
28- Runner runner.Options
29- Quiet * bool `usage:"No output logging (set --quiet=false to force on even when there is no TTY)" short:"q"`
30- Env []string `usage:"-"`
25+ Cache cache.Options
26+ OpenAI openai.Options
27+ Monitor monitor.Options
28+ Runner runner.Options
29+ Quiet * bool `usage:"No output logging (set --quiet=false to force on even when there is no TTY)" short:"q"`
30+ Env []string `usage:"-"`
31+ ZZ_Cache * bool `name:"cache" usage:"Disable caching" default:"true" hidden:"true" env:"GPTSCRIPT_CACHE"`
3132}
3233
3334func complete (opts * Options ) (result * Options ) {
@@ -41,6 +42,9 @@ func complete(opts *Options) (result *Options) {
4142 if len (result .Env ) == 0 {
4243 result .Env = os .Environ ()
4344 }
45+ if result .ZZ_Cache != nil {
46+ result .Cache .DisableCache = ! * result .ZZ_Cache
47+ }
4448 return
4549}
4650
Original file line number Diff line number Diff 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
You can’t perform that action at this time.
0 commit comments