From aaddc95ec04551e544813c8ac4b1478f7fdafcf4 Mon Sep 17 00:00:00 2001 From: Eugen Eisler Date: Mon, 21 Oct 2024 16:22:08 +0200 Subject: [PATCH] fix: setup does not overwrites old values --- plugins/ai/ollama/ollama.go | 2 +- plugins/plugin.go | 5 +++++ plugins/tools/lang/language.go | 2 +- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/plugins/ai/ollama/ollama.go b/plugins/ai/ollama/ollama.go index a166a1e..c823426 100644 --- a/plugins/ai/ollama/ollama.go +++ b/plugins/ai/ollama/ollama.go @@ -24,7 +24,7 @@ func NewClient() (ret *Client) { ConfigureCustom: ret.configure, } - ret.ApiUrl = ret.PluginBase.AddSetupQuestionCustom("API URL", true, + ret.ApiUrl = ret.AddSetupQuestionCustom("API URL", true, "Enter your Ollama URL (as a reminder, it is usually http://localhost:11434)") return diff --git a/plugins/plugin.go b/plugins/plugin.go index 2574a35..300fc6f 100644 --- a/plugins/plugin.go +++ b/plugins/plugin.go @@ -183,6 +183,11 @@ func (o *SetupQuestion) Ask(label string) (err error) { func (o *SetupQuestion) OnAnswer(answer string) (err error) { o.Value = answer + if o.EnvVariable != "" { + if err = os.Setenv(o.EnvVariable, answer); err != nil { + return + } + } err = o.IsValidErr() return } diff --git a/plugins/tools/lang/language.go b/plugins/tools/lang/language.go index 18f653a..d45b692 100644 --- a/plugins/tools/lang/language.go +++ b/plugins/tools/lang/language.go @@ -17,7 +17,7 @@ func NewLanguage() (ret *Language) { ConfigureCustom: ret.configure, } - ret.DefaultLanguage = ret.PluginBase.AddSetupQuestionCustom("Output", false, + ret.DefaultLanguage = ret.AddSetupQuestionCustom("Output", false, "Enter your default output language (for example: zh_CN)") return