mirror of
https://github.com/diegosouzapw/OmniRoute.git
synced 2026-08-14 03:02:14 +03:00
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:
committed by
diegosouzapw
parent
18ef28ea77
commit
72dd7c9b49
@@ -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
|
||||
}
|
||||
|
||||
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user