File tree 3 files changed +27
-0
lines changed
3 files changed +27
-0
lines changed Original file line number Diff line number Diff line change @@ -62,6 +62,7 @@ type Config struct {
62
62
Tracing TracingConfig `mapstructure:"tracing"`
63
63
Experimental ExperimentalConfig `mapstructure:"experimental"`
64
64
OIDC OIDCConfig `mapstructure:"oidc"`
65
+ OpenAI OpenAIConfig `mapstructure:"openai"`
65
66
}
66
67
67
68
// DatabaseConfig is the configuration for the database.
@@ -213,6 +214,13 @@ type OIDCConfig struct {
213
214
RedirectURL string `mapstructure:"redirect_url" validate:"omitempty,endswith=/callback/oauth2"`
214
215
}
215
216
217
+ type OpenAIConfig struct {
218
+ BaseURL string `mapstructure:"base_url"`
219
+ AuthToken string `mapstructure:"auth_token"`
220
+ ChatCompletionModel string `mapstructure:"chat_completion_model"`
221
+ EmbeddingsModel string `mapstructure:"embeddings_model"`
222
+ }
223
+
216
224
func GetDefaultConfig () * Config {
217
225
return & Config {
218
226
Database : DatabaseConfig {
Original file line number Diff line number Diff line change @@ -309,3 +309,17 @@ client_secret = ""
309
309
# Gorse dashboard URL and "/callback/oauth2". For example, if the Gorse dashboard URL is
310
310
# http://localhost:8088, the redirect URL should be: http://localhost:8088/callback/oauth2
311
311
redirect_url = " "
312
+
313
+ [openai ]
314
+
315
+ # Base URL of OpenAI API.
316
+ base_url = " http://localhost:11434/v1"
317
+
318
+ # API key of OpenAI API.
319
+ auth_token = " ollama"
320
+
321
+ # Name of chat completion model.
322
+ chat_completion_model = " qwen2.5"
323
+
324
+ # Name of embeddings model.
325
+ embeddings_model = " mxbai-embed-large"
Original file line number Diff line number Diff line change @@ -156,6 +156,11 @@ func TestUnmarshal(t *testing.T) {
156
156
assert .Equal (t , "client_id" , config .OIDC .ClientID )
157
157
assert .Equal (t , "client_secret" , config .OIDC .ClientSecret )
158
158
assert .Equal (t , "http://localhost:8088/callback/oauth2" , config .OIDC .RedirectURL )
159
+ // [openai]
160
+ assert .Equal (t , "http://localhost:11434/v1" , config .OpenAI .BaseURL )
161
+ assert .Equal (t , "ollama" , config .OpenAI .AuthToken )
162
+ assert .Equal (t , "qwen2.5" , config .OpenAI .ChatCompletionModel )
163
+ assert .Equal (t , "mxbai-embed-large" , config .OpenAI .EmbeddingsModel )
159
164
})
160
165
}
161
166
}
You can’t perform that action at this time.
0 commit comments