feat(chat): add cleaning for Gateway-injected conversation (#118)
This commit is contained in:
@@ -16,6 +16,10 @@ function cleanUserText(text: string): string {
|
||||
.replace(/\s*\[media attached:[^\]]*\]/g, '')
|
||||
// Remove [message_id: uuid]
|
||||
.replace(/\s*\[message_id:\s*[^\]]+\]/g, '')
|
||||
// Remove Gateway-injected "Conversation info (untrusted metadata): ```json...```" block
|
||||
.replace(/^Conversation info\s*\([^)]*\):\s*```[a-z]*\n[\s\S]*?```\s*/i, '')
|
||||
// Fallback: remove "Conversation info (...): {...}" without code block wrapper
|
||||
.replace(/^Conversation info\s*\([^)]*\):\s*\{[\s\S]*?\}\s*/i, '')
|
||||
// Remove Gateway timestamp prefix like [Fri 2026-02-13 22:39 GMT+8]
|
||||
.replace(/^\[(?:Mon|Tue|Wed|Thu|Fri|Sat|Sun)\s+\d{4}-\d{2}-\d{2}\s+\d{2}:\d{2}\s+[^\]]+\]\s*/i, '')
|
||||
.trim();
|
||||
|
||||
Reference in New Issue
Block a user