Skip to content

Commit 7c1b8bf

Browse files
xxl-codexingxianlu
andauthored
feat: 修改mcp工具中一直loading状态,修改文档管理器样式,修改list2json is not defined的bug以及画布调取接口改为8秒一次 (#98)
Co-authored-by: xingxianlu <xingxianlu.vendor@sensetime>
1 parent b86c6fd commit 7c1b8bf

6 files changed

Lines changed: 20 additions & 16 deletions

File tree

front/app/(appLayout)/tools/Mcp/page.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -218,6 +218,8 @@ const McpToolPageContent = () => {
218218
onFinish: (payload: any) => {
219219
if (payload && payload.flow_type === 'mcp') {
220220
message.success('同步成功')
221+
setCanProceed(true)
222+
setSyncStatus('success')
221223
try {
222224
const finishData = (payload && typeof payload.data === 'string')
223225
? payload.data

front/app/(appLayout)/tools/pageDrawer.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,8 @@ const PageDrawer = (props: any) => {
231231
onFinish: async (payload: any) => {
232232
if (payload && payload.flow_type === 'mcp') {
233233
message.success('同步成功')
234+
setCanProceed(true)
235+
setSyncStatus('success')
234236
try {
235237
const finishData = (payload && typeof payload.data === 'string')
236238
? payload.data

front/app/components/taskStream/board/asset-dashboard/components/core-asset-dash.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -169,9 +169,9 @@ const ResourcePanelBase: FC<ResourcePanelBaseProps> = ({
169169
<div
170170
ref={wrapperRef}
171171
className={`${panelContainerClasses} bg-[#fcfcfd]`}
172-
style={{ width: `${currentPanelWidth}px`}}
172+
style={{ width: `${currentPanelWidth}px` }}
173173
>
174-
<div className='canvas-panel-head sticky top-0 bg-components-panel-bg border-b-[1px] z-10'>
174+
<div className='canvas-panel-head sticky top-0 bg-white border-b-[1px] z-10'>
175175
<div className='flex items-center px-4 pt-4 pb-0.5'>
176176
{renderResourceIcon()}
177177

front/app/components/taskStream/elements/utility/panel.tsx

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import ResultPanel from '@/app/components/taskStream/driveFlow/result-panel'
1212
import Split from '@/app/components/taskStream/elements/_foundation/components/divider'
1313
import { fetchApiToolInfo, fetchToolFieldList } from '@/infrastructure/api//workflow'
1414
import { generateNameReadOnlyShape } from '@/infrastructure/api//universeNodes/universe_default_config'
15-
15+
import { list2Json } from '@/app/components/taskStream/elements/_foundation/components/form/field-item/netOps/kvPair/kvPairEdit/helpers'
1616
const baseTypeOptionsMap = {
1717
'boolean': 'bool',
1818
'array': 'list',
@@ -156,17 +156,17 @@ const Panel: FC<NodePanelProps<ToolNodeType | any>> = ({
156156
}))
157157
const newApiHeadersData = {
158158
...(newFormData.payload__headers || {}),
159-
...list2Json(formattedHeaderParams || [], 'key', 'value'),
159+
...list2Json(formattedHeaderParams || [], [{ key: 'key' }, { key: 'value' }]),
160160
}
161161
newFormData = {
162162
...newFormData,
163-
payload__params: list2Json(formattedQueryParams, 'key', 'value'),
163+
payload__params: list2Json(formattedQueryParams, [{ key: 'key' }, { key: 'value' }]),
164164
payload__params_data: formattedQueryParams.map((item: any) => ({
165165
id: uuid4(),
166166
key: item?.key,
167167
value: item?.value,
168168
})),
169-
payload__body: JSON.stringify(list2Json(formattedBodyParams, 'key', 'value'), null, 2),
169+
payload__body: JSON.stringify(list2Json(formattedBodyParams, [{ key: 'key' }, { key: 'value' }]), null, 2),
170170
payload__headers: { ...newApiHeadersData },
171171
payload__headers_data: Object.entries(newApiHeadersData || {}).map(item => ({
172172
id: uuid4(),
@@ -227,12 +227,6 @@ const Panel: FC<NodePanelProps<ToolNodeType | any>> = ({
227227
}
228228
}, [data, handleFieldChange])
229229

230-
if (isLoading) {
231-
return <div className='flex h-[200px] items-center justify-center'>
232-
<Loading />
233-
</div>
234-
}
235-
236230
// 使用 useMemo 缓存 form 对象,避免 BeforeRunForm 不必要的重新渲染
237231
const beforeRunFormConfig = useMemo(() => ({
238232
inputs: varInputs,
@@ -241,6 +235,12 @@ const Panel: FC<NodePanelProps<ToolNodeType | any>> = ({
241235
onChange: setInputVarValues,
242236
}), [varInputs, varOutputs, inputVarValues, setInputVarValues])
243237

238+
if (isLoading) {
239+
return <div className='flex h-[200px] items-center justify-center'>
240+
<Loading />
241+
</div>
242+
}
243+
244244
return (
245245
<div className='mt-0.5 pb-4'>
246246
<Form

front/app/components/taskStream/elements/utility/use-config.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ const useToolConfig = (nodeId: string, nodePayload: ToolNodeType) => {
1212

1313
const {
1414
showSingleRun,
15-
hideSingleExecution,
15+
concealSingleRun,
1616
toShapeInputs,
1717
toShapeOutputs,
1818
executionStatus,
@@ -46,8 +46,8 @@ const useToolConfig = (nodeId: string, nodePayload: ToolNodeType) => {
4646
const hideSingleExecutionAndReset = useCallback(() => {
4747
setInputVariableValues({})
4848
sessionStorage.removeItem('executionInputData')
49-
hideSingleExecution()
50-
}, [setInputVariableValues, hideSingleExecution])
49+
concealSingleRun()
50+
}, [setInputVariableValues, concealSingleRun])
5151

5252
return {
5353
readOnly: isReadOnly,

front/app/components/taskStream/store.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ export const createWorkflowStore = () => {
204204
setIsRestoring: isRestoring => set(() => ({ isRestoring })),
205205
debouncedSyncWorkflowDraft: debounce((syncWorkflowDraft) => {
206206
syncWorkflowDraft()
207-
}, 5000),
207+
}, 8000),
208208
buildInTools: [],
209209
setBuildInTools: buildInTools => set(() => ({ buildInTools })),
210210
customTools: [],

0 commit comments

Comments
 (0)