feat: update dependencies and enhance chat functionality
- Added new Radix UI components including checkbox, label, popover, slider, switch, and tooltip to improve UI interactions. - Integrated react-syntax-highlighter for better code rendering in chat messages. - Updated package.json and pnpm-lock.yaml to include new dependencies and ensure compatibility. - Enhanced chat input to support web search toggling, improving user experience during message composition. - Implemented auto-saving of chat sessions and improved session management features. - Refactored chat message rendering to clean up metadata and improve display quality.
This commit is contained in:
1 parent
032722e21b
commit
8834ef2b4f
55 files changed
+20030
-159
No files matched your search
@@ -0,0 +1,23 @@
|
||||
const METADATA_BLOCK_REGEX = /<metadata>[\s\S]*?<\/metadata>/gi;
|
||||
const METADATA_TAIL_REGEX = /(metadados?|metadata|hidden metadata block|bloco oculto de metadados|json metadata)\s*:?\s*/gi;
|
||||
|
||||
export function removeMetadataNoise(text: string): string {
|
||||
if (!text) {
|
||||
return '';
|
||||
}
|
||||
|
||||
let cleaned = text.replace(METADATA_BLOCK_REGEX, '').trim();
|
||||
|
||||
// Remove any trailing sections that start with common metadata prefixes
|
||||
cleaned = cleaned.replace(
|
||||
/(metadados?|metadata|hidden metadata block|bloco oculto de metadados|json metadata)\s*:?\s*[\s\S]*$/gi,
|
||||
'',
|
||||
);
|
||||
|
||||
// Remove standalone prefixes that might appear inline
|
||||
cleaned = cleaned.replace(METADATA_TAIL_REGEX, '');
|
||||
|
||||
return cleaned.trim();
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user