返回 DeepSeek-Reasonix
effort_test.go
根目录 / internal / serve / effort_test.go
1 package serve
2
3 import (
4 "testing"
5
6 "reasonix/internal/config"
7 )
8
9 func TestApplyEffortEditUpsertsMissingProvider(t *testing.T) {
10 edit := &config.Config{}
11 entry := &config.ProviderEntry{Name: "deepseek", Kind: "openai", BaseURL: "https://api.deepseek.com", Model: "deepseek-v4"}
12
13 if err := applyEffortEdit(edit, entry, "high"); err != nil {
14 t.Fatalf("applyEffortEdit: %v", err)
15 }
16 got, ok := edit.Provider("deepseek")
17 if !ok {
18 t.Fatal("provider absent from user config should be upserted so the effort edit lands")
19 }
20 if got.Effort != "high" {
21 t.Fatalf("effort = %q, want high", got.Effort)
22 }
23 }
24
25 func TestApplyEffortEditEnablesAnthropicThinking(t *testing.T) {
26 edit := &config.Config{}
27 entry := &config.ProviderEntry{Name: "anthropic", Kind: "anthropic", BaseURL: "https://api.anthropic.com", Model: "claude-opus-4-8"}
28
29 if err := applyEffortEdit(edit, entry, "max"); err != nil {
30 t.Fatalf("applyEffortEdit: %v", err)
31 }
32 got, _ := edit.Provider("anthropic")
33 if got.Thinking != "adaptive" {
34 t.Fatalf("thinking = %q, want adaptive (effort needs extended thinking to engage)", got.Thinking)
35 }
36 if got.Effort != "max" {
37 t.Fatalf("effort = %q, want max", got.Effort)
38 }
39 }
40
41 func TestApplyEffortEditKeepsExistingAnthropicThinking(t *testing.T) {
42 edit := &config.Config{Providers: []config.ProviderEntry{
43 {Name: "anthropic", Kind: "anthropic", Model: "claude-opus-4-8", Thinking: "always"},
44 }}
45 entry := &config.ProviderEntry{Name: "anthropic", Kind: "anthropic", Model: "claude-opus-4-8", Thinking: "always"}
46
47 if err := applyEffortEdit(edit, entry, "low"); err != nil {
48 t.Fatalf("applyEffortEdit: %v", err)
49 }
50 got, _ := edit.Provider("anthropic")
51 if got.Thinking != "always" {
52 t.Fatalf("thinking = %q, want it left untouched", got.Thinking)
53 }
54 }
55
55 lines GO