fix: sanitize response based on sourceFormat, not targetFormat

This commit is contained in:
Dheeraj
2026-04-03 00:43:22 +05:30
parent 4b0bcf4464
commit 49ad44dcaf
+1 -1
View File
@@ -1690,7 +1690,7 @@ export async function handleChatCore({
// Strips non-standard fields (x_groq, usage_breakdown, service_tier, etc.)
// Extracts <think> and <thinking> tags into reasoning_content
// Target format determines output shape. If we are outputting OpenAI shape or pseudo-OpenAI shape, sanitize.
if (targetFormat === FORMATS.OPENAI || targetFormat === FORMATS.OPENAI_RESPONSES) {
if (sourceFormat === FORMATS.OPENAI || sourceFormat === FORMATS.OPENAI_RESPONSES) {
translatedResponse = sanitizeOpenAIResponse(translatedResponse);
}