From 2a9b61f099b5f5307b3af463bd6b1464941260fd Mon Sep 17 00:00:00 2001 From: Eva Ho Date: Tue, 11 Nov 2025 08:58:55 -0500 Subject: [PATCH] address comment --- app/ui/app/src/api.ts | 9 ++++++++- app/ui/ui.go | 19 ------------------- 2 files changed, 8 insertions(+), 20 deletions(-) diff --git a/app/ui/app/src/api.ts b/app/ui/app/src/api.ts index c8b2e116..4158bafc 100644 --- a/app/ui/app/src/api.ts +++ b/app/ui/app/src/api.ts @@ -205,6 +205,13 @@ export async function* sendMessage( data: uint8ArrayToBase64(att.data), })); + // Only send think parameter when actually requesting thinking + // Don't send false as it causes issues with some providers + const shouldSendThink = + think !== undefined && + ((typeof think === "boolean" && think) || + (typeof think === "string" && think !== "")); + const response = await fetch(`${API_BASE}/api/v1/chat/${chatId}`, { method: "POST", headers: { @@ -222,7 +229,7 @@ export async function* sendMessage( web_search: webSearch ?? false, file_tools: fileTools ?? false, ...(forceUpdate !== undefined ? { forceUpdate } : {}), - ...(think !== undefined ? { think } : {}), + ...(shouldSendThink ? { think } : {}), }), ), signal, diff --git a/app/ui/ui.go b/app/ui/ui.go index a05ecf0f..1d0e2579 100644 --- a/app/ui/ui.go +++ b/app/ui/ui.go @@ -782,25 +782,6 @@ func (s *Server) chat(w http.ResponseWriter, r *http.Request) error { var thinkValue any if req.Think != nil { - // Validate that the model supports thinking if requested - thinkRequested := false - switch v := req.Think.(type) { - case bool: - thinkRequested = v - case string: - thinkRequested = v != "" && v != "none" - } - - if thinkRequested && !think { - errorEvent := responses.ErrorEvent{ - EventName: "error", - Error: fmt.Sprintf("Model %q does not support thinking/reasoning", req.Model), - Code: "model_capability_error", - } - json.NewEncoder(w).Encode(errorEvent) - flusher.Flush() - return nil - } thinkValue = req.Think } else { thinkValue = think