mirror of
https://github.com/Ed1s0nZ/CyberStrikeAI.git
synced 2026-08-29 14:10:50 +02:00
71 lines
2.2 KiB
Go
71 lines
2.2 KiB
Go
package multiagent
|
|
|
|
import (
|
|
"strings"
|
|
"testing"
|
|
|
|
"cyberstrike-ai/internal/config"
|
|
)
|
|
|
|
func TestStripReasoningFromSummarizationPayload(t *testing.T) {
|
|
in := []byte(`{"model":"deepseek-chat","messages":[],"thinking":{"type":"enabled"},"reasoning_effort":"high"}`)
|
|
out, err := stripReasoningFromSummarizationPayload(in, nil)
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
s := string(out)
|
|
if strings.Contains(s, "thinking") || strings.Contains(s, "reasoning_effort") {
|
|
t.Fatalf("expected reasoning fields stripped, got %s", s)
|
|
}
|
|
if !strings.Contains(s, `"model":"deepseek-chat"`) {
|
|
t.Fatalf("expected model preserved, got %s", s)
|
|
}
|
|
|
|
plain := []byte(`{"model":"gpt-4o","messages":[]}`)
|
|
out2, err := stripReasoningFromSummarizationPayload(plain, nil)
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
if string(out2) != string(plain) {
|
|
t.Fatalf("expected unchanged payload, got %s", out2)
|
|
}
|
|
}
|
|
|
|
func TestStripReasoningFromSummarizationPayloadDisablesDeepSeekThinking(t *testing.T) {
|
|
in := []byte(`{"model":"deepseek-v4-flash","messages":[],"thinking":{"type":"enabled"},"reasoning_effort":"high"}`)
|
|
oa := &config.OpenAIConfig{
|
|
BaseURL: "https://api.deepseek.com/v1",
|
|
Model: "deepseek-v4-flash",
|
|
}
|
|
out, err := stripReasoningFromSummarizationPayload(in, oa)
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
s := string(out)
|
|
if strings.Contains(s, "reasoning_effort") {
|
|
t.Fatalf("expected reasoning_effort stripped, got %s", s)
|
|
}
|
|
if !strings.Contains(s, `"thinking":{"type":"disabled"}`) {
|
|
t.Fatalf("expected DeepSeek thinking disabled, got %s", s)
|
|
}
|
|
}
|
|
|
|
func TestStripReasoningFromSummarizationPayloadHonorsOpenAICompatProfile(t *testing.T) {
|
|
in := []byte(`{"model":"deepseek-v4-flash","messages":[],"thinking":{"type":"enabled"},"reasoning_effort":"high"}`)
|
|
oa := &config.OpenAIConfig{
|
|
BaseURL: "https://api.deepseek.com/v1",
|
|
Model: "deepseek-v4-flash",
|
|
Reasoning: config.OpenAIReasoningConfig{
|
|
Profile: "openai_compat",
|
|
},
|
|
}
|
|
out, err := stripReasoningFromSummarizationPayload(in, oa)
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
s := string(out)
|
|
if strings.Contains(s, "thinking") || strings.Contains(s, "reasoning_effort") {
|
|
t.Fatalf("expected OpenAI-compatible profile to strip reasoning fields, got %s", s)
|
|
}
|
|
}
|