summaryrefslogtreecommitdiff
path: root/config
diff options
context:
space:
mode:
Diffstat (limited to 'config')
-rw-r--r--config/config.go19
1 files changed, 17 insertions, 2 deletions
diff --git a/config/config.go b/config/config.go
index eb5f3f1..2e48f34 100644
--- a/config/config.go
+++ b/config/config.go
@@ -7,7 +7,11 @@ import (
)
type Config struct {
- APIURL string `toml:"APIURL"`
+ ChatAPI string `toml:"ChatAPI"`
+ CompletionAPI string `toml:"CompletionAPI"`
+ CurrentAPI string
+ APIMap map[string]string
+ //
ShowSys bool `toml:"ShowSys"`
LogFile string `toml:"LogFile"`
UserRole string `toml:"UserRole"`
@@ -34,7 +38,8 @@ func LoadConfigOrDefault(fn string) *Config {
_, err := toml.DecodeFile(fn, &config)
if err != nil {
fmt.Println("failed to read config from file, loading default")
- config.APIURL = "http://localhost:8080/v1/chat/completions"
+ config.ChatAPI = "http://localhost:8080/v1/chat/completions"
+ config.CompletionAPI = "http://localhost:8080/completion"
config.RAGEnabled = false
config.EmbedURL = "http://localhost:8080/v1/embiddings"
config.ShowSys = true
@@ -48,6 +53,16 @@ func LoadConfigOrDefault(fn string) *Config {
config.SysDir = "sysprompts"
config.ChunkLimit = 8192
}
+ config.CurrentAPI = config.ChatAPI
+ config.APIMap = map[string]string{
+ config.ChatAPI: config.CompletionAPI,
+ }
+ if config.CompletionAPI != "" {
+ config.CurrentAPI = config.CompletionAPI
+ config.APIMap = map[string]string{
+ config.CompletionAPI: config.ChatAPI,
+ }
+ }
// if any value is empty fill with default
return config
}