diff --git a/docs/api-endpoints.md b/docs/api-endpoints.md index 49e63c2..93c3aaa 100644 --- a/docs/api-endpoints.md +++ b/docs/api-endpoints.md @@ -90,7 +90,7 @@ models: provider: "ollama" models: - 'llama2:13b' - endpoint: "http://127.0.0.1:11434/v1/chat/completions" + endpoint: "http://127.0.0.1:11434" ``` For online services using Chutes: @@ -106,7 +106,7 @@ For online services using Chutes: # provider: "chutes" # models: # - 'moonshotai/Kimi-K2-Instruct' -# endpoint: "https://llm.chutes.ai/v1/chat/completions" +# endpoint: "https://llm.chutes.ai/v1" # token: "cpk_xxxx" ``` diff --git a/example/server/config/server.yaml b/example/server/config/server.yaml index 5569940..36cf82f 100644 --- a/example/server/config/server.yaml +++ b/example/server/config/server.yaml @@ -20,11 +20,11 @@ sync: provider: - name: ollama - endpoint: http://localhost:11434/v1/chat/completions + endpoint: http://localhost:11434 models: - 'gpt-oss:20b' - name: chutes - endpoint: https://llm.chutes.ai/v1/chat/completions + endpoint: https://llm.chutes.ai/v1 token: "cpk_xxxxxxxxxxxxxxxxxx" models: - 'moonshotai/Kimi-K2-Instruct' diff --git a/server/api/askai.go b/server/api/askai.go index ffe1cbb..e0510f1 100644 --- a/server/api/askai.go +++ b/server/api/askai.go @@ -122,10 +122,14 @@ func loadConfig() (string, string, string, string, time.Duration, int) { } provider = strings.ToLower(provider) endpoint = strings.TrimRight(endpoint, "/") + endpoint = strings.TrimSuffix(endpoint, "/chat/completions") + endpoint = strings.TrimRight(endpoint, "/") switch provider { case "ollama": + endpoint = strings.TrimSuffix(endpoint, "/v1") + endpoint = strings.TrimRight(endpoint, "/") if endpoint == "" { - endpoint = "http://localhost:11434/v1/chat/completions" + endpoint = "http://localhost:11434" } if model == "" { model = "llama2:13b" @@ -133,7 +137,7 @@ func loadConfig() (string, string, string, string, time.Duration, int) { return provider, token, model, endpoint, timeout, retries case "chutes": if endpoint == "" { - endpoint = "https://llm.chutes.ai/v1/chat/completions" + endpoint = "https://llm.chutes.ai/v1" } if model == "" { model = "deepseek-ai/DeepSeek-R1" @@ -141,7 +145,7 @@ func loadConfig() (string, string, string, string, time.Duration, int) { return provider, token, model, endpoint, timeout, retries default: if endpoint == "" { - endpoint = "https://llm.chutes.ai/v1/chat/completions" + endpoint = "https://llm.chutes.ai/v1" } if model == "" { model = "deepseek-ai/DeepSeek-R1" diff --git a/server/config/server.yaml b/server/config/server.yaml index e5d31c5..fe7fee2 100644 --- a/server/config/server.yaml +++ b/server/config/server.yaml @@ -29,7 +29,7 @@ models: provider: "ollama" models: - 'llama2:13b' - endpoint: "http://127.0.0.1:11434/v1/chat/completions" + endpoint: "http://127.0.0.1:11434" token: "" # For PROD #models: @@ -42,7 +42,7 @@ models: #provider: "chutes" #models: # - 'moonshotai/Kimi-K2-Instruct' - #endpoint: "https://llm.chutes.ai/v1/chat/completions" + #endpoint: "https://llm.chutes.ai/v1" #token: "cpk_xxxx" embedding: