From f3e9010edf52c705e763cacc2d34145a76fbc0a9 Mon Sep 17 00:00:00 2001 From: heheer Date: Mon, 22 Dec 2025 11:38:57 +0800 Subject: [PATCH] fix --- .../app/detail/HTTPTools/ChatTest.tsx | 6 +- .../app/detail/Logs/DetailLogsModal.tsx | 6 +- .../app/detail/MCPTools/ChatTest.tsx | 6 +- .../app/detail/SimpleApp/ChatTest.tsx | 6 +- .../WorkflowComponents/Flow/ChatTest.tsx | 6 +- .../chat/ChatWindow/AppChatWindow.tsx | 6 +- .../chat/ChatWindow/HomeChatWindow.tsx | 6 +- .../support/outLink/playground/config.test.ts | 30 +++--- .../support/outLink/playground/update.test.ts | 74 +++++++-------- .../support/permission/auth/chat.test.ts | 94 +++++++++---------- 10 files changed, 120 insertions(+), 120 deletions(-) diff --git a/projects/app/src/pageComponents/app/detail/HTTPTools/ChatTest.tsx b/projects/app/src/pageComponents/app/detail/HTTPTools/ChatTest.tsx index bea81d828..5a3027adf 100644 --- a/projects/app/src/pageComponents/app/detail/HTTPTools/ChatTest.tsx +++ b/projects/app/src/pageComponents/app/detail/HTTPTools/ChatTest.tsx @@ -205,10 +205,10 @@ const Render = ({ return ( { return ( diff --git a/projects/app/src/pageComponents/app/detail/SimpleApp/ChatTest.tsx b/projects/app/src/pageComponents/app/detail/SimpleApp/ChatTest.tsx index 43adc198c..3898f2b6e 100644 --- a/projects/app/src/pageComponents/app/detail/SimpleApp/ChatTest.tsx +++ b/projects/app/src/pageComponents/app/detail/SimpleApp/ChatTest.tsx @@ -118,10 +118,10 @@ const Render = ({ appForm, setRenderEdit }: Props) => { return ( diff --git a/projects/app/src/pageComponents/app/detail/WorkflowComponents/Flow/ChatTest.tsx b/projects/app/src/pageComponents/app/detail/WorkflowComponents/Flow/ChatTest.tsx index a9d424bab..4c2ad4304 100644 --- a/projects/app/src/pageComponents/app/detail/WorkflowComponents/Flow/ChatTest.tsx +++ b/projects/app/src/pageComponents/app/detail/WorkflowComponents/Flow/ChatTest.tsx @@ -206,10 +206,10 @@ const Render = (Props: Props) => { return ( diff --git a/projects/app/src/pageComponents/chat/ChatWindow/AppChatWindow.tsx b/projects/app/src/pageComponents/chat/ChatWindow/AppChatWindow.tsx index 81062c0a6..55821c9bb 100644 --- a/projects/app/src/pageComponents/chat/ChatWindow/AppChatWindow.tsx +++ b/projects/app/src/pageComponents/chat/ChatWindow/AppChatWindow.tsx @@ -45,7 +45,7 @@ const AppChatWindow = ({ myApps }: Props) => { const onUpdateHistoryTitle = useContextSelector(ChatContext, (v) => v.onUpdateHistoryTitle); const isPlugin = useContextSelector(ChatItemContext, (v) => v.isPlugin); - const showNodeStatus = useContextSelector(ChatItemContext, (v) => v.showNodeStatus); + const showRunningStatus = useContextSelector(ChatItemContext, (v) => v.showRunningStatus); const onChangeChatId = useContextSelector(ChatContext, (v) => v.onChangeChatId); const chatBoxData = useContextSelector(ChatItemContext, (v) => v.chatBoxData); const datasetCiteData = useContextSelector(ChatItemContext, (v) => v.datasetCiteData); @@ -108,7 +108,7 @@ const AppChatWindow = ({ myApps }: Props) => { responseChatItemId, appId, chatId, - retainDatasetCite: showNodeStatus + retainDatasetCite: showRunningStatus }, abortCtrl: controller, onMessage: generatingMessage @@ -124,7 +124,7 @@ const AppChatWindow = ({ myApps }: Props) => { return { responseText, isNewChat: forbidLoadChat.current }; }, - [appId, chatId, onUpdateHistoryTitle, setChatBoxData, forbidLoadChat, showNodeStatus] + [appId, chatId, onUpdateHistoryTitle, setChatBoxData, forbidLoadChat, showRunningStatus] ); return ( diff --git a/projects/app/src/pageComponents/chat/ChatWindow/HomeChatWindow.tsx b/projects/app/src/pageComponents/chat/ChatWindow/HomeChatWindow.tsx index 74d2b5aa0..0fe97468f 100644 --- a/projects/app/src/pageComponents/chat/ChatWindow/HomeChatWindow.tsx +++ b/projects/app/src/pageComponents/chat/ChatWindow/HomeChatWindow.tsx @@ -84,7 +84,7 @@ const HomeChatWindow = ({ myApps }: Props) => { const datasetCiteData = useContextSelector(ChatItemContext, (v) => v.datasetCiteData); const setChatBoxData = useContextSelector(ChatItemContext, (v) => v.setChatBoxData); const resetVariables = useContextSelector(ChatItemContext, (v) => v.resetVariables); - const showNodeStatus = useContextSelector(ChatItemContext, (v) => v.showNodeStatus); + const showRunningStatus = useContextSelector(ChatItemContext, (v) => v.showRunningStatus); const pane = useContextSelector(ChatSettingContext, (v) => v.pane); const chatSettings = useContextSelector(ChatSettingContext, (v) => v.chatSettings); @@ -218,7 +218,7 @@ const HomeChatWindow = ({ myApps }: Props) => { responseChatItemId, appId, chatId, - retainDatasetCite: showNodeStatus + retainDatasetCite: showRunningStatus }, abortCtrl: controller, onMessage: generatingMessage @@ -266,7 +266,7 @@ const HomeChatWindow = ({ myApps }: Props) => { appId, appName: t('chat:home.chat_app'), chatId, - retainDatasetCite: showNodeStatus, + retainDatasetCite: showRunningStatus, ...form2AppWorkflow(formData, t) }, onMessage: generatingMessage, diff --git a/projects/app/test/pages/api/support/outLink/playground/config.test.ts b/projects/app/test/pages/api/support/outLink/playground/config.test.ts index f445fa697..a0c0d3d0d 100644 --- a/projects/app/test/pages/api/support/outLink/playground/config.test.ts +++ b/projects/app/test/pages/api/support/outLink/playground/config.test.ts @@ -48,10 +48,10 @@ describe('Playground Visibility Config API', () => { if (res.code === 200) { expect(res.error).toBeUndefined(); expect(res.data).toEqual({ - showNodeStatus: true, - responseDetail: true, + showRunningStatus: true, + showQuote: true, showFullText: true, - showRawSource: true + canDownloadSource: true }); } else { // If there are permission issues, we still expect the API to validate parameters @@ -69,10 +69,10 @@ describe('Playground Visibility Config API', () => { appId: testApp._id, name: 'Playground Chat', type: PublishChannelEnum.playground, - showNodeStatus: false, - responseDetail: false, + showRunningStatus: false, + showQuote: false, showFullText: false, - showRawSource: false, + canDownloadSource: false, usagePoints: 0, lastTime: new Date() }); @@ -88,10 +88,10 @@ describe('Playground Visibility Config API', () => { if (res.code === 200) { expect(res.error).toBeUndefined(); expect(res.data).toEqual({ - showNodeStatus: false, - responseDetail: false, + showRunningStatus: false, + showQuote: false, showFullText: false, - showRawSource: false + canDownloadSource: false }); } else { // If there are permission issues, we still expect the API to validate parameters @@ -131,10 +131,10 @@ describe('Playground Visibility Config API', () => { appId: testApp._id, name: 'Playground Chat', type: PublishChannelEnum.playground, - showNodeStatus: true, - responseDetail: false, + showRunningStatus: true, + showQuote: false, showFullText: true, - showRawSource: false, + canDownloadSource: false, usagePoints: 0, lastTime: new Date() }); @@ -150,10 +150,10 @@ describe('Playground Visibility Config API', () => { if (res.code === 200) { expect(res.error).toBeUndefined(); expect(res.data).toEqual({ - showNodeStatus: true, - responseDetail: false, + showRunningStatus: true, + showQuote: false, showFullText: true, - showRawSource: false + canDownloadSource: false }); } else { // If there are permission issues, we still expect the API to validate parameters diff --git a/projects/app/test/pages/api/support/outLink/playground/update.test.ts b/projects/app/test/pages/api/support/outLink/playground/update.test.ts index 0cc9945aa..66a73b734 100644 --- a/projects/app/test/pages/api/support/outLink/playground/update.test.ts +++ b/projects/app/test/pages/api/support/outLink/playground/update.test.ts @@ -39,10 +39,10 @@ describe('Playground Visibility Update API', () => { it('should handle update request with valid data', async () => { const updateData: UpdatePlaygroundVisibilityConfigBody = { appId: testApp._id, - showNodeStatus: false, - responseDetail: false, + showRunningStatus: false, + showQuote: false, showFullText: false, - showRawSource: false + canDownloadSource: false }; const res = await Call(updateApi.default, { @@ -63,10 +63,10 @@ describe('Playground Visibility Update API', () => { if (createdConfig) { expect(createdConfig.appId).toBe(testApp._id); expect(createdConfig.type).toBe(PublishChannelEnum.playground); - expect(createdConfig.showNodeStatus).toBe(false); - expect(createdConfig.responseDetail).toBe(false); + expect(createdConfig.showRunningStatus).toBe(false); + expect(createdConfig.showQuote).toBe(false); expect(createdConfig.showFullText).toBe(false); - expect(createdConfig.showRawSource).toBe(false); + expect(createdConfig.canDownloadSource).toBe(false); } } else { // If there are permission issues, we still expect the API to validate parameters @@ -78,10 +78,10 @@ describe('Playground Visibility Update API', () => { it('should handle update request with true values', async () => { const updateData: UpdatePlaygroundVisibilityConfigBody = { appId: testApp._id, - showNodeStatus: true, - responseDetail: true, + showRunningStatus: true, + showQuote: true, showFullText: true, - showRawSource: true + canDownloadSource: true }; const res = await Call(updateApi.default, { @@ -100,10 +100,10 @@ describe('Playground Visibility Update API', () => { }).lean(); if (createdConfig) { - expect(createdConfig.showNodeStatus).toBe(true); - expect(createdConfig.responseDetail).toBe(true); + expect(createdConfig.showRunningStatus).toBe(true); + expect(createdConfig.showQuote).toBe(true); expect(createdConfig.showFullText).toBe(true); - expect(createdConfig.showRawSource).toBe(true); + expect(createdConfig.canDownloadSource).toBe(true); } } else { // If there are permission issues, we still expect the API to validate parameters @@ -115,10 +115,10 @@ describe('Playground Visibility Update API', () => { it('should handle update request with mixed boolean values', async () => { const updateData: UpdatePlaygroundVisibilityConfigBody = { appId: testApp._id, - showNodeStatus: false, - responseDetail: true, + showRunningStatus: false, + showQuote: true, showFullText: false, - showRawSource: true + canDownloadSource: true }; const res = await Call(updateApi.default, { @@ -137,10 +137,10 @@ describe('Playground Visibility Update API', () => { }).lean(); if (createdConfig) { - expect(createdConfig.showNodeStatus).toBe(false); - expect(createdConfig.responseDetail).toBe(true); + expect(createdConfig.showRunningStatus).toBe(false); + expect(createdConfig.showQuote).toBe(true); expect(createdConfig.showFullText).toBe(false); - expect(createdConfig.showRawSource).toBe(true); + expect(createdConfig.canDownloadSource).toBe(true); } } else { // If there are permission issues, we still expect the API to validate parameters @@ -151,7 +151,7 @@ describe('Playground Visibility Update API', () => { it('should return 500 when appId is missing', async () => { const updateData = { - showNodeStatus: false + showRunningStatus: false }; const res = await Call(updateApi.default, { @@ -166,10 +166,10 @@ describe('Playground Visibility Update API', () => { it('should return 500 when appId is empty string', async () => { const updateData: UpdatePlaygroundVisibilityConfigBody = { appId: '', - showNodeStatus: false, - responseDetail: false, + showRunningStatus: false, + showQuote: false, showFullText: false, - showRawSource: false + canDownloadSource: false }; const res = await Call(updateApi.default, { @@ -184,10 +184,10 @@ describe('Playground Visibility Update API', () => { it('should return error when user is not authenticated', async () => { const updateData: UpdatePlaygroundVisibilityConfigBody = { appId: testApp._id, - showNodeStatus: false, - responseDetail: false, + showRunningStatus: false, + showQuote: false, showFullText: false, - showRawSource: false + canDownloadSource: false }; const res = await Call(updateApi.default, { @@ -202,7 +202,7 @@ describe('Playground Visibility Update API', () => { // Test with missing boolean fields (should fail validation) const updateData = { appId: testApp._id, - showNodeStatus: false + showRunningStatus: false // Missing other boolean fields }; @@ -232,10 +232,10 @@ describe('Playground Visibility Update API', () => { appId: testApp._id, name: 'Playground Chat', type: PublishChannelEnum.playground, - showNodeStatus: true, - responseDetail: true, + showRunningStatus: true, + showQuote: true, showFullText: true, - showRawSource: true, + canDownloadSource: true, usagePoints: 0, lastTime: new Date() }); @@ -243,10 +243,10 @@ describe('Playground Visibility Update API', () => { // Update config for second app const updateData: UpdatePlaygroundVisibilityConfigBody = { appId: testApp2._id, - showNodeStatus: false, - responseDetail: false, + showRunningStatus: false, + showQuote: false, showFullText: true, - showRawSource: true + canDownloadSource: true }; const res = await Call(updateApi.default, { @@ -265,8 +265,8 @@ describe('Playground Visibility Update API', () => { }).lean(); if (config1) { - expect(config1.showNodeStatus).toBe(true); - expect(config1.responseDetail).toBe(true); + expect(config1.showRunningStatus).toBe(true); + expect(config1.showQuote).toBe(true); } // Verify second app config was created with new values @@ -276,10 +276,10 @@ describe('Playground Visibility Update API', () => { }).lean(); if (config2) { - expect(config2.showNodeStatus).toBe(false); - expect(config2.responseDetail).toBe(false); + expect(config2.showRunningStatus).toBe(false); + expect(config2.showQuote).toBe(false); expect(config2.showFullText).toBe(true); - expect(config2.showRawSource).toBe(true); + expect(config2.canDownloadSource).toBe(true); } } else { // If there are permission issues, we still expect the API to validate parameters diff --git a/projects/app/test/service/support/permission/auth/chat.test.ts b/projects/app/test/service/support/permission/auth/chat.test.ts index d637bcba5..5615f4540 100644 --- a/projects/app/test/service/support/permission/auth/chat.test.ts +++ b/projects/app/test/service/support/permission/auth/chat.test.ts @@ -80,10 +80,10 @@ describe('authChatCrud', () => { teamId: 'team1', tmbId: 'tmb1', uid: 'user1', - responseDetail: true, - showNodeStatus: true, + showQuote: true, + showRunningStatus: true, showFullText: true, - showRawSource: true, + canDownloadSource: true, authType: AuthUserTypeEnum.teamDomain }); }); @@ -117,10 +117,10 @@ describe('authChatCrud', () => { tmbId: 'tmb1', uid: 'user1', chat: mockChat, - responseDetail: true, - showNodeStatus: true, + showQuote: true, + showRunningStatus: true, showFullText: true, - showRawSource: true, + canDownloadSource: true, authType: AuthUserTypeEnum.teamDomain }); }); @@ -147,10 +147,10 @@ describe('authChatCrud', () => { teamId: 'team1', tmbId: 'tmb1', uid: 'user1', - responseDetail: true, - showNodeStatus: true, + showQuote: true, + showRunningStatus: true, showFullText: true, - showRawSource: true, + canDownloadSource: true, authType: AuthUserTypeEnum.teamDomain }); }); @@ -189,9 +189,9 @@ describe('authChatCrud', () => { outLinkConfig: { teamId: 'team1', tmbId: 'tmb1', - responseDetail: true, - showNodeStatus: true, - showRawSource: true + showQuote: true, + showRunningStatus: true, + canDownloadSource: true }, uid: 'user1', appId: 'app1' @@ -209,20 +209,20 @@ describe('authChatCrud', () => { teamId: 'team1', tmbId: 'tmb1', uid: 'user1', - responseDetail: true, - showNodeStatus: true, + showQuote: true, + showRunningStatus: true, showFullText: false, - showRawSource: true, + canDownloadSource: true, authType: AuthUserTypeEnum.outLink }); }); - it('should auth outLink with default showNodeStatus and showRawSource', async () => { + it('should auth outLink with default showRunningStatus and canDownloadSource', async () => { vi.mocked(authOutLink).mockResolvedValue({ outLinkConfig: { teamId: 'team1', tmbId: 'tmb1', - responseDetail: false, + showQuote: false, shareId: 'share1', outLinkUid: 'user1' }, @@ -242,9 +242,9 @@ describe('authChatCrud', () => { teamId: 'team1', tmbId: 'tmb1', uid: 'user1', - responseDetail: false, - showNodeStatus: true, // default - showRawSource: false, // default + showQuote: false, + showRunningStatus: true, // default + canDownloadSource: false, // default authType: AuthUserTypeEnum.outLink }); }); @@ -259,9 +259,9 @@ describe('authChatCrud', () => { outLinkConfig: { teamId: 'team1', tmbId: 'tmb1', - responseDetail: true, - showNodeStatus: true, - showRawSource: true + showQuote: true, + showRunningStatus: true, + canDownloadSource: true }, uid: 'user1', appId: 'app1' @@ -285,10 +285,10 @@ describe('authChatCrud', () => { tmbId: 'tmb1', uid: 'user1', chat: mockChat, - responseDetail: true, - showNodeStatus: true, + showQuote: true, + showRunningStatus: true, showFullText: false, - showRawSource: true, + canDownloadSource: true, authType: AuthUserTypeEnum.outLink }); }); @@ -298,9 +298,9 @@ describe('authChatCrud', () => { outLinkConfig: { teamId: 'team1', tmbId: 'tmb1', - responseDetail: true, - showNodeStatus: false, - showRawSource: true + showQuote: true, + showRunningStatus: false, + canDownloadSource: true }, uid: 'user1', appId: 'app1' @@ -323,10 +323,10 @@ describe('authChatCrud', () => { teamId: 'team1', tmbId: 'tmb1', uid: 'user1', - responseDetail: true, - showNodeStatus: false, + showQuote: true, + showRunningStatus: false, showFullText: false, - showRawSource: true, + canDownloadSource: true, authType: AuthUserTypeEnum.outLink }); }); @@ -341,10 +341,10 @@ describe('authChatCrud', () => { outLinkConfig: { teamId: 'team1', tmbId: 'tmb1', - responseDetail: true, + showQuote: true, showFullText: true, - showNodeStatus: true, - showRawSource: true + showRunningStatus: true, + canDownloadSource: true }, uid: 'user1', appId: 'app1' @@ -437,10 +437,10 @@ describe('authChatCrud', () => { teamId: 'team1', tmbId: 'tmb1', uid: 'tmb1', - responseDetail: true, - showNodeStatus: true, + showQuote: true, + showRunningStatus: true, showFullText: true, - showRawSource: true, + canDownloadSource: true, authType: AuthUserTypeEnum.teamDomain }); }); @@ -477,10 +477,10 @@ describe('authChatCrud', () => { tmbId: 'tmb1', uid: 'tmb1', chat: mockChat, - responseDetail: true, - showNodeStatus: true, + showQuote: true, + showRunningStatus: true, showFullText: true, - showRawSource: true, + canDownloadSource: true, authType: AuthUserTypeEnum.teamDomain }); }); @@ -518,10 +518,10 @@ describe('authChatCrud', () => { tmbId: 'tmb1', uid: 'tmb1', chat: mockChat, - responseDetail: true, - showNodeStatus: true, + showQuote: true, + showRunningStatus: true, showFullText: true, - showRawSource: true, + canDownloadSource: true, authType: AuthUserTypeEnum.teamDomain }); }); @@ -551,10 +551,10 @@ describe('authChatCrud', () => { teamId: 'team1', tmbId: 'tmb1', uid: 'tmb1', - responseDetail: true, - showNodeStatus: true, + showQuote: true, + showRunningStatus: true, showFullText: true, - showRawSource: true, + canDownloadSource: true, authType: AuthUserTypeEnum.teamDomain }); });