Add files via upload

This commit is contained in:
RT15548
2026-01-15 19:16:00 +08:00
committed by GitHub
parent eace36cbdb
commit fae4e40f4b
6 changed files with 2745 additions and 2060 deletions

View File

@@ -126,24 +126,19 @@ class StreamingGeneration {
const opts = { ...baseOptions, ...this.resolveCurrentApiAndModel(baseOptions) };
const modelLower = String(opts.model || '').toLowerCase();
const isClaudeThinking = modelLower.includes('claude') && modelLower.includes('thinking');
if (isClaudeThinking && Array.isArray(messages) && messages.length > 0) {
const isClaudeThinkingModel =
modelLower.includes('claude') &&
modelLower.includes('thinking') &&
!modelLower.includes('nothinking');
if (isClaudeThinkingModel && Array.isArray(messages) && messages.length > 0) {
const lastMsg = messages[messages.length - 1];
if (lastMsg?.role === 'assistant') {
const content = String(lastMsg.content || '');
const hasCompleteThinkingBlock =
(content.includes('<thinking>') && content.includes('</thinking>')) ||
content.includes('"type":"thinking"') ||
content.includes('"type": "thinking"');
if (!hasCompleteThinkingBlock) {
console.log('[xbgen] Claude Thinking 模型:移除不完整的 assistant prefill');
messages.pop();
}
console.log('[xbgen] Claude Thinking 模型:移除 assistant prefill');
messages.pop();
}
}
}
const source = {
openai: chat_completion_sources.OPENAI,
claude: chat_completion_sources.CLAUDE,
@@ -1441,4 +1436,4 @@ if (typeof window !== 'undefined') {
xiaobaixStreamingGeneration: streamingGeneration,
eventSource: (window)?.eventSource || eventSource
});
}
}