Skip to content

Commit adb04a3

Browse files
committed
fix: Unable to clear the last call result after the tool workflow call returns
1 parent 3f9049a commit adb04a3

File tree

2 files changed

+15
-7
lines changed

2 files changed

+15
-7
lines changed

ui/src/views/tool-workflow/debug-drawer/DebugDrawer.vue

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@
6363
<el-button @click="close">{{ $t('common.cancel') }}</el-button>
6464
<el-button type="primary" @click="run"> {{ $t('views.tool.form.debug.run') }}</el-button>
6565
</template>
66-
<ResultDrawer ref="ToolResultDrawerRef" />
66+
<ResultDrawer @close="closeResult" :key="index" ref="ToolResultDrawerRef" />
6767
</el-drawer>
6868
</template>
6969
<script setup lang="ts">
@@ -73,7 +73,8 @@ import { loadSharedApi } from '@/utils/dynamics-api/shared-api'
7373
import JsonInput from '@/components/dynamics-form/items/JsonInput.vue'
7474
import { type FormInstance } from 'element-plus'
7575
import ResultDrawer from './ResultDrawer.vue'
76-
76+
import { number } from 'echarts'
77+
const index = ref<number>(0)
7778
const route = useRoute()
7879
const {
7980
params: { folderId },
@@ -103,7 +104,9 @@ const userInputFieldList = computed(() => {
103104
?.properties?.user_input_field_list || []
104105
)
105106
})
106-
107+
const closeResult = () => {
108+
index.value++
109+
}
107110
function getDetail(toolId: string) {
108111
loadSharedApi({ type: 'tool', isShared: isShared.value, systemType: apiType.value })
109112
.getToolById(toolId)
@@ -117,10 +120,14 @@ const userInputForm = ref<any>({})
117120
const ToolResultDrawerRef = ref()
118121
119122
const run = () => {
120-
formRef.value?.validate((valid: boolean) => {
121-
if (!valid) return
123+
if (userInputFieldList.value.length === 0) {
122124
ToolResultDrawerRef.value?.open(toolDetail.value.id, userInputForm.value)
123-
})
125+
} else {
126+
formRef.value?.validate((valid: boolean) => {
127+
if (!valid) return
128+
ToolResultDrawerRef.value?.open(toolDetail.value.id, userInputForm.value)
129+
})
130+
}
124131
}
125132
126133
const drawer = ref<boolean>(false)

ui/src/views/tool-workflow/debug-drawer/ResultDrawer.vue

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ const details = {
129129
const activeName = ref<string>('result')
130130
const currentToolId = ref<string>()
131131
const currentData = ref<any>({})
132-
132+
const emit = defineEmits(['close'])
133133
const output = computed(() => {
134134
if (toolRecord.value) {
135135
return toolRecord.value.meta.output
@@ -246,6 +246,7 @@ const open = (toolId: string, data: any) => {
246246
}
247247
const close = () => {
248248
ChatManagement.close(currentChat.id)
249+
emit('close')
249250
resultDrawer.value = false
250251
toolRecord.value = null
251252
currentChat.value = {

0 commit comments

Comments
 (0)