diff --git a/application/llm/openai.py b/application/llm/openai.py index 36861584..b8f311b0 100644 --- a/application/llm/openai.py +++ b/application/llm/openai.py @@ -85,7 +85,6 @@ class OpenAILLM(BaseLLM): **kwargs, ): messages = self._clean_messages_openai(messages) - print(messages) if tools: response = self.client.chat.completions.create( model=model, diff --git a/frontend/src/components/SkeletonLoader.tsx b/frontend/src/components/SkeletonLoader.tsx index b73c5835..1f318448 100644 --- a/frontend/src/components/SkeletonLoader.tsx +++ b/frontend/src/components/SkeletonLoader.tsx @@ -91,18 +91,18 @@ const SkeletonLoader: React.FC = ({ ); const renderLogs = () => ( -
+
{[...Array(8)].map((_, idx) => (
-
-
+
+
-
-
-
+
+
+
diff --git a/frontend/src/conversation/ConversationBubble.tsx b/frontend/src/conversation/ConversationBubble.tsx index d60b531a..305c4973 100644 --- a/frontend/src/conversation/ConversationBubble.tsx +++ b/frontend/src/conversation/ConversationBubble.tsx @@ -634,47 +634,46 @@ function ToolCalls({ toolCalls }: { toolCalls: ToolCallsType[] }) { title={`${toolCall.tool_name} - ${toolCall.action_name.substring(0, toolCall.action_name.lastIndexOf('_'))}`} className="w-full rounded-[20px] bg-gray-1000 dark:bg-gun-metal hover:bg-[#F1F1F1] dark:hover:bg-[#2C2E3C]" titleClassName="px-6 py-2 text-sm font-semibold" - children={ -
-
-

- - Arguments - {' '} - -

-

- - {JSON.stringify(toolCall.arguments, null, 2)} - -

-
-
-

- - Response - {' '} - -

-

- - {JSON.stringify(toolCall.result, null, 2)} - -

-
+ > +
+
+

+ + Arguments + {' '} + +

+

+ + {JSON.stringify(toolCall.arguments, null, 2)} + +

- } - /> +
+

+ + Response + {' '} + +

+

+ + {JSON.stringify(toolCall.result, null, 2)} + +

+
+
+ ))}
diff --git a/frontend/src/modals/AddActionModal.tsx b/frontend/src/modals/AddActionModal.tsx index 6ff88ae6..5d7301fb 100644 --- a/frontend/src/modals/AddActionModal.tsx +++ b/frontend/src/modals/AddActionModal.tsx @@ -5,17 +5,17 @@ import Exit from '../assets/exit.svg'; import Input from '../components/Input'; import { ActiveState } from '../models/misc'; +type AddActionModalProps = { + modalState: ActiveState; + setModalState: (state: ActiveState) => void; + handleSubmit: (actionName: string) => void; +}; + const isValidFunctionName = (name: string): boolean => { const pattern = /^[a-zA-Z0-9_-]+$/; return pattern.test(name); }; -interface AddActionModalProps { - modalState: ActiveState; - setModalState: (state: ActiveState) => void; - handleSubmit: (actionName: string) => void; -} - export default function AddActionModal({ modalState, setModalState, @@ -23,18 +23,18 @@ export default function AddActionModal({ }: AddActionModalProps) { const { t } = useTranslation(); const [actionName, setActionName] = React.useState(''); - const [functionNameError, setFunctionNameError] = useState(false); // New error state + const [functionNameError, setFunctionNameError] = useState(false); const handleAddAction = () => { if (!isValidFunctionName(actionName)) { - setFunctionNameError(true); // Set error state if invalid + setFunctionNameError(true); return; } - setFunctionNameError(false); // Clear error state if valid + setFunctionNameError(false); handleSubmit(actionName); + setActionName(''); setModalState('INACTIVE'); }; - return (
{ + setFunctionNameError(false); setModalState('INACTIVE'); + setActionName(''); }} > @@ -62,22 +64,25 @@ export default function AddActionModal({ setActionName(e.target.value)} + onChange={(e) => { + const value = e.target.value; + setActionName(value); + setFunctionNameError(!isValidFunctionName(value)); + }} borderVariant="thin" placeholder={'Enter name'} /> -

- Use only letters, numbers, underscores, and hyphens (e.g., - `get_user_data`, `send-report`). +

+ {functionNameError + ? 'Invalid function name format. Use only letters, numbers, underscores, and hyphens.' + : 'Use only letters, numbers, underscores, and hyphens (e.g., `get_data`, `send_report`, etc.)'}

- {functionNameError && ( -

- Invalid function name format. Use only letters, numbers, - underscores, and hyphens. -

- )}
-
+
-

+

{tool.displayName}

diff --git a/frontend/src/modals/ConfigToolModal.tsx b/frontend/src/modals/ConfigToolModal.tsx index f26029fc..e94a56b0 100644 --- a/frontend/src/modals/ConfigToolModal.tsx +++ b/frontend/src/modals/ConfigToolModal.tsx @@ -61,7 +61,7 @@ export default function ConfigToolModal({ {tool?.name}

- + {t('modals.configTool.apiKeyLabel')}
diff --git a/frontend/src/settings/Documents.tsx b/frontend/src/settings/Documents.tsx index e72a6e16..f4cc3f6e 100644 --- a/frontend/src/settings/Documents.tsx +++ b/frontend/src/settings/Documents.tsx @@ -532,11 +532,12 @@ function DocumentChunks({
) : (
- {paginatedChunks.filter((chunk) => - chunk.metadata?.title + {paginatedChunks.filter((chunk) => { + if (!chunk.metadata?.title) return true; + return chunk.metadata.title .toLowerCase() - .includes(searchTerm.toLowerCase()), - ).length === 0 ? ( + .includes(searchTerm.toLowerCase()); + }).length === 0 ? (
) : ( paginatedChunks - .filter((chunk) => - chunk.metadata?.title + .filter((chunk) => { + if (!chunk.metadata?.title) return true; + return chunk.metadata.title .toLowerCase() - .includes(searchTerm.toLowerCase()), - ) + .includes(searchTerm.toLowerCase()); + }) .map((chunk, index) => (

- {chunk.metadata?.title} + {chunk.metadata?.title ?? 'Untitled'}

{chunk.text} @@ -591,11 +593,12 @@ function DocumentChunks({

)} {!loading && - paginatedChunks.filter((chunk) => - chunk.metadata?.title + paginatedChunks.filter((chunk) => { + if (!chunk.metadata?.title) return true; + return chunk.metadata.title .toLowerCase() - .includes(searchTerm.toLowerCase()), - ).length !== 0 && ( + .includes(searchTerm.toLowerCase()); + }).length !== 0 && (
- {loadingChatbots ? ( - - ) : ( -
- - ({ - label: chatbot.name, - value: chatbot.id, - })), - { label: t('settings.logs.none'), value: '' }, - ]} - placeholder={t('settings.logs.selectChatbot')} - onSelect={(chatbot: { label: string; value: string }) => { - setSelectedChatbot( - chatbots.find((item) => item.id === chatbot.value), - ); - setLogs([]); - setPage(1); - setHasMore(true); - }} - selectedValue={ - (selectedChatbot && { - label: selectedChatbot.name, - value: selectedChatbot.id, - }) || - null - } - rounded="3xl" - border="border" - /> -
- )} +
+ + ({ + label: chatbot.name, + value: chatbot.id, + })), + { label: t('settings.logs.none'), value: '' }, + ]} + placeholder={t('settings.logs.selectChatbot')} + onSelect={(chatbot: { label: string; value: string }) => { + setSelectedChatbot( + chatbots.find((item) => item.id === chatbot.value), + ); + setLogs([]); + setPage(1); + setHasMore(true); + }} + selectedValue={ + (selectedChatbot && { + label: selectedChatbot.name, + value: selectedChatbot.id, + }) || + null + } + rounded="3xl" + border="border" + /> +
@@ -148,7 +144,7 @@ function LogsTable({ logs, setPage, loading }: LogsTableProps) { {logs?.map((log, index) => { if (index === logs.length - 1) { return ( -
+
); @@ -170,22 +166,26 @@ function Log({ log }: { log: LogData }) { const { id, action, timestamp, ...filteredLog } = log; return (
- + Expand log entry

{`${log.timestamp}`}

{`[${log.action}]`}

{`${log.question}`}

+ className={`max-w-72 text-xs ${logLevelColor[log.level]} break-words`} + > + {`${log.question}`.length > 250 + ? `${log.question.substring(0, 250)}...` + : log.question} +
-

+

{JSON.stringify(filteredLog, null, 2)}