mirror of
https://github.com/CJackHwang/ds2api.git
synced 2026-05-19 07:27:43 +08:00
feat: 新增 thinking 注入配置支持,扩展设置管理与前端交互
新增 promptcompat 和 OpenAI shared 层的 thinking 注入逻辑, 完善配置系统的编解码与校验,更新设置管理 API 与前端 UI。 Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -17,7 +17,7 @@ func (h *Handler) updateSettings(w http.ResponseWriter, r *http.Request) {
|
||||
return
|
||||
}
|
||||
|
||||
adminCfg, runtimeCfg, compatCfg, responsesCfg, embeddingsCfg, autoDeleteCfg, historySplitCfg, aliasMap, err := parseSettingsUpdateRequest(req)
|
||||
adminCfg, runtimeCfg, compatCfg, responsesCfg, embeddingsCfg, autoDeleteCfg, historySplitCfg, currentInputCfg, thinkingInjCfg, aliasMap, err := parseSettingsUpdateRequest(req)
|
||||
if err != nil {
|
||||
writeJSON(w, http.StatusBadRequest, map[string]any{"detail": err.Error()})
|
||||
return
|
||||
@@ -70,11 +70,26 @@ func (h *Handler) updateSettings(w http.ResponseWriter, r *http.Request) {
|
||||
if historySplitCfg != nil {
|
||||
if historySplitCfg.Enabled != nil {
|
||||
c.HistorySplit.Enabled = historySplitCfg.Enabled
|
||||
if *historySplitCfg.Enabled {
|
||||
disabled := false
|
||||
c.CurrentInputFile.Enabled = &disabled
|
||||
}
|
||||
}
|
||||
if historySplitCfg.TriggerAfterTurns != nil {
|
||||
c.HistorySplit.TriggerAfterTurns = historySplitCfg.TriggerAfterTurns
|
||||
}
|
||||
}
|
||||
if currentInputCfg != nil {
|
||||
c.CurrentInputFile.Enabled = currentInputCfg.Enabled
|
||||
if currentInputCfg.Enabled != nil && *currentInputCfg.Enabled {
|
||||
disabled := false
|
||||
c.HistorySplit.Enabled = &disabled
|
||||
}
|
||||
c.CurrentInputFile.MinChars = currentInputCfg.MinChars
|
||||
}
|
||||
if thinkingInjCfg != nil {
|
||||
c.ThinkingInjection.Enabled = thinkingInjCfg.Enabled
|
||||
}
|
||||
if aliasMap != nil {
|
||||
c.ModelAliases = aliasMap
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user