You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
These models output <think>...</think> blocks before their actual JSON
response when in "thinking mode". This fix:
1. Adds /nothink prefix to all AI prompts (EXTRACTION_PROMPT,
VERIFICATION_PROMPT, STOCK_STATUS_PROMPT, ARBITRATION_PROMPT)
to request models disable thinking mode
2. Adds stripThinkingTags() helper function that removes <think>
blocks from responses as a fallback if models ignore /nothink
3. Applies stripping in all parse functions before JSON extraction
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
constVERIFICATION_PROMPT=`You are a price and availability verification assistant. I scraped a product page and found a price. Please verify if this price is correct AND if the product is currently available for purchase.
40
+
constVERIFICATION_PROMPT=`/nothink
41
+
You are a price and availability verification assistant. I scraped a product page and found a price. Please verify if this price is correct AND if the product is currently available for purchase.
32
42
33
43
Scraped Price: $SCRAPED_PRICE$ $CURRENCY$
34
44
@@ -64,7 +74,8 @@ Only return valid JSON, no explanation text outside the JSON.
64
74
HTML Content:
65
75
`;
66
76
67
-
constSTOCK_STATUS_PROMPT=`You are an availability verification assistant. The user is tracking a SPECIFIC product variant priced at $VARIANT_PRICE$ $CURRENCY$.
77
+
constSTOCK_STATUS_PROMPT=`/nothink
78
+
You are an availability verification assistant. The user is tracking a SPECIFIC product variant priced at $VARIANT_PRICE$ $CURRENCY$.
68
79
69
80
Your task: Determine if THIS SPECIFIC VARIANT (the one at $VARIANT_PRICE$) is currently in stock and can be purchased.
70
81
@@ -96,7 +107,8 @@ Only return valid JSON, no explanation text outside the JSON.
96
107
HTML Content:
97
108
`;
98
109
99
-
constEXTRACTION_PROMPT=`You are a price extraction assistant. Analyze the following HTML content from a product page and extract the product information.
110
+
constEXTRACTION_PROMPT=`/nothink
111
+
You are a price extraction assistant. Analyze the following HTML content from a product page and extract the product information.
100
112
101
113
Return a JSON object with these fields:
102
114
- name: The product name/title (string or null)
@@ -495,8 +507,8 @@ function parseStockStatusResponse(responseText: string): AIStockStatusResult {
495
507
};
496
508
497
509
try{
498
-
// Extract JSON from response (handle markdown code blocks)
499
-
letjsonStr=responseText;
510
+
// Strip thinking tags from models like Qwen3/DeepSeek
@@ -814,7 +827,8 @@ export async function tryAIStockStatusVerification(
814
827
}
815
828
816
829
// Arbitration prompt for when multiple extraction methods disagree
817
-
constARBITRATION_PROMPT=`You are a price arbitration assistant. Multiple price extraction methods found different prices for the same product. Help determine the correct price.
830
+
constARBITRATION_PROMPT=`/nothink
831
+
You are a price arbitration assistant. Multiple price extraction methods found different prices for the same product. Help determine the correct price.
818
832
819
833
Found prices:
820
834
$CANDIDATES$
@@ -950,7 +964,8 @@ function parseArbitrationResponse(
950
964
reason: 'Could not parse AI response',
951
965
};
952
966
953
-
letjsonStr=responseText.trim();
967
+
// Strip thinking tags from models like Qwen3/DeepSeek
0 commit comments