diff --git a/tauri-app/src/lib/chat.ts b/tauri-app/src/lib/chat.ts index 9f254a5..da31dea 100644 --- a/tauri-app/src/lib/chat.ts +++ b/tauri-app/src/lib/chat.ts @@ -60,9 +60,11 @@ function stripQwenChatTemplateTokens(text: string): string { function hasKnownPromptEcho(text: string): boolean { return /^\s*you are a helpful ai assistant\.?/i.test(text) + || /^\s*you are a helpful local ai assistant\.?/i.test(text) || /^\s*you will be tested with prior context/i.test(text) || /^\s*you are a precise coding assistant running locally\.?/i.test(text) - || /^\s*(?:#{1,6}\s*)?(?:System|Developer)\s*:\s*you are a precise coding assistant running locally\.?/i.test(text); + || /^\s*(?:#{1,6}\s*)?(?:System|Developer)\s*:\s*you are a precise coding assistant running locally\.?/i.test(text) + || /^\s*(?:#{1,6}\s*)?(?:System|Developer)\s*:\s*you are a helpful local ai assistant/i.test(text); } function stripLeadingFencedTranscriptLeakage(text: string): string { @@ -106,10 +108,12 @@ export function stripPromptEchoAndTranscriptLeakage(text: string): string { // Known leaked system-prompt openings: drop them entirely. if (/^\s*you are a helpful ai assistant\.?/i.test(trimmed)) return ""; + if (/^\s*you are a helpful local ai assistant\.?/i.test(trimmed)) return ""; if (/^\s*you will be tested with prior context/i.test(trimmed)) return ""; if (/^\s*you are a precise coding assistant running locally\.?/i.test(trimmed)) return ""; if (/^\s*(?:#{1,6}\s*)?(?:System|Developer)\s*:\s*you are a precise coding assistant running locally\.?/i.test(trimmed)) return ""; if (/^\s*(?:#{1,6}\s*)?(?:System|Developer)\s*:\s*you are a precise coding assistant running locally\.?/i.test(fenceStripped)) return ""; + if (/^\s*(?:#{1,6}\s*)?(?:System|Developer)\s*:\s*you are a helpful local ai assistant/i.test(trimmed)) return ""; return withoutLeadingLeakedFence; }