diff --git a/frontend/src/agents/AgentPreview.tsx b/frontend/src/agents/AgentPreview.tsx index ab63c06b..a242e52a 100644 --- a/frontend/src/agents/AgentPreview.tsx +++ b/frontend/src/agents/AgentPreview.tsx @@ -109,18 +109,18 @@ export default function AgentPreview() { } else setLastQueryReturnedErr(false); }, [queries]); return ( -
-
-
- -
-
+
+
+ +
+
+
handleQuestionSubmission(text)} loading={status === 'loading'} @@ -128,11 +128,11 @@ export default function AgentPreview() { showToolButton={selectedAgent ? false : true} autoFocus={false} /> -

- This is a preview of the agent. You can publish it to start using it - in conversations. -

+

+ This is a preview of the agent. You can publish it to start using it + in conversations. +

); diff --git a/frontend/src/agents/NewAgent.tsx b/frontend/src/agents/NewAgent.tsx index ada4b9ae..1eb36c22 100644 --- a/frontend/src/agents/NewAgent.tsx +++ b/frontend/src/agents/NewAgent.tsx @@ -534,7 +534,7 @@ export default function NewAgent({ mode }: { mode: 'new' | 'edit' | 'draft' }) { setHasChanges(isChanged); }, [agent, dispatch, effectiveMode, imageFile, jsonSchemaText]); return ( -
+
-
-
-
+
+
+

Meta

-
+

Source

@@ -744,7 +744,7 @@ export default function NewAgent({ mode }: { mode: 'new' | 'edit' | 'draft' }) {
-
+
-
+

Tools

-
+

Agent type

-
+
-
+

Preview

- +
+ +
+
{selectedAgent?.status === 'published' ? ( -
+
) : ( diff --git a/frontend/src/agents/SharedAgent.tsx b/frontend/src/agents/SharedAgent.tsx index ad8ba11c..4d39e81f 100644 --- a/frontend/src/agents/SharedAgent.tsx +++ b/frontend/src/agents/SharedAgent.tsx @@ -177,13 +177,15 @@ export default function SharedAgent() { />
- handleQuestionSubmission(text)} - loading={status === 'loading'} - showSourceButton={sharedAgent ? false : true} - showToolButton={sharedAgent ? false : true} - autoFocus={false} - /> +
+ handleQuestionSubmission(text)} + loading={status === 'loading'} + showSourceButton={sharedAgent ? false : true} + showToolButton={sharedAgent ? false : true} + autoFocus={false} + /> +

{t('tagline')}

diff --git a/frontend/src/assets/no-files.svg b/frontend/src/assets/no-files.svg index 36510546..46f5565e 100644 --- a/frontend/src/assets/no-files.svg +++ b/frontend/src/assets/no-files.svg @@ -1,5 +1,5 @@ - + diff --git a/frontend/src/components/MessageInput.tsx b/frontend/src/components/MessageInput.tsx index 3b5bdd3c..dae3b4bc 100644 --- a/frontend/src/components/MessageInput.tsx +++ b/frontend/src/components/MessageInput.tsx @@ -91,8 +91,10 @@ export default function MessageInput({ const apiHost = import.meta.env.VITE_API_HOST; const xhr = new XMLHttpRequest(); + const uniqueId = crypto.randomUUID(); const newAttachment = { + id: uniqueId, fileName: file.name, progress: 0, status: 'uploading' as const, @@ -106,7 +108,7 @@ export default function MessageInput({ const progress = Math.round((event.loaded / event.total) * 100); dispatch( updateAttachment({ - taskId: newAttachment.taskId, + id: uniqueId, updates: { progress }, }), ); @@ -119,7 +121,7 @@ export default function MessageInput({ if (response.task_id) { dispatch( updateAttachment({ - taskId: newAttachment.taskId, + id: uniqueId, updates: { taskId: response.task_id, status: 'processing', @@ -131,7 +133,7 @@ export default function MessageInput({ } else { dispatch( updateAttachment({ - taskId: newAttachment.taskId, + id: uniqueId, updates: { status: 'failed' }, }), ); @@ -141,7 +143,7 @@ export default function MessageInput({ xhr.onerror = () => { dispatch( updateAttachment({ - taskId: newAttachment.taskId, + id: uniqueId, updates: { status: 'failed' }, }), ); @@ -167,7 +169,7 @@ export default function MessageInput({ if (data.status === 'SUCCESS') { dispatch( updateAttachment({ - taskId: attachment.taskId!, + id: attachment.id, updates: { status: 'completed', progress: 100, @@ -179,14 +181,14 @@ export default function MessageInput({ } else if (data.status === 'FAILURE') { dispatch( updateAttachment({ - taskId: attachment.taskId!, + id: attachment.id, updates: { status: 'failed' }, }), ); } else if (data.status === 'PROGRESS' && data.result?.current) { dispatch( updateAttachment({ - taskId: attachment.taskId!, + id: attachment.id, updates: { progress: data.result.current }, }), ); @@ -195,7 +197,7 @@ export default function MessageInput({ .catch(() => { dispatch( updateAttachment({ - taskId: attachment.taskId!, + id: attachment.id, updates: { status: 'failed' }, }), ); @@ -260,12 +262,12 @@ export default function MessageInput({ }; return ( -
+
- {attachments.map((attachment, index) => ( + {attachments.map((attachment) => (
{ - if (attachment.id) { - dispatch(removeAttachment(attachment.id)); - } else if (attachment.taskId) { - dispatch(removeAttachment(attachment.taskId)); - } + dispatch(removeAttachment(attachment.id)); }} aria-label={t('conversation.attachments.remove')} > diff --git a/frontend/src/components/Sidebar.tsx b/frontend/src/components/Sidebar.tsx index 80ad08b7..77908f8b 100644 --- a/frontend/src/components/Sidebar.tsx +++ b/frontend/src/components/Sidebar.tsx @@ -33,7 +33,7 @@ export default function Sidebar({ return (
diff --git a/frontend/src/components/SourcesPopup.tsx b/frontend/src/components/SourcesPopup.tsx index 0422edf2..b3685921 100644 --- a/frontend/src/components/SourcesPopup.tsx +++ b/frontend/src/components/SourcesPopup.tsx @@ -1,4 +1,5 @@ import React, { useRef, useEffect, useState, useLayoutEffect } from 'react'; +import { createPortal } from 'react-dom'; import { useTranslation } from 'react-i18next'; import { useDispatch, useSelector } from 'react-redux'; import { Doc } from '../models/misc'; @@ -107,7 +108,7 @@ export default function SourcesPopup({ onClose(); }; - return ( + const popupContent = (
) : (
- {t('noSourcesAvailable')} + {t('conversation.sources.noSourcesAvailable')}
)}
@@ -245,4 +246,6 @@ export default function SourcesPopup({
); + + return createPortal(popupContent, document.body); } diff --git a/frontend/src/components/ToolsPopup.tsx b/frontend/src/components/ToolsPopup.tsx index 6e9756c8..11f01cab 100644 --- a/frontend/src/components/ToolsPopup.tsx +++ b/frontend/src/components/ToolsPopup.tsx @@ -1,4 +1,5 @@ import React, { useEffect, useRef, useState, useLayoutEffect } from 'react'; +import { createPortal } from 'react-dom'; import { useTranslation } from 'react-i18next'; import { useSelector } from 'react-redux'; import { selectToken } from '../preferences/preferenceSlice'; @@ -133,10 +134,10 @@ export default function ToolsPopup({ tool.displayName.toLowerCase().includes(searchTerm.toLowerCase()), ); - return ( + const popupContent = (
); + + return createPortal(popupContent, document.body); } diff --git a/frontend/src/components/UploadToast.tsx b/frontend/src/components/UploadToast.tsx index 3d1dd03f..e6122e0e 100644 --- a/frontend/src/components/UploadToast.tsx +++ b/frontend/src/components/UploadToast.tsx @@ -44,7 +44,10 @@ export default function UploadToast() { }; return ( -
+
e.stopPropagation()} + > {uploadTasks .filter((task) => !task.dismissed) .map((task) => { diff --git a/frontend/src/conversation/Conversation.tsx b/frontend/src/conversation/Conversation.tsx index 312b92c9..aa11bbde 100644 --- a/frontend/src/conversation/Conversation.tsx +++ b/frontend/src/conversation/Conversation.tsx @@ -224,7 +224,7 @@ export default function Conversation() {
-
+
{sources.sources.map((source, index) => { const isExternalSource = source.link && source.link !== 'local'; return ( diff --git a/frontend/src/conversation/SharedConversation.tsx b/frontend/src/conversation/SharedConversation.tsx index 9f99db30..cd68df64 100644 --- a/frontend/src/conversation/SharedConversation.tsx +++ b/frontend/src/conversation/SharedConversation.tsx @@ -161,14 +161,16 @@ export const SharedConversation = () => { />
{apiKey ? ( - { - handleQuestionSubmission(text); - }} - loading={status === 'loading'} - showSourceButton={false} - showToolButton={false} - /> +
+ { + handleQuestionSubmission(text); + }} + loading={status === 'loading'} + showSourceButton={false} + showToolButton={false} + /> +
) : (