eranet111 commited on
Commit
0a47b2f
·
1 Parent(s): b3ab639

Add ability to disable thinking for specific AI models

Browse files

Add a map `noThinkingModels` to `main.go` and conditionally set `"thinking": false` in upstream API payloads for `z-ai/glm4.7` and `deepseek-ai/deepseek-v3.1` in both `callUpstream` and `streamUpstream` functions.

Replit-Commit-Author: Agent
Replit-Commit-Session-Id: a225ab96-d6aa-42ce-a50b-aa844bc8db2b
Replit-Commit-Checkpoint-Type: full_checkpoint
Replit-Commit-Event-Id: 502cbfc3-2e91-4c43-97e7-a3613d76783b
Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/cbd1ae84-d682-4025-b26d-c56df1ac13a1/a225ab96-d6aa-42ce-a50b-aa844bc8db2b/jm4hNZf
Replit-Helium-Checkpoint-Created: true

Files changed (1) hide show
  1. main.go +12 -0
main.go CHANGED
@@ -29,6 +29,12 @@ var modelAliases = map[string]string{
29
  "Kimi-K2": "moonshotai/kimi-k2-instruct",
30
  }
31
 
 
 
 
 
 
 
32
  // --- STRUKTURY ---
33
 
34
  type Message struct {
@@ -125,6 +131,9 @@ func callUpstream(modelID string, messages []Message, tools []Tool, toolChoice i
125
  "messages": messages,
126
  "stream": false,
127
  }
 
 
 
128
  if temperature != nil {
129
  payload["temperature"] = *temperature
130
  }
@@ -167,6 +176,9 @@ func streamUpstream(w http.ResponseWriter, modelID string, messages []Message, t
167
  "messages": messages,
168
  "stream": true,
169
  }
 
 
 
170
  if temperature != nil {
171
  payload["temperature"] = *temperature
172
  }
 
29
  "Kimi-K2": "moonshotai/kimi-k2-instruct",
30
  }
31
 
32
+ // Modele z wyłączonym thinking
33
+ var noThinkingModels = map[string]bool{
34
+ "z-ai/glm4.7": true,
35
+ "deepseek-ai/deepseek-v3.1": true,
36
+ }
37
+
38
  // --- STRUKTURY ---
39
 
40
  type Message struct {
 
131
  "messages": messages,
132
  "stream": false,
133
  }
134
+ if noThinkingModels[modelID] {
135
+ payload["thinking"] = false
136
+ }
137
  if temperature != nil {
138
  payload["temperature"] = *temperature
139
  }
 
176
  "messages": messages,
177
  "stream": true,
178
  }
179
+ if noThinkingModels[modelID] {
180
+ payload["thinking"] = false
181
+ }
182
  if temperature != nil {
183
  payload["temperature"] = *temperature
184
  }