fix(deepseek): pass requestId context to cache and widen sanitizer regex

- chatCore.ts: pass {requestId:skillRequestId,messageIndex:0} to cacheReasoningFromAssistantMessage
- responseSanitizer.ts: widen isDeepSeekV4Model regex to match all deepseek-v4 variants
This commit is contained in:
kang-heewon
2026-05-14 06:42:27 +09:00
committed by diegosouzapw
parent 18ef28ea77
commit 72dd7c9b49
2 changed files with 3 additions and 3 deletions

View File

@@ -4134,7 +4134,7 @@ export async function handleChatCore({
try {
const firstChoice = translatedResponse?.choices?.[0];
const msg = firstChoice?.message;
cacheReasoningFromAssistantMessage(msg, provider, model);
cacheReasoningFromAssistantMessage(msg, provider, model, { requestId: skillRequestId, messageIndex: 0 });
} catch {
// Cache capture is non-critical — never block the response
}
@@ -4421,7 +4421,7 @@ export async function handleChatCore({
const body = streamResponseBody as Record<string, unknown>;
const choices = body.choices as { message?: Record<string, unknown> }[] | undefined;
const msg = choices?.[0]?.message;
cacheReasoningFromAssistantMessage(msg, provider, model);
cacheReasoningFromAssistantMessage(msg, provider, model, { requestId: skillRequestId, messageIndex: 0 });
} catch {
// Cache capture is non-critical — never block the stream
}

View File

@@ -28,7 +28,7 @@ const ALLOWED_RESPONSES_USAGE_FIELDS = new Set([
type JsonRecord = Record<string, unknown>;
function isDeepSeekV4Model(model: unknown): boolean {
return typeof model === "string" && /^deepseek-v4(?:$|[-_/])/i.test(model);
return typeof model === "string" && /deepseek[-/]v4/i.test(model);
}
function toRecord(value: unknown): JsonRecord | null {