Skip to content

Commit f1a055c

Browse files
clucraftclaude
andcommitted
Fix Ollama thinking mode with /nothink chat message
Send /nothink as a separate message before the actual prompt, with a mock assistant response. This properly disables thinking mode for Qwen3/DeepSeek models. Removed the ineffective think:false API parameter. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent aad5a79 commit f1a055c

File tree

1 file changed

+23
-7
lines changed

1 file changed

+23
-7
lines changed

backend/src/services/ai-extractor.ts

Lines changed: 23 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -286,13 +286,20 @@ async function extractWithOllama(
286286
{
287287
model: model,
288288
messages: [
289+
{
290+
role: 'user',
291+
content: '/nothink', // Disable thinking mode for Qwen3/DeepSeek
292+
},
293+
{
294+
role: 'assistant',
295+
content: 'Ok.',
296+
},
289297
{
290298
role: 'user',
291299
content: EXTRACTION_PROMPT + preparedHtml,
292300
},
293301
],
294302
stream: false,
295-
think: false, // Disable thinking mode for Qwen3/DeepSeek models
296303
options: {
297304
num_ctx: 16384, // Increase context window for large HTML content
298305
},
@@ -388,9 +395,12 @@ async function verifyWithOllama(
388395
`${baseUrl}/api/chat`,
389396
{
390397
model: model,
391-
messages: [{ role: 'user', content: prompt }],
398+
messages: [
399+
{ role: 'user', content: '/nothink' },
400+
{ role: 'assistant', content: 'Ok.' },
401+
{ role: 'user', content: prompt },
402+
],
392403
stream: false,
393-
think: false, // Disable thinking mode for Qwen3/DeepSeek models
394404
options: {
395405
num_ctx: 16384, // Increase context window for large HTML content
396406
},
@@ -484,9 +494,12 @@ async function verifyStockStatusWithOllama(
484494
`${baseUrl}/api/chat`,
485495
{
486496
model: model,
487-
messages: [{ role: 'user', content: prompt }],
497+
messages: [
498+
{ role: 'user', content: '/nothink' },
499+
{ role: 'assistant', content: 'Ok.' },
500+
{ role: 'user', content: prompt },
501+
],
488502
stream: false,
489-
think: false, // Disable thinking mode for Qwen3/DeepSeek models
490503
options: {
491504
num_ctx: 16384, // Increase context window for large HTML content
492505
},
@@ -943,9 +956,12 @@ async function arbitrateWithOllama(
943956
`${baseUrl}/api/chat`,
944957
{
945958
model: model,
946-
messages: [{ role: 'user', content: prompt }],
959+
messages: [
960+
{ role: 'user', content: '/nothink' },
961+
{ role: 'assistant', content: 'Ok.' },
962+
{ role: 'user', content: prompt },
963+
],
947964
stream: false,
948-
think: false, // Disable thinking mode for Qwen3/DeepSeek models
949965
options: {
950966
num_ctx: 16384, // Increase context window for large HTML content
951967
},

0 commit comments

Comments
 (0)