Skip to content

Commit 2540e26

Browse files
newfish-cmykc121914yuxqvvu
committed
fix debug variables (#5617)
* perf: search result (#5608) * fix: table size (#5598) * fix debug variables * fix --------- Co-authored-by: Archer <[email protected]> Co-authored-by: 伍闲犬 <[email protected]>
1 parent d1d9742 commit 2540e26

File tree

8 files changed

+41
-47
lines changed

8 files changed

+41
-47
lines changed

projects/app/src/components/core/chat/ChatContainer/ChatBox/components/VariableInputForm.tsx

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -124,19 +124,21 @@ const VariableInput = ({
124124
bg={'white'}
125125
boxShadow={'0 0 8px rgba(0,0,0,0.15)'}
126126
>
127-
<Flex
128-
color={'primary.600'}
129-
bg={'primary.100'}
130-
mb={3}
131-
px={3}
132-
py={1.5}
133-
gap={1}
134-
fontSize={'mini'}
135-
rounded={'sm'}
136-
>
137-
<MyIcon name={'common/info'} color={'primary.600'} w={4} />
138-
{t('chat:variable_invisable_in_share')}
139-
</Flex>
127+
{chatType !== ChatTypeEnum.chat && (
128+
<Flex
129+
color={'primary.600'}
130+
bg={'primary.100'}
131+
mb={3}
132+
px={3}
133+
py={1.5}
134+
gap={1}
135+
fontSize={'mini'}
136+
rounded={'sm'}
137+
>
138+
<MyIcon name={'common/info'} color={'primary.600'} w={4} />
139+
{t('chat:variable_invisable_in_share')}
140+
</Flex>
141+
)}
140142
{externalVariableList.map((item) => {
141143
return (
142144
<LabelAndFormRender

projects/app/src/components/core/chat/ChatContainer/ChatBox/components/home/ChatHomeVariablesForm.tsx

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -33,19 +33,6 @@ const ChatHomeVariablesForm = ({ chatForm }: Props) => {
3333
{/* custom variables */}
3434
{allVariableList.filter((i) => i.type === VariableInputEnum.custom).length > 0 && (
3535
<>
36-
<Flex
37-
color={'primary.600'}
38-
bg={'primary.100'}
39-
mb={3}
40-
px={3}
41-
py={1.5}
42-
gap={1}
43-
fontSize={'mini'}
44-
rounded={'sm'}
45-
>
46-
<MyIcon name={'common/info'} color={'primary.600'} w={4} />
47-
{t('chat:variable_invisable_in_share')}
48-
</Flex>
4936
{allVariableList
5037
.filter((i) => i.type === VariableInputEnum.custom)
5138
.map((item) => (

projects/app/src/components/core/chat/ChatContainer/ChatBox/index.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1126,7 +1126,8 @@ const ChatBox = ({
11261126
>
11271127
<Flex h={'100%'} flexDir={'column'} justifyContent={'center'} w={'100%'}>
11281128
{HomeChatRenderBox}
1129-
{allVariableList.length > 0 ? (
1129+
{allVariableList.filter((item) => item.type !== VariableInputEnum.internal).length >
1130+
0 ? (
11301131
<Box w={'100%'}>
11311132
<ChatHomeVariablesForm chatForm={chatForm} />
11321133
</Box>

projects/app/src/components/core/chat/ChatContainer/components/VariablePopover.tsx

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -118,19 +118,21 @@ const VariablePopover = ({ chatType }: { chatType: ChatTypeEnum }) => {
118118

119119
{externalVariableList.length > 0 && (
120120
<Box textAlign={'left'}>
121-
<Flex
122-
color={'primary.600'}
123-
bg={'primary.100'}
124-
mb={3}
125-
px={3}
126-
py={1.5}
127-
gap={1}
128-
fontSize={'mini'}
129-
rounded={'sm'}
130-
>
131-
<MyIcon name={'common/info'} color={'primary.600'} w={4} />
132-
{t('chat:variable_invisable_in_share')}
133-
</Flex>
121+
{chatType !== ChatTypeEnum.chat && (
122+
<Flex
123+
color={'primary.600'}
124+
bg={'primary.100'}
125+
mb={3}
126+
px={3}
127+
py={1.5}
128+
gap={1}
129+
fontSize={'mini'}
130+
rounded={'sm'}
131+
>
132+
<MyIcon name={'common/info'} color={'primary.600'} w={4} />
133+
{t('chat:variable_invisable_in_share')}
134+
</Flex>
135+
)}
134136
{externalVariableList.map((item) => (
135137
<LabelAndFormRender
136138
{...item}

projects/app/src/global/core/workflow/api.d.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { AppSchema } from '@fastgpt/global/core/app/type';
1+
import type { AppSchema } from '@fastgpt/global/core/app/type';
22
import type { ChatHistoryItemResType } from '@fastgpt/global/core/chat/type';
33
import type { RuntimeNodeItemType } from '@fastgpt/global/core/workflow/runtime/type';
44
import type { WorkflowInteractiveResponseType } from '@fastgpt/global/core/workflow/template/system/interactive/type';
@@ -15,6 +15,7 @@ export type PostWorkflowDebugProps = {
1515
appId: string;
1616
query?: UserChatItemValueItemType[];
1717
history?: ChatItemType[];
18+
chatConfig?: AppSchema['chatConfig'];
1819
};
1920

2021
export type PostWorkflowDebugResponse = WorkflowDebugResponse & {

projects/app/src/pageComponents/app/detail/WorkflowComponents/Flow/hooks/useDebug.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -223,14 +223,14 @@ export const useDebug = () => {
223223

224224
const onCheckRunError = useCallback((e: FieldErrors<Record<string, any>>) => {
225225
const hasRequiredNodeVar =
226-
e.nodeVariables && Object.values(e.nodeVariables).some((item) => item.type === 'required');
226+
e.nodeVariables && Object.values(e.nodeVariables).some((item) => item.type === 'validate');
227227

228228
if (hasRequiredNodeVar) {
229229
return setCurrentTab(TabEnum.node);
230230
}
231231

232232
const hasRequiredGlobalVar =
233-
e.variables && Object.values(e.variables).some((item) => item.type === 'required');
233+
e.variables && Object.values(e.variables).some((item) => item.type === 'validate');
234234

235235
if (hasRequiredGlobalVar) {
236236
setCurrentTab(TabEnum.global);

projects/app/src/pageComponents/app/detail/WorkflowComponents/context/index.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -719,7 +719,8 @@ const WorkflowContextProvider = ({
719719
},
720720
query: debugData.query, // 添加 query 参数
721721
history: debugData.history,
722-
appId
722+
appId,
723+
chatConfig: appDetail.chatConfig
723724
});
724725

725726
// 4. Store debug result

projects/app/src/pages/api/core/workflow/debug.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ import { getRunningUserInfoByTmbId } from '@fastgpt/service/support/user/team/ut
99
import type { PostWorkflowDebugProps, PostWorkflowDebugResponse } from '@/global/core/workflow/api';
1010
import { NextAPI } from '@/service/middleware/entry';
1111
import { ReadPermissionVal } from '@fastgpt/global/support/permission/constant';
12-
import { defaultApp } from '@/web/core/app/constants';
1312
import { WORKFLOW_MAX_RUN_TIMES } from '@fastgpt/service/core/workflow/constants';
1413
import { getLastInteractiveValue } from '@fastgpt/global/core/workflow/runtime/utils';
1514
import { getLocale } from '@fastgpt/service/common/middle/i18n';
@@ -25,7 +24,8 @@ async function handler(
2524
variables = {},
2625
appId,
2726
query = [],
28-
history = []
27+
history = [],
28+
chatConfig
2929
} = req.body as PostWorkflowDebugProps;
3030
if (!nodes) {
3131
return Promise.reject('Prams Error');
@@ -71,7 +71,7 @@ async function handler(
7171
lastInteractive: interactive,
7272
variables,
7373
query: query,
74-
chatConfig: defaultApp.chatConfig,
74+
chatConfig: chatConfig || app.chatConfig,
7575
histories: history,
7676
stream: false,
7777
maxRunTimes: WORKFLOW_MAX_RUN_TIMES

0 commit comments

Comments
 (0)