diff --git a/.github/workflows/style.yml b/.github/workflows/style.yml index b6c9131c0..9c79dbc57 100644 --- a/.github/workflows/style.yml +++ b/.github/workflows/style.yml @@ -89,7 +89,9 @@ jobs: - name: Web style check if: steps.changed-files.outputs.any_changed == 'true' working-directory: ./web - run: pnpm run lint + run: | + pnpm run lint + pnpm run eslint docker-compose-template: name: Docker Compose Template diff --git a/web/__tests__/check-i18n.test.ts b/web/__tests__/check-i18n.test.ts index b4c4f1540..b579f22d4 100644 --- a/web/__tests__/check-i18n.test.ts +++ b/web/__tests__/check-i18n.test.ts @@ -621,7 +621,7 @@ export default translation && !trimmed.startsWith('//')) break } - else { + else { break } diff --git a/web/__tests__/description-validation.test.tsx b/web/__tests__/description-validation.test.tsx index 85263b035..a78a4e632 100644 --- a/web/__tests__/description-validation.test.tsx +++ b/web/__tests__/description-validation.test.tsx @@ -60,7 +60,7 @@ describe('Description Validation Logic', () => { try { validateDescriptionLength(invalidDescription) } - catch (error) { + catch (error) { expect((error as Error).message).toBe(expectedErrorMessage) } }) @@ -86,7 +86,7 @@ describe('Description Validation Logic', () => { expect(() => validateDescriptionLength(testDescription)).not.toThrow() expect(validateDescriptionLength(testDescription)).toBe(testDescription) } - else { + else { expect(() => validateDescriptionLength(testDescription)).toThrow( 'Description cannot exceed 400 characters.', ) diff --git a/web/__tests__/document-list-sorting.test.tsx b/web/__tests__/document-list-sorting.test.tsx index 1510dbec2..77c0bb60c 100644 --- a/web/__tests__/document-list-sorting.test.tsx +++ b/web/__tests__/document-list-sorting.test.tsx @@ -39,7 +39,7 @@ describe('Document List Sorting', () => { const result = aValue.localeCompare(bValue) return order === 'asc' ? result : -result } - else { + else { const result = aValue - bValue return order === 'asc' ? result : -result } diff --git a/web/__tests__/plugin-tool-workflow-error.test.tsx b/web/__tests__/plugin-tool-workflow-error.test.tsx index 370052bc8..87bda8fa1 100644 --- a/web/__tests__/plugin-tool-workflow-error.test.tsx +++ b/web/__tests__/plugin-tool-workflow-error.test.tsx @@ -196,7 +196,7 @@ describe('Plugin Tool Workflow Integration', () => { const _pluginId = (tool.uniqueIdentifier as any).split(':')[0] }).toThrow() } - else { + else { // Valid tools should work fine expect(() => { const _pluginId = tool.uniqueIdentifier.split(':')[0] diff --git a/web/__tests__/real-browser-flicker.test.tsx b/web/__tests__/real-browser-flicker.test.tsx index cf3abd5f8..52bdf4777 100644 --- a/web/__tests__/real-browser-flicker.test.tsx +++ b/web/__tests__/real-browser-flicker.test.tsx @@ -252,7 +252,7 @@ describe('Real Browser Environment Dark Mode Flicker Test', () => { if (hasStyleChange) console.log('⚠️ Style changes detected - this causes visible flicker') - else + else console.log('✅ No style changes detected') expect(timingData.length).toBeGreaterThan(1) diff --git a/web/__tests__/workflow-parallel-limit.test.tsx b/web/__tests__/workflow-parallel-limit.test.tsx index 0843122ab..64e9d328f 100644 --- a/web/__tests__/workflow-parallel-limit.test.tsx +++ b/web/__tests__/workflow-parallel-limit.test.tsx @@ -15,7 +15,7 @@ const originalEnv = process.env.NEXT_PUBLIC_MAX_PARALLEL_LIMIT function setupEnvironment(value?: string) { if (value) process.env.NEXT_PUBLIC_MAX_PARALLEL_LIMIT = value - else + else delete process.env.NEXT_PUBLIC_MAX_PARALLEL_LIMIT // Clear module cache to force re-evaluation @@ -25,7 +25,7 @@ function setupEnvironment(value?: string) { function restoreEnvironment() { if (originalEnv) process.env.NEXT_PUBLIC_MAX_PARALLEL_LIMIT = originalEnv - else + else delete process.env.NEXT_PUBLIC_MAX_PARALLEL_LIMIT jest.resetModules() diff --git a/web/app/(commonLayout)/app/(appDetailLayout)/[appId]/overview/tracing/__tests__/svg-attribute-error-reproduction.spec.tsx b/web/app/(commonLayout)/app/(appDetailLayout)/[appId]/overview/tracing/__tests__/svg-attribute-error-reproduction.spec.tsx index a3281be8e..b1e915b2b 100644 --- a/web/app/(commonLayout)/app/(appDetailLayout)/[appId]/overview/tracing/__tests__/svg-attribute-error-reproduction.spec.tsx +++ b/web/app/(commonLayout)/app/(appDetailLayout)/[appId]/overview/tracing/__tests__/svg-attribute-error-reproduction.spec.tsx @@ -47,7 +47,7 @@ describe('SVG Attribute Error Reproduction', () => { console.log(` ${index + 1}. ${error.substring(0, 100)}...`) }) } - else { + else { console.log('No inkscape errors found in this render') } @@ -150,7 +150,7 @@ describe('SVG Attribute Error Reproduction', () => { if (problematicKeys.length > 0) console.log(`🚨 PROBLEM: Still found problematic attributes: ${problematicKeys.join(', ')}`) - else + else console.log('✅ No problematic attributes found after normalization') }) }) diff --git a/web/app/account/(commonLayout)/account-page/AvatarWithEdit.tsx b/web/app/account/(commonLayout)/account-page/AvatarWithEdit.tsx index 0408d2ee3..5890c2ea9 100644 --- a/web/app/account/(commonLayout)/account-page/AvatarWithEdit.tsx +++ b/web/app/account/(commonLayout)/account-page/AvatarWithEdit.tsx @@ -106,7 +106,7 @@ const AvatarWithEdit = ({ onSave, ...props }: AvatarWithEditProps) => { onClick={() => { if (hoverArea === 'right' && !onAvatarError) setIsShowDeleteConfirm(true) - else + else setIsShowAvatarPicker(true) }} onMouseMove={(e) => { diff --git a/web/app/components/app-sidebar/basic.tsx b/web/app/components/app-sidebar/basic.tsx index 00357d6c2..77a965c03 100644 --- a/web/app/components/app-sidebar/basic.tsx +++ b/web/app/components/app-sidebar/basic.tsx @@ -45,8 +45,8 @@ const ICON_MAP = { , dataset: , webapp:
- -
, + + , notion: , } diff --git a/web/app/components/app-sidebar/index.tsx b/web/app/components/app-sidebar/index.tsx index c3ff45d6a..c60aa26f5 100644 --- a/web/app/components/app-sidebar/index.tsx +++ b/web/app/components/app-sidebar/index.tsx @@ -62,12 +62,12 @@ const AppDetailNav = ({ title, desc, isExternal, icon, icon_background, navigati }, [appSidebarExpand, setAppSiderbarExpand]) if (inWorkflowCanvas && hideHeader) { - return ( + return (
) -} + } return (
{ })) }) - describe('Issue #1: Toggle Button Position Movement - FIXED', () => { + describe('Issue #1: Toggle Button Position Movement - FIXED', () => { it('should verify consistent padding prevents button position shift', () => { let expanded = false const handleToggle = () => { diff --git a/web/app/components/app/annotation/index.tsx b/web/app/components/app/annotation/index.tsx index bb2a95b0b..afa873270 100644 --- a/web/app/components/app/annotation/index.tsx +++ b/web/app/components/app/annotation/index.tsx @@ -84,7 +84,7 @@ const Annotation: FC = (props) => { setList(data as AnnotationItem[]) setTotal(total) } - finally { + finally { setIsLoading(false) } } diff --git a/web/app/components/app/configuration/config-var/config-modal/type-select.tsx b/web/app/components/app/configuration/config-var/config-modal/type-select.tsx index 3f6a01ed7..beb7b03e3 100644 --- a/web/app/components/app/configuration/config-var/config-modal/type-select.tsx +++ b/web/app/components/app/configuration/config-var/config-modal/type-select.tsx @@ -52,13 +52,13 @@ const TypeSelector: FC = ({ >
- - {selectedItem?.name} - + > + {selectedItem?.name} +
{inputVarTypeToVarType(selectedItem?.value as InputVarType)} diff --git a/web/app/components/app/configuration/dataset-config/params-config/config-content.tsx b/web/app/components/app/configuration/dataset-config/params-config/config-content.tsx index 86025f68f..cb61b927b 100644 --- a/web/app/components/app/configuration/dataset-config/params-config/config-content.tsx +++ b/web/app/components/app/configuration/dataset-config/params-config/config-content.tsx @@ -175,7 +175,6 @@ const ConfigContent: FC = ({ ...datasetConfigs, reranking_enable: enable, }) - // eslint-disable-next-line react-hooks/exhaustive-deps }, [currentRerankModel, datasetConfigs, onChange]) return ( diff --git a/web/app/components/app/configuration/debug/chat-user-input.tsx b/web/app/components/app/configuration/debug/chat-user-input.tsx index ac07691ce..b1161de07 100644 --- a/web/app/components/app/configuration/debug/chat-user-input.tsx +++ b/web/app/components/app/configuration/debug/chat-user-input.tsx @@ -57,10 +57,10 @@ const ChatUserInput = ({ >
{type !== 'checkbox' && ( -
-
{name || key}
- {!required && {t('workflow.panel.optional')}} -
+
+
{name || key}
+ {!required && {t('workflow.panel.optional')}} +
)}
{type === 'string' && ( diff --git a/web/app/components/app/log/list.tsx b/web/app/components/app/log/list.tsx index 67b806574..b73d1f19d 100644 --- a/web/app/components/app/log/list.tsx +++ b/web/app/components/app/log/list.tsx @@ -112,72 +112,72 @@ const getFormattedChatList = (messages: ChatMessage[], conversationId: string, t const newChatList: IChatItem[] = [] try { messages.forEach((item: ChatMessage) => { - const questionFiles = item.message_files?.filter((file: any) => file.belongs_to === 'user') || [] - newChatList.push({ - id: `question-${item.id}`, - content: item.inputs.query || item.inputs.default_input || item.query, // text generation: item.inputs.query; chat: item.query - isAnswer: false, - message_files: getProcessedFilesFromResponse(questionFiles.map((item: any) => ({ ...item, related_id: item.id }))), - parentMessageId: item.parent_message_id || undefined, - }) + const questionFiles = item.message_files?.filter((file: any) => file.belongs_to === 'user') || [] + newChatList.push({ + id: `question-${item.id}`, + content: item.inputs.query || item.inputs.default_input || item.query, // text generation: item.inputs.query; chat: item.query + isAnswer: false, + message_files: getProcessedFilesFromResponse(questionFiles.map((item: any) => ({ ...item, related_id: item.id }))), + parentMessageId: item.parent_message_id || undefined, + }) - const answerFiles = item.message_files?.filter((file: any) => file.belongs_to === 'assistant') || [] - newChatList.push({ - id: item.id, - content: item.answer, - agent_thoughts: addFileInfos(item.agent_thoughts ? sortAgentSorts(item.agent_thoughts) : item.agent_thoughts, item.message_files), - feedback: item.feedbacks.find(item => item.from_source === 'user'), // user feedback - adminFeedback: item.feedbacks.find(item => item.from_source === 'admin'), // admin feedback - feedbackDisabled: false, - isAnswer: true, - message_files: getProcessedFilesFromResponse(answerFiles.map((item: any) => ({ ...item, related_id: item.id }))), - log: [ - ...item.message, - ...(item.message[item.message.length - 1]?.role !== 'assistant' - ? [ - { - role: 'assistant', - text: item.answer, - files: item.message_files?.filter((file: any) => file.belongs_to === 'assistant') || [], - }, - ] - : []), - ] as IChatItem['log'], - workflow_run_id: item.workflow_run_id, - conversationId, - input: { - inputs: item.inputs, - query: item.query, - }, - more: { - time: dayjs.unix(item.created_at).tz(timezone).format(format), - tokens: item.answer_tokens + item.message_tokens, - latency: item.provider_response_latency.toFixed(2), - }, - citation: item.metadata?.retriever_resources, - annotation: (() => { - if (item.annotation_hit_history) { - return { - id: item.annotation_hit_history.annotation_id, - authorName: item.annotation_hit_history.annotation_create_account?.name || 'N/A', - created_at: item.annotation_hit_history.created_at, + const answerFiles = item.message_files?.filter((file: any) => file.belongs_to === 'assistant') || [] + newChatList.push({ + id: item.id, + content: item.answer, + agent_thoughts: addFileInfos(item.agent_thoughts ? sortAgentSorts(item.agent_thoughts) : item.agent_thoughts, item.message_files), + feedback: item.feedbacks.find(item => item.from_source === 'user'), // user feedback + adminFeedback: item.feedbacks.find(item => item.from_source === 'admin'), // admin feedback + feedbackDisabled: false, + isAnswer: true, + message_files: getProcessedFilesFromResponse(answerFiles.map((item: any) => ({ ...item, related_id: item.id }))), + log: [ + ...item.message, + ...(item.message[item.message.length - 1]?.role !== 'assistant' + ? [ + { + role: 'assistant', + text: item.answer, + files: item.message_files?.filter((file: any) => file.belongs_to === 'assistant') || [], + }, + ] + : []), + ] as IChatItem['log'], + workflow_run_id: item.workflow_run_id, + conversationId, + input: { + inputs: item.inputs, + query: item.query, + }, + more: { + time: dayjs.unix(item.created_at).tz(timezone).format(format), + tokens: item.answer_tokens + item.message_tokens, + latency: item.provider_response_latency.toFixed(2), + }, + citation: item.metadata?.retriever_resources, + annotation: (() => { + if (item.annotation_hit_history) { + return { + id: item.annotation_hit_history.annotation_id, + authorName: item.annotation_hit_history.annotation_create_account?.name || 'N/A', + created_at: item.annotation_hit_history.created_at, + } } - } - if (item.annotation) { - return { - id: item.annotation.id, - authorName: item.annotation.account.name, - logAnnotation: item.annotation, - created_at: 0, + if (item.annotation) { + return { + id: item.annotation.id, + authorName: item.annotation.account.name, + logAnnotation: item.annotation, + created_at: 0, + } } - } - return undefined - })(), - parentMessageId: `question-${item.id}`, + return undefined + })(), + parentMessageId: `question-${item.id}`, + }) }) - }) return newChatList } @@ -503,7 +503,7 @@ function DetailPanel({ detail, onFeedback }: IDetailPanel) { setThreadChatItems(getThreadMessages(tree, newAllChatItems.at(-1)?.id)) } - catch (error) { + catch (error) { console.error(error) setHasMore(false) } @@ -522,7 +522,7 @@ function DetailPanel({ detail, onFeedback }: IDetailPanel) { if (outerDiv && outerDiv.scrollHeight > outerDiv.clientHeight) { scrollContainer = outerDiv } - else if (scrollableDiv && scrollableDiv.scrollHeight > scrollableDiv.clientHeight) { + else if (scrollableDiv && scrollableDiv.scrollHeight > scrollableDiv.clientHeight) { scrollContainer = scrollableDiv } else if (chatContainer && chatContainer.scrollHeight > chatContainer.clientHeight) { diff --git a/web/app/components/app/overview/app-card.tsx b/web/app/components/app/overview/app-card.tsx index 8713c8ef7..c6df0ebfd 100644 --- a/web/app/components/app/overview/app-card.tsx +++ b/web/app/components/app/overview/app-card.tsx @@ -167,7 +167,7 @@ function AppCard({ setAppDetail(res) setShowAccessControl(false) } - catch (error) { + catch (error) { console.error('Failed to fetch app detail:', error) } }, [appDetail, setAppDetail]) diff --git a/web/app/components/app/overview/embedded/index.tsx b/web/app/components/app/overview/embedded/index.tsx index cd25c4ca6..6eba993e1 100644 --- a/web/app/components/app/overview/embedded/index.tsx +++ b/web/app/components/app/overview/embedded/index.tsx @@ -40,12 +40,12 @@ const OPTION_MAP = { `