mirror of
https://github.com/k8sgpt-ai/k8sgpt.git
synced 2025-09-03 00:08:08 +00:00
feat: allow to set a baseurl (#310)
* feat: allow to set a baseURL for OpenAI providers This allows to run local models that have a compatible OpenAI API, or for instance use a proxy. Signed-off-by: mudler <mudler@mocaccino.org> * feat: allow to set baseURL in the auth subcommand Signed-off-by: mudler <mudler@mocaccino.org> --------- Signed-off-by: mudler <mudler@mocaccino.org> Co-authored-by: Alex Jones <alexsimonjones@gmail.com> Co-authored-by: Matthis <99146727+matthisholleville@users.noreply.github.com>
This commit is contained in:
committed by
GitHub
parent
754bf917e1
commit
cf797a6eb6
@@ -47,13 +47,18 @@ var ServeCmd = &cobra.Command{
|
||||
backend = os.Getenv("K8SGPT_BACKEND")
|
||||
password := os.Getenv("K8SGPT_PASSWORD")
|
||||
model := os.Getenv("K8SGPT_MODEL")
|
||||
// If the envs are set, alocate in place to the aiProvider
|
||||
baseURL := os.Getenv("K8SGPT_BASEURL")
|
||||
|
||||
// If the envs are set, allocate in place to the aiProvider
|
||||
// else exit with error
|
||||
if backend != "" || password != "" || model != "" {
|
||||
envIsSet := backend != "" || password != "" || model != "" || baseURL != ""
|
||||
|
||||
if envIsSet {
|
||||
aiProvider = &ai.AIProvider{
|
||||
Name: backend,
|
||||
Password: password,
|
||||
Model: model,
|
||||
BaseURL: baseURL,
|
||||
}
|
||||
|
||||
configAI.Providers = append(configAI.Providers, *aiProvider)
|
||||
|
Reference in New Issue
Block a user