refactor(context-injector): remove chat.message hook, insert synthetic part in transform
- Remove injectPendingContext function (no longer needed) - Remove createContextInjectorHook function (chat.message hook removed) - Change transform hook from prepend to synthetic part insertion - Follow empty-message-sanitizer pattern (minimal field set) - synthetic: true flag hides content from UI but passes to model - Synthetic part inserted BEFORE user text part
This commit is contained in:
parent
188bbef018
commit
d3e3371a77
@ -142,14 +142,21 @@ export function createContextInjectorMessagesTransformHook(
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
const textPart = lastUserMessage.parts[textPartIndex] as { text?: string }
|
// empty-message-sanitizer 패턴 그대로 따름 (minimal fields)
|
||||||
const originalText = textPart.text ?? ""
|
const syntheticPart = {
|
||||||
textPart.text = `${pending.merged}\n\n---\n\n${originalText}`
|
id: `synthetic_hook_${Date.now()}`,
|
||||||
|
messageID: lastUserMessage.info.id,
|
||||||
|
sessionID: (lastUserMessage.info as { sessionID?: string }).sessionID ?? "",
|
||||||
|
type: "text" as const,
|
||||||
|
text: pending.merged,
|
||||||
|
synthetic: true, // UI에서 숨겨짐
|
||||||
|
}
|
||||||
|
|
||||||
log("[context-injector] Prepended context to last user message", {
|
lastUserMessage.parts.splice(textPartIndex, 0, syntheticPart as Part)
|
||||||
|
|
||||||
|
log("[context-injector] Inserted synthetic part with hook content", {
|
||||||
sessionID,
|
sessionID,
|
||||||
contextLength: pending.merged.length,
|
contentLength: pending.merged.length,
|
||||||
originalTextLength: originalText.length,
|
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user