mirror of
https://github.com/likelovewant/ollama-for-amd.git
synced 2025-12-21 22:33:56 +00:00
app/ui: do not send thinking to prevent errors with cloud provider
This commit is contained in:
@@ -205,6 +205,13 @@ export async function* sendMessage(
|
|||||||
data: uint8ArrayToBase64(att.data),
|
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}`, {
|
const response = await fetch(`${API_BASE}/api/v1/chat/${chatId}`, {
|
||||||
method: "POST",
|
method: "POST",
|
||||||
headers: {
|
headers: {
|
||||||
@@ -222,7 +229,7 @@ export async function* sendMessage(
|
|||||||
web_search: webSearch ?? false,
|
web_search: webSearch ?? false,
|
||||||
file_tools: fileTools ?? false,
|
file_tools: fileTools ?? false,
|
||||||
...(forceUpdate !== undefined ? { forceUpdate } : {}),
|
...(forceUpdate !== undefined ? { forceUpdate } : {}),
|
||||||
...(think !== undefined ? { think } : {}),
|
...(shouldSendThink ? { think } : {}),
|
||||||
}),
|
}),
|
||||||
),
|
),
|
||||||
signal,
|
signal,
|
||||||
|
|||||||
@@ -1794,13 +1794,14 @@ func (s *Server) buildChatRequest(chat *store.Chat, model string, think any, ava
|
|||||||
|
|
||||||
var thinkValue *api.ThinkValue
|
var thinkValue *api.ThinkValue
|
||||||
if think != nil {
|
if think != nil {
|
||||||
|
// Only set Think if it's actually requesting thinking
|
||||||
if boolValue, ok := think.(bool); ok {
|
if boolValue, ok := think.(bool); ok {
|
||||||
thinkValue = &api.ThinkValue{
|
if boolValue {
|
||||||
Value: boolValue,
|
thinkValue = &api.ThinkValue{Value: boolValue}
|
||||||
}
|
}
|
||||||
} else if stringValue, ok := think.(string); ok {
|
} else if stringValue, ok := think.(string); ok {
|
||||||
thinkValue = &api.ThinkValue{
|
if stringValue != "" && stringValue != "none" {
|
||||||
Value: stringValue,
|
thinkValue = &api.ThinkValue{Value: stringValue}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user