mirror of
https://github.com/CJackHwang/ds2api.git
synced 2026-05-09 18:57:43 +08:00
增加不同上下文模式
This commit is contained in:
@@ -199,6 +199,9 @@ func parseSettingsUpdateRequest(req map[string]any) (*config.AdminConfig, *confi
|
||||
b := boolFrom(v)
|
||||
cfg.Enabled = &b
|
||||
}
|
||||
if v, exists := raw["prompt"]; exists {
|
||||
cfg.Prompt = strings.TrimSpace(fmt.Sprintf("%v", v))
|
||||
}
|
||||
thinkingInjCfg = cfg
|
||||
}
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@ import (
|
||||
|
||||
authn "ds2api/internal/auth"
|
||||
"ds2api/internal/config"
|
||||
"ds2api/internal/promptcompat"
|
||||
)
|
||||
|
||||
func (h *Handler) getSettings(w http.ResponseWriter, _ *http.Request) {
|
||||
@@ -39,7 +40,9 @@ func (h *Handler) getSettings(w http.ResponseWriter, _ *http.Request) {
|
||||
"min_chars": h.Store.CurrentInputFileMinChars(),
|
||||
},
|
||||
"thinking_injection": map[string]any{
|
||||
"enabled": h.Store.ThinkingInjectionEnabled(),
|
||||
"enabled": h.Store.ThinkingInjectionEnabled(),
|
||||
"prompt": h.Store.ThinkingInjectionPrompt(),
|
||||
"default_prompt": promptcompat.DefaultThinkingInjectionPrompt,
|
||||
},
|
||||
"model_aliases": snap.ModelAliases,
|
||||
"env_backed": h.Store.IsEnvBacked(),
|
||||
|
||||
@@ -89,6 +89,7 @@ func (h *Handler) updateSettings(w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
if thinkingInjCfg != nil {
|
||||
c.ThinkingInjection.Enabled = thinkingInjCfg.Enabled
|
||||
c.ThinkingInjection.Prompt = thinkingInjCfg.Prompt
|
||||
}
|
||||
if aliasMap != nil {
|
||||
c.ModelAliases = aliasMap
|
||||
|
||||
Reference in New Issue
Block a user