Compare commits

...

4 Commits

Author SHA1 Message Date
Laisky.Cai
642109dc67 Merge 3e17184c1e into 9b6d5f76e0 2025-02-03 18:14:24 +08:00
JustSong
9b6d5f76e0 fix: enhance douban_notice_2 for clarity on model name conversion
Some checks are pending
CI / Unit tests (push) Waiting to run
CI / commit_lint (push) Waiting to run
2025-02-03 00:11:43 +08:00
Laisky.Cai
3e17184c1e fix: update o1 model handling to include temperature support 2025-01-25 07:20:07 +00:00
Laisky.Cai
d7e1b2a231 fix: o1 do not support system prompt and max_tokens 2025-01-05 02:46:00 +00:00
3 changed files with 19 additions and 2 deletions

View File

@@ -82,6 +82,23 @@ func (a *Adaptor) ConvertRequest(c *gin.Context, relayMode int, request *model.G
}
request.StreamOptions.IncludeUsage = true
}
// o1/o1-mini/o1-preview do not support system prompt/max_tokens/temperature
if strings.HasPrefix(request.Model, "o1") {
temperature := float64(1)
request.Temperature = &temperature // Only the default (1) value is supported
request.MaxTokens = 0
request.Messages = func(raw []model.Message) (filtered []model.Message) {
for i := range raw {
if raw[i].Role != "system" {
filtered = append(filtered, raw[i])
}
}
return
}(request.Messages)
}
return request, nil
}

View File

@@ -499,7 +499,7 @@ func GetCompletionRatio(name string, channelType int) float64 {
}
return 2
}
// including o1, o1-preview, o1-mini
// including o1/o1-preview/o1-mini
if strings.HasPrefix(name, "o1") {
return 4
}

View File

@@ -134,7 +134,7 @@
"coze_notice": "对于 Coze 而言,模型名称即 Bot ID你可以添加一个前缀 `bot-`,例如:`bot-123456`。",
"douban_notice": "对于豆包而言,需要手动去",
"douban_notice_link": "模型推理页面",
"douban_notice_2": "创建推理接入点,以接入点名称作为模型名称,例如:`ep-20240608051426-tkxvl`。",
"douban_notice_2": "创建推理接入点,以接入点名称作为模型名称,例如:`ep-20240608051426-tkxvl`。你可以结合模型重定向功能将其转换为常规的模型名称例如doubao-lite-4k -> ep-20240608051426-tkxvl前者作为 JSON 的 key后者作为 value。注意doubao-lite-4k 和 ep-20240608051426-tkxvl 都需要通过自定义模型的方式填入到本渠道的模型列表中。",
"aws_region_placeholder": "region例如us-west-2",
"aws_ak_placeholder": "AWS IAM Access Key",
"aws_sk_placeholder": "AWS IAM Secret Key",