diff --git a/src/lib/server/parser.ts b/src/lib/server/parser.ts index d9474c7..6691ad9 100644 --- a/src/lib/server/parser.ts +++ b/src/lib/server/parser.ts @@ -49,11 +49,17 @@ export async function detectRecipe(text: string): Promise { content: `Does this text contain a recipe?\n\n${text}` } ], - max_tokens: 10, + // 1024 gives thinking models room to reason before answering + max_tokens: 1024, temperature: 0 }); - const detectionResult = detectionResponse.choices[0].message.content?.toLowerCase() ?? ''; + const msg = detectionResponse.choices[0].message; + // Some local models (e.g. Gemma thinking variants) return the answer in + // reasoning_content instead of content when max_tokens is tight. + // eslint-disable-next-line @typescript-eslint/no-explicit-any + const reasoning: string = (msg as any).reasoning_content ?? ''; + const detectionResult = (msg.content ?? reasoning).toLowerCase(); console.log('[LLM] Detection response:', detectionResult); return detectionResult.includes('yes');