修复吞字问题

This commit is contained in:
CJACK
2026-05-01 01:31:48 +08:00
parent fca8c01397
commit 92e321fe2c
11 changed files with 257 additions and 47 deletions

View File

@@ -70,7 +70,6 @@ function finalizeThinkingParts(parts, thinkingEnabled, newType) {
}
if (!thinkingEnabled) {
finalParts = dropThinkingParts(finalParts);
finalType = 'text';
}
return { parts: finalParts, newType: finalType };
}
@@ -213,6 +212,12 @@ function parseChunkForContent(chunk, thinkingEnabled, currentType, stripReferenc
}
}
if (pathValue === 'response/content') {
newType = 'text';
} else if (pathValue === 'response/thinking_content' && (!thinkingEnabled || newType !== 'text')) {
newType = 'thinking';
}
let partType = 'text';
if (pathValue === 'response/thinking_content') {
if (!thinkingEnabled) {
@@ -226,8 +231,8 @@ function parseChunkForContent(chunk, thinkingEnabled, currentType, stripReferenc
partType = 'text';
} else if (pathValue.includes('response/fragments') && pathValue.includes('/content')) {
partType = newType;
} else if (!pathValue && thinkingEnabled) {
partType = newType;
} else if (!pathValue) {
partType = newType || 'text';
}
const val = chunk.v;