From 2710242982273c3190e33eac1747a6abeccc0489 Mon Sep 17 00:00:00 2001 From: KVOJJJin Date: Wed, 5 Feb 2025 13:58:19 +0800 Subject: [PATCH] Feat: feature and log dark mode (#13208) --- .../agent-tools/setting-built-in-tool.tsx | 3 +- .../app/configuration/debug/index.tsx | 2 +- .../base/agent-log-modal/detail.tsx | 14 +++--- .../components/base/agent-log-modal/index.tsx | 6 +-- .../base/agent-log-modal/iteration.tsx | 9 ++-- .../base/agent-log-modal/result.tsx | 38 ++++++++-------- .../base/agent-log-modal/tool-call.tsx | 14 +++--- .../base/agent-log-modal/tracing.tsx | 2 +- .../components/base/copy-feedback/index.tsx | 2 +- .../conversation-opener/modal.tsx | 32 ++++++++++---- .../moderation/form-generation.tsx | 4 +- .../moderation/moderation-content.tsx | 20 ++++----- .../moderation/moderation-setting-modal.tsx | 44 ++++++++++--------- .../text-to-speech/param-config-content.tsx | 28 ++++++------ .../components/base/prompt-log-modal/card.tsx | 6 +-- .../base/prompt-log-modal/index.tsx | 10 ++--- .../api-based-extension-page/modal.tsx | 18 ++++---- .../api-based-extension-page/selector.tsx | 28 ++++++------ .../multiple-tool-selector/index.tsx | 9 +++- .../tool-selector/index.tsx | 12 +++-- .../workflow/block-selector/tool-picker.tsx | 5 ++- .../workflow/run/assets/highlight-dark.svg | 9 ++++ .../workflow/run/status-container.tsx | 33 +++++++++++--- web/app/components/workflow/run/status.tsx | 2 +- web/context/app-context.tsx | 1 + 25 files changed, 208 insertions(+), 143 deletions(-) create mode 100644 web/app/components/workflow/run/assets/highlight-dark.svg diff --git a/web/app/components/app/configuration/config/agent/agent-tools/setting-built-in-tool.tsx b/web/app/components/app/configuration/config/agent/agent-tools/setting-built-in-tool.tsx index e4fae3fbc1..da6063045a 100644 --- a/web/app/components/app/configuration/config/agent/agent-tools/setting-built-in-tool.tsx +++ b/web/app/components/app/configuration/config/agent/agent-tools/setting-built-in-tool.tsx @@ -151,7 +151,6 @@ const SettingBuiltInTool: FC = ({ isEditMode={false} showOnVariableMap={{}} validating={false} - inputClassName='!bg-gray-50' readonly={readonly} /> ) @@ -224,7 +223,7 @@ const SettingBuiltInTool: FC = ({ {!readonly && !isInfoActive && (
- +
)} diff --git a/web/app/components/app/configuration/debug/index.tsx b/web/app/components/app/configuration/debug/index.tsx index 99632eb0d3..480bd782ae 100644 --- a/web/app/components/app/configuration/debug/index.tsx +++ b/web/app/components/app/configuration/debug/index.tsx @@ -48,7 +48,7 @@ import PromptLogModal from '@/app/components/base/prompt-log-modal' import { useStore as useAppStore } from '@/app/components/app/store' import { useFeatures, useFeaturesStore } from '@/app/components/base/features/hooks' -interface IDebug { +type IDebug = { isAPIKeySet: boolean onSetting: () => void inputs: Inputs diff --git a/web/app/components/base/agent-log-modal/detail.tsx b/web/app/components/base/agent-log-modal/detail.tsx index e90f593ad0..62bdb4b172 100644 --- a/web/app/components/base/agent-log-modal/detail.tsx +++ b/web/app/components/base/agent-log-modal/detail.tsx @@ -81,26 +81,26 @@ const AgentLogDetail: FC = ({ return (
{/* tab */} -
+
switchTab('DETAIL')} >{t('runLog.detail')}
switchTab('TRACING')} >{t('runLog.tracing')}
{/* panel detail */} -
+
{loading && ( -
+
)} diff --git a/web/app/components/base/agent-log-modal/index.tsx b/web/app/components/base/agent-log-modal/index.tsx index bbe1167f57..3e62a7f121 100644 --- a/web/app/components/base/agent-log-modal/index.tsx +++ b/web/app/components/base/agent-log-modal/index.tsx @@ -35,7 +35,7 @@ const AgentLogModal: FC = ({ return (
= ({ }} ref={ref} > -

{t('appLog.runDetail.workflowTitle')}

+

{t('appLog.runDetail.workflowTitle')}

- + = ({ iterationInfo, isFinal, index }) => {
{isFinal && ( -
{t('appLog.agentLogDetail.finalProcessing')}
+
{t('appLog.agentLogDetail.finalProcessing')}
)} {!isFinal && ( -
{`${t('appLog.agentLogDetail.iteration').toUpperCase()} ${index}`}
+
{`${t('appLog.agentLogDetail.iteration').toUpperCase()} ${index}`}
)} -
+
= ({ const { formatTime } = useTimestamp() return ( -
+
= ({ />
-
+
-
{t('runLog.meta.title')}
+
{t('runLog.meta.title')}
-
{t('runLog.meta.status')}
-
+
{t('runLog.meta.status')}
+
SUCCESS
-
{t('runLog.meta.executor')}
-
+
{t('runLog.meta.executor')}
+
{created_by || 'N/A'}
-
{t('runLog.meta.startTime')}
-
+
{t('runLog.meta.startTime')}
+
{formatTime(Date.parse(created_at) / 1000, t('appLog.dateTimeFormat') as string)}
-
{t('runLog.meta.time')}
-
+
{t('runLog.meta.time')}
+
{`${elapsed_time?.toFixed(3)}s`}
-
{t('runLog.meta.tokens')}
-
+
{t('runLog.meta.tokens')}
+
{`${total_tokens || 0} Tokens`}
-
{t('appLog.agentLogDetail.agentMode')}
-
+
{t('appLog.agentLogDetail.agentMode')}
+
{agentMode === 'function_call' ? t('appDebug.agent.agentModeType.functionCall') : t('appDebug.agent.agentModeType.ReACT')}
-
{t('appLog.agentLogDetail.toolUsed')}
-
+
{t('appLog.agentLogDetail.toolUsed')}
+
{tools?.length ? tools?.join(', ') : 'Null'}
-
{t('appLog.agentLogDetail.iterations')}
-
+
{t('appLog.agentLogDetail.iterations')}
+
{iterations}
diff --git a/web/app/components/base/agent-log-modal/tool-call.tsx b/web/app/components/base/agent-log-modal/tool-call.tsx index 8d8e583126..d77a3f60b9 100644 --- a/web/app/components/base/agent-log-modal/tool-call.tsx +++ b/web/app/components/base/agent-log-modal/tool-call.tsx @@ -33,7 +33,7 @@ const ToolCallItem: FC = ({ toolCall, isLLM = false, isFinal, tokens, obs if (time < 1) return `${(time * 1000).toFixed(3)} ms` if (time > 60) - return `${parseInt(Math.round(time / 60).toString())} m ${(time % 60).toFixed(3)} s` + return `${Number.parseInt(Math.round(time / 60).toString())} m ${(time % 60).toFixed(3)} s` return `${time.toFixed(3)} s` } @@ -41,14 +41,14 @@ const ToolCallItem: FC = ({ toolCall, isLLM = false, isFinal, tokens, obs if (tokens < 1000) return tokens if (tokens >= 1000 && tokens < 1000000) - return `${parseFloat((tokens / 1000).toFixed(3))}K` + return `${Number.parseFloat((tokens / 1000).toFixed(3))}K` if (tokens >= 1000000) - return `${parseFloat((tokens / 1000000).toFixed(3))}M` + return `${Number.parseFloat((tokens / 1000000).toFixed(3))}M` } return (
-
+
= ({ toolCall, isLLM = false, isFinal, tokens, obs >
{toolName}
-
+
{toolCall.time_cost && ( {getTime(toolCall.time_cost || 0)} )} diff --git a/web/app/components/base/agent-log-modal/tracing.tsx b/web/app/components/base/agent-log-modal/tracing.tsx index 59cffa0055..c390d256e1 100644 --- a/web/app/components/base/agent-log-modal/tracing.tsx +++ b/web/app/components/base/agent-log-modal/tracing.tsx @@ -9,7 +9,7 @@ type TracingPanelProps = { const TracingPanel: FC = ({ list }) => { return ( -
+
{list.map((iteration, index) => (
diff --git a/web/app/components/base/features/new-feature-panel/conversation-opener/modal.tsx b/web/app/components/base/features/new-feature-panel/conversation-opener/modal.tsx index 41ed043e93..a03886923e 100644 --- a/web/app/components/base/features/new-feature-panel/conversation-opener/modal.tsx +++ b/web/app/components/base/features/new-feature-panel/conversation-opener/modal.tsx @@ -6,12 +6,14 @@ import { ReactSortable } from 'react-sortablejs' import { RiAddLine, RiAsterisk, RiCloseLine, RiDeleteBinLine, RiDraggable } from '@remixicon/react' import Modal from '@/app/components/base/modal' import Button from '@/app/components/base/button' +import Divider from '@/app/components/base/divider' import ConfirmAddVar from '@/app/components/app/configuration/config-prompt/confirm-add-var' import type { OpeningStatement } from '@/app/components/base/features/types' import { getInputKeys } from '@/app/components/base/block-input' import type { PromptVariable } from '@/models/debug' import type { InputVar } from '@/app/components/workflow/types' import { getNewVar } from '@/utils/var' +import cn from '@/utils/classnames' type OpeningSettingModalProps = { data: OpeningStatement @@ -86,16 +88,19 @@ const OpeningSettingModal = ({ handleSave(true) }, [handleSave, hideConfirmAddVar, notIncludeKeys, onAutoAddPromptVariable]) + const [focusID, setFocusID] = useState(null) + const [deletingID, setDeletingID] = useState(null) + const renderQuestions = () => { return (
-
+
{t('appDebug.openingStatement.openingQuestion')}
ยท
{tempSuggestedQuestions.length}/{MAX_QUESTION_NUM}
-
+
{tempSuggestedQuestions.map((question, index) => { return ( -
- +
+ setFocusID(index)} + onBlur={() => setFocusID(null)} />
{ setTempSuggestedQuestions(tempSuggestedQuestions.filter((_, i) => index !== i)) }} + onMouseEnter={() => setDeletingID(index)} + onMouseLeave={() => setDeletingID(null)} >
@@ -143,9 +159,9 @@ const OpeningSettingModal = ({ {tempSuggestedQuestions.length < MAX_QUESTION_NUM && (
{ setTempSuggestedQuestions([...tempSuggestedQuestions, '']) }} - className='mt-1 flex items-center h-9 px-3 gap-2 rounded-lg cursor-pointer text-gray-400 bg-gray-100 hover:bg-gray-200'> + className='mt-1 flex items-center h-9 px-3 gap-2 rounded-lg cursor-pointer text-components-button-tertiary-text bg-components-button-tertiary-bg hover:bg-components-button-tertiary-bg-hover'> -
{t('appDebug.variableConfig.addOption')}
+
{t('appDebug.variableConfig.addOption')}
)}
diff --git a/web/app/components/base/features/new-feature-panel/moderation/form-generation.tsx b/web/app/components/base/features/new-feature-panel/moderation/form-generation.tsx index 067d00923a..f5cddcc9a0 100644 --- a/web/app/components/base/features/new-feature-panel/moderation/form-generation.tsx +++ b/web/app/components/base/features/new-feature-panel/moderation/form-generation.tsx @@ -30,14 +30,14 @@ const FormGeneration: FC = ({ key={index} className='py-2' > -
+
{locale === 'zh-Hans' ? form.label['zh-Hans'] : form.label['en-US']}
{ form.type === 'text-input' && ( handleFormChange(form.variable, e.target.value)} /> diff --git a/web/app/components/base/features/new-feature-panel/moderation/moderation-content.tsx b/web/app/components/base/features/new-feature-panel/moderation/moderation-content.tsx index 7cb8114959..a6e122fb2b 100644 --- a/web/app/components/base/features/new-feature-panel/moderation/moderation-content.tsx +++ b/web/app/components/base/features/new-feature-panel/moderation/moderation-content.tsx @@ -27,13 +27,13 @@ const ModerationContent: FC = ({ return (
-
+
-
{title}
+
{title}
{ info && ( -
{info}
+
{info}
) } = ({
{ config.enabled && showPreset && ( -
-
+
+
{t('appDebug.feature.moderation.modal.content.preset')} - {t('appDebug.feature.moderation.modal.content.supportMarkdown')} + {t('appDebug.feature.moderation.modal.content.supportMarkdown')}
-
+