mirror of
https://github.com/CJackHwang/ds2api.git
synced 2026-05-12 04:07:42 +08:00
强制启用文件拆分(实际模型忽略)
This commit is contained in:
@@ -189,8 +189,8 @@ func TestUpdateSettingsHistorySplit(t *testing.T) {
|
||||
t.Fatalf("expected 200, got %d body=%s", rec.Code, rec.Body.String())
|
||||
}
|
||||
snap := h.Store.Snapshot()
|
||||
if snap.HistorySplit.Enabled == nil || *snap.HistorySplit.Enabled {
|
||||
t.Fatalf("expected history_split.enabled=false, got %#v", snap.HistorySplit.Enabled)
|
||||
if snap.HistorySplit.Enabled == nil || !*snap.HistorySplit.Enabled {
|
||||
t.Fatalf("expected history_split.enabled to be forced true, got %#v", snap.HistorySplit.Enabled)
|
||||
}
|
||||
if snap.HistorySplit.TriggerAfterTurns == nil || *snap.HistorySplit.TriggerAfterTurns != 3 {
|
||||
t.Fatalf("expected history_split.trigger_after_turns=3, got %#v", snap.HistorySplit.TriggerAfterTurns)
|
||||
|
||||
@@ -152,10 +152,8 @@ func parseSettingsUpdateRequest(req map[string]any) (*config.AdminConfig, *confi
|
||||
|
||||
if raw, ok := req["history_split"].(map[string]any); ok {
|
||||
cfg := &config.HistorySplitConfig{}
|
||||
if v, exists := raw["enabled"]; exists {
|
||||
b := boolFrom(v)
|
||||
cfg.Enabled = &b
|
||||
}
|
||||
enabled := true
|
||||
cfg.Enabled = &enabled
|
||||
if v, exists := raw["trigger_after_turns"]; exists {
|
||||
n := intFrom(v)
|
||||
if err := config.ValidateIntRange("history_split.trigger_after_turns", n, 1, 1000, true); err != nil {
|
||||
|
||||
@@ -27,9 +27,6 @@ func (s Service) Apply(ctx context.Context, a *auth.RequestAuth, stdReq promptco
|
||||
if s.DS == nil || s.Store == nil || a == nil {
|
||||
return stdReq, nil
|
||||
}
|
||||
if !s.Store.HistorySplitEnabled() {
|
||||
return stdReq, nil
|
||||
}
|
||||
|
||||
promptMessages, historyMessages := SplitOpenAIHistoryMessages(stdReq.Messages, s.Store.HistorySplitTriggerAfterTurns())
|
||||
if len(historyMessages) == 0 {
|
||||
|
||||
Reference in New Issue
Block a user