fix: correct generator endpoint handling

This commit is contained in:
shenlan 2025-08-12 23:40:43 +08:00
parent 37410d2dc8
commit 96eba3c71e
4 changed files with 13 additions and 9 deletions

View File

@ -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"
```

View File

@ -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'

View File

@ -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"

View File

@ -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: