feat: enhance input field and agent stream display with improved handling and sanitization
- Added blur handling for the textarea in the Input-field component to prevent errors when navigating away from the component. - Improved the sanitization process in the AgentStreamDisplay component to preserve specific tags during markdown processing, ensuring accurate content display. - Introduced new methods for handling FAQ-specific post-processing in the knowledge base service, optimizing retrieval and filtering of search results. These changes enhance user experience by improving input handling and content rendering in the chat interface.
This commit is contained in:
@@ -1375,6 +1375,11 @@ const createSession = async (val: string) => {
|
||||
kb_type: item.type === 'kb' ? (item.kbType || 'document') : undefined
|
||||
}));
|
||||
const imageFiles = uploadedImages.value.map(img => img.file);
|
||||
// Blur the textarea BEFORE emitting, so that when the parent navigates away
|
||||
// and Vue unmounts this component, TDesign's blur handler won't fire on a
|
||||
// detached DOM element (which causes getComputedStyle to throw).
|
||||
const textarea = getTextareaEl();
|
||||
if (textarea) textarea.blur();
|
||||
emit('send-msg', val, selectedModelId.value, mentionedItems, imageFiles);
|
||||
// Clean up image previews
|
||||
uploadedImages.value.forEach(img => URL.revokeObjectURL(img.preview));
|
||||
@@ -1560,6 +1565,9 @@ const handleSelectAgent = (agent: CustomAgent, sourceTenantId?: string) => {
|
||||
}
|
||||
|
||||
const clearvalue = () => {
|
||||
// Guard: only clear when the textarea DOM element is still mounted,
|
||||
// otherwise TDesign's autosize will call getComputedStyle on a non-Element.
|
||||
if (!getTextareaEl()) return;
|
||||
query.value = "";
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user