Merge f0c7a1007b into 09be5d45d5
This commit is contained in:
commit
272c63dfc6
@ -612,6 +612,8 @@ export async function runEmbeddedAttempt(
|
||||
onAssistantMessageStart: params.onAssistantMessageStart,
|
||||
onAgentEvent: params.onAgentEvent,
|
||||
enforceFinalTag: params.enforceFinalTag,
|
||||
provider: params.provider,
|
||||
modelId: params.modelId,
|
||||
});
|
||||
|
||||
const {
|
||||
|
||||
@ -165,6 +165,25 @@ export function handleMessageEnd(
|
||||
const assistantMessage = msg as AssistantMessage;
|
||||
promoteThinkingTagsToBlocks(assistantMessage);
|
||||
|
||||
// Normalize Moonshot thinking signatures on receipt (not on send)
|
||||
// Moonshot via OpenRouter returns "reasoning" but expects "reasoning_content" on replay
|
||||
if (
|
||||
ctx.params.provider === "openrouter" &&
|
||||
ctx.params.modelId?.startsWith("moonshotai/kimi-") &&
|
||||
Array.isArray(assistantMessage.content)
|
||||
) {
|
||||
for (const block of assistantMessage.content) {
|
||||
if (
|
||||
block &&
|
||||
typeof block === "object" &&
|
||||
(block as { type?: unknown }).type === "thinking" &&
|
||||
(block as { thinkingSignature?: unknown }).thinkingSignature === "reasoning"
|
||||
) {
|
||||
(block as { thinkingSignature: string }).thinkingSignature = "reasoning_content";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const rawText = extractAssistantText(assistantMessage);
|
||||
appendRawStream({
|
||||
ts: Date.now(),
|
||||
|
||||
@ -31,6 +31,10 @@ export type SubscribeEmbeddedPiSessionParams = {
|
||||
onAssistantMessageStart?: () => void | Promise<void>;
|
||||
onAgentEvent?: (evt: { stream: string; data: Record<string, unknown> }) => void | Promise<void>;
|
||||
enforceFinalTag?: boolean;
|
||||
/** Provider ID for provider-specific message normalization */
|
||||
provider?: string;
|
||||
/** Model ID for model-specific message normalization */
|
||||
modelId?: string;
|
||||
};
|
||||
|
||||
export type { BlockReplyChunking } from "./pi-embedded-block-chunker.js";
|
||||
|
||||
Loading…
Reference in New Issue
Block a user