Skip to content

Commit 36c17eb

Browse files
fix: debug uuid
1 parent b470f6d commit 36c17eb

3 files changed

Lines changed: 30 additions & 23 deletions

File tree

‎ui/src/conversation-panel/components/content/items/tool/Terminal.vue‎

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,8 @@
22
<!-- 展开或收起终端输出 -->
33
<MkCollapse
44
class="w-full"
5-
:expanded="expanded"
5+
v-model:expanded="expanded"
66
trigger-class="group w-fit max-w-full overflow-hidden py-[3px] text-N500 hover:text-N900 transition-colors"
7-
@update:expanded="$emit('toggle')"
87
>
98
<template #indicator="{ expanded }">
109
<svg class="tc-chevron" :class="{ open: expanded }" viewBox="0 0 16 16" fill="none">
@@ -33,11 +32,14 @@
3332

3433
<script setup lang="ts">
3534
import { computed, ref, watch } from 'vue'
35+
import type { ChatContent } from '@/api/types'
3636
import Loading from '@/conversation-panel/loading/index.vue'
3737
import { extractPartialJsonField } from './extract-partial-json'
3838
39-
const props = defineProps<{ content: any; loading: boolean; expanded: boolean }>()
40-
defineEmits<{ toggle: [] }>()
39+
defineOptions({ name: 'ConversationTerminalContent' })
40+
41+
const props = defineProps<{ content: ChatContent; loading: boolean }>()
42+
const expanded = defineModel<boolean>('expanded', { required: true })
4143
4244
const commandText = computed(() => {
4345
const raw = props.content.arguments
@@ -48,7 +50,7 @@ const commandText = computed(() => {
4850
// 展开后定位到终端输出底部。
4951
const terminalBlock = ref<HTMLElement>()
5052
watch(
51-
() => props.expanded,
53+
expanded,
5254
(expanded) => {
5355
if (expanded && terminalBlock.value) {
5456
terminalBlock.value.scrollTop = terminalBlock.value.scrollHeight
Lines changed: 21 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,6 @@
1-
<template>
2-
<component
3-
v-if="toolRenderers[toolName]"
4-
:is="toolRenderers[toolName]"
5-
:content="content"
6-
:loading="loading"
7-
:expanded="isExpanded"
8-
@toggle="isExpanded = !isExpanded"
9-
/>
10-
<DefaultTool v-else :content="content" />
11-
</template>
12-
131
<script setup lang="ts">
14-
import { computed, ref, watch } from 'vue'
2+
import { computed, ref, watch, type Component } from 'vue'
3+
import type { ChatContent, Dict } from '@/api/types'
154
import Terminal from './Terminal.vue'
165
import Patch from './Patch.vue'
176
import ReadFile from './ReadFile.vue'
@@ -24,19 +13,21 @@ import DownloadSkills from './DownloadSkills.vue'
2413
import RunSkill from './RunSkill.vue'
2514
import DefaultTool from './tool.vue'
2615
27-
/** TOOL 内容项按工具名分发到专用渲染器,未匹配的工具沿用原有 tool.vue 展示。 */
28-
const props = defineProps<{ content: any }>()
16+
defineOptions({ name: 'ConversationToolContent' })
17+
18+
const props = defineProps<{ content: ChatContent }>()
2919
20+
// 工具执行状态与展开状态。
3021
const loading = computed(() => props.content.status === 'RUNNING')
31-
const toolName = computed(() => (props.content.name || '').toLowerCase())
3222
const isExpanded = ref(props.content.status === 'RUNNING')
3323
3424
// 工具执行完成自动收起
3525
watch(loading, (current, previous) => {
3626
if (previous && !current) isExpanded.value = false
3727
})
3828
39-
const toolRenderers: Record<string, any> = {
29+
// 按工具名选择渲染组件,未匹配时使用默认展示。
30+
const toolRenderers: Dict<Component> = {
4031
run_command: Terminal,
4132
apply_patch: Patch,
4233
read_file: ReadFile,
@@ -48,4 +39,17 @@ const toolRenderers: Record<string, any> = {
4839
download_skills: DownloadSkills,
4940
run_skill: RunSkill,
5041
}
42+
const toolRenderer = computed(() => toolRenderers[(props.content.name || '').toLowerCase()])
5143
</script>
44+
45+
<template>
46+
<component
47+
v-if="toolRenderer"
48+
:is="toolRenderer"
49+
:content="content"
50+
:loading="loading"
51+
v-model:expanded="isExpanded"
52+
@toggle="isExpanded = !isExpanded"
53+
/>
54+
<DefaultTool v-else :content="content" />
55+
</template>

‎ui/src/views/workflow/tool/debug/ResultDrawer.vue‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
<script setup lang="ts">
22
import { computed, onBeforeUnmount, provide, ref } from 'vue'
33
import { cloneDeep } from 'lodash'
4+
import { v4 as uuidv4 } from 'uuid'
45
import WorkflowApi from '@/api/admin/workspace/tool/workflow'
56
import type { ToolExecutionRecordDetail } from '@/api/types'
67
import { MsgError } from '@/utils/message'
@@ -100,7 +101,7 @@ function open(parameters: Record<string, unknown>) {
100101
blocks.value = []
101102
record.value = undefined
102103
inputParameters = cloneDeep(parameters)
103-
recordId = crypto.randomUUID()
104+
recordId = uuidv4()
104105
activeTab.value = 'output'
105106
visible.value = true
106107
return execute()

0 commit comments

Comments
 (0)