fix: preserve inherited fork context and live history attachments

This commit is contained in:
wengshihao
2026-11-06 13:24:38 +08:00
parent 5d71206b72
commit 5800a626b9
10 changed files with 260 additions and 64 deletions
+9
View File
@@ -0,0 +1,9 @@
/** Remove the fork prompt envelope while preserving the snapshot body verbatim. */
export function extractChatHistoryBody(text: string): string {
const bodyStart = text.indexOf("\n\n");
return text.startsWith("<chat-history-summary>\n") &&
text.endsWith("\n</chat-history-summary>") &&
bodyStart !== -1
? text.slice(bodyStart + 2, -"\n</chat-history-summary>".length)
: text;
}