Skip to content

Commit 92237e4

Browse files
perf: Execution record
1 parent 3a7818d commit 92237e4

File tree

6 files changed

+106
-32
lines changed

6 files changed

+106
-32
lines changed

ui/src/locales/lang/en-US/ai-chat.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ export default {
8989
},
9090
executionDetails: {
9191
title: 'Execution Details',
92+
createTime: 'Execution Time',
9293
paramOutputTooltip: 'Each document supports previewing up to 500 characters',
9394
audioFile: 'Audio File',
9495
searchContent: 'Search Query',

ui/src/locales/lang/zh-CN/ai-chat.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ export default {
8787
},
8888
executionDetails: {
8989
title: '执行详情',
90+
createTime: '执行时间',
9091
paramOutputTooltip: '每个文档仅支持预览500字',
9192
audioFile: '语音文件',
9293
searchContent: '检索内容',

ui/src/locales/lang/zh-Hant/ai-chat.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ export default {
8787
},
8888
executionDetails: {
8989
title: '執行詳細',
90+
createTime: '執行時間',
9091
paramOutputTooltip: '每個文件僅支持預覽 500 字',
9192
audioFile: '語音文件',
9293
searchContent: '檢索內容',

ui/src/views/knowledge-workflow/component/action/Result.vue

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<h4 class="title-decoration-1 mb-16 mt-4">
44
{{ $t('chat.executionDetails.title') }}
55
</h4>
6-
<div class="mb-16">
6+
<div class="mb-16" v-if="!isRecord">
77
<!-- 执行结果 -->
88
<el-alert
99
v-if="state == 'SUCCESS'"
@@ -25,13 +25,12 @@
2525
</template>
2626
<script setup lang="ts">
2727
import { onUnmounted, ref, computed } from 'vue'
28-
import knowledgeApi from '@/api/knowledge/knowledge'
29-
const props = defineProps<{ id: string; knowledge_id: string }>()
28+
3029
import ExecutionDetailContent from '@/components/ai-chat/component/knowledge-source-component/ExecutionDetailContent.vue'
31-
import { useRoute } from "vue-router";
32-
import { loadSharedApi } from "@/utils/dynamics-api/shared-api.ts";
30+
import { useRoute } from 'vue-router'
31+
import { loadSharedApi } from '@/utils/dynamics-api/shared-api.ts'
3332
const route = useRoute()
34-
33+
const props = defineProps<{ id: string; knowledge_id: string; isRecord: boolean }>()
3534
const detail = computed(() => {
3635
if (knowledge_action.value) {
3736
return Object.values(knowledge_action.value.details)
@@ -60,7 +59,7 @@ const getKnowledgeWorkflowAction = () => {
6059
if (pollingTimer == null) {
6160
return
6261
}
63-
loadSharedApi({type: 'knowledge', systemType: apiType.value})
62+
loadSharedApi({ type: 'knowledge', systemType: apiType.value })
6463
.getWorkflowAction(props.knowledge_id, props.id)
6564
.then((ok: any) => {
6665
knowledge_action.value = ok.data

ui/src/views/knowledge-workflow/component/execution-record/ExecutionDetailDrawer.vue

Lines changed: 66 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,63 @@
11
<template>
2-
<el-drawer v-model="visible" size="60%" @close="closeHandle">
2+
<el-drawer
3+
v-model="visible"
4+
size="800px"
5+
:modal="false"
6+
destroy-on-close
7+
:before-close="closeHandle"
8+
:close-on-click-modal="false"
9+
:close-on-press-escape="false"
10+
:show-close="false"
11+
>
312
<template #header>
4-
<h4>{{ $t('views.problem.detailProblem') }}</h4>
13+
<div class="flex align-center" style="margin-left: -8px">
14+
<el-button class="cursor mr-4" link @click.prevent="visible = false">
15+
<el-icon :size="20">
16+
<Back />
17+
</el-icon>
18+
</el-button>
19+
<h4>{{ $t('chat.executionDetails.title') }}</h4>
20+
</div>
521
</template>
622
<div>
723
<el-scrollbar>
8-
<!-- <Result v-model:loading="loading" :knowledge_id="id" :id="action_id" /> -->
24+
<h4 class="title-decoration-1 mb-16 mt-4">
25+
{{ $t('workflow.ExecutionRecord') }}
26+
</h4>
27+
<el-card class="mb-24" shadow="never" style="--el-card-padding: 12px 16px">
28+
<el-row :gutter="16" class="lighter">
29+
<el-col :span="6">
30+
<p class="color-secondary mb-4">{{ $t('workflow.initiator') }}</p>
31+
<p>{{ detail?.meta.user_name || '-' }}</p>
32+
</el-col>
33+
<el-col :span="6">
34+
<p class="color-secondary mb-4">{{ $t('common.status.label') }}</p>
35+
<p>
36+
<el-text class="color-text-primary" v-if="detail?.state === 'SUCCESS'">
37+
<el-icon class="color-success"><SuccessFilled /></el-icon>
38+
{{ $t('common.status.success') }}
39+
</el-text>
40+
<el-text class="color-text-primary" v-else-if="detail?.state === 'FAILURE'">
41+
<el-icon class="color-danger"><CircleCloseFilled /></el-icon>
42+
{{ $t('common.status.fail') }}
43+
</el-text>
44+
<el-text class="color-text-primary" v-else>
45+
<el-icon class="is-loading color-primary"><Loading /></el-icon>
46+
{{ $t('common.status.padding') }}
47+
</el-text>
48+
</p>
49+
</el-col>
50+
<el-col :span="6">
51+
<p class="color-secondary mb-4">{{ $t('chat.KnowledgeSource.consumeTime') }}</p>
52+
<p>{{ detail?.run_time != undefined ? detail?.run_time + 's' : '-' }}</p>
53+
</el-col>
54+
<el-col :span="6">
55+
<p class="color-secondary mb-4">{{ $t('chat.executionDetails.createTime') }}</p>
56+
<p>{{ datetimeFormat(detail?.create_time) }}</p>
57+
</el-col>
58+
</el-row>
59+
</el-card>
60+
<Result :knowledge_id="knowledge_id" :id="action_id" is-record />
961
</el-scrollbar>
1062
</div>
1163
<template #footer>
@@ -25,9 +77,7 @@
2577
import { ref, reactive, computed, watch } from 'vue'
2678
import { useRoute } from 'vue-router'
2779
import Result from '@/views/knowledge-workflow/component/action/Result.vue'
28-
import { MsgSuccess, MsgConfirm, MsgError } from '@/utils/message'
29-
import { loadSharedApi } from '@/utils/dynamics-api/shared-api'
30-
import permissionMap from '@/permission'
80+
import { datetimeFormat } from '@/utils/time'
3181
import { t } from '@/locales'
3282
const props = withDefaults(
3383
defineProps<{
@@ -55,9 +105,6 @@ const props = withDefaults(
55105
const emit = defineEmits(['update:currentId', 'update:currentContent', 'refresh'])
56106
57107
const route = useRoute()
58-
const {
59-
params: { id },
60-
} = route
61108
62109
const apiType = computed(() => {
63110
if (route.path.includes('shared')) {
@@ -72,9 +119,13 @@ const apiType = computed(() => {
72119
const loading = ref(false)
73120
const visible = ref(false)
74121
const action_id = ref<string>('')
122+
const knowledge_id = ref<string>('')
123+
const detail = ref<any>(null)
75124
76125
function closeHandle() {
77126
action_id.value = ''
127+
knowledge_id.value = ''
128+
detail.value = null
78129
}
79130
80131
function getRecord() {
@@ -86,6 +137,8 @@ watch(
86137
() => props.currentId,
87138
() => {
88139
action_id.value = ''
140+
knowledge_id.value = ''
141+
detail.value = null
89142
},
90143
)
91144
@@ -97,8 +150,10 @@ watch(visible, (bool) => {
97150
}
98151
})
99152
100-
const open = (id: string) => {
101-
action_id.value = id
153+
const open = (row: any) => {
154+
action_id.value = row.id
155+
knowledge_id.value = row.knowledge_id
156+
detail.value = row
102157
visible.value = true
103158
}
104159

ui/src/views/knowledge-workflow/component/execution-record/ExecutionRecordDrawer.vue

Lines changed: 31 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -15,22 +15,21 @@
1515
style="width: 120px"
1616
>
1717
<el-option :label="$t('workflow.initiator')" value="user_name" />
18+
<el-option :label="$t('common.status.label')" value="state" />
1819
</el-select>
19-
<!-- <el-select
20-
v-if="filter_type === 'status'"
21-
v-model="filter_status"
22-
@change="changeStatusHandle"
20+
<el-select
21+
v-if="filter_type === 'state'"
22+
v-model="query.status"
23+
@change="getList"
2324
style="width: 220px"
2425
clearable
2526
>
26-
<el-option
27-
v-for="item in statusOptions"
28-
:key="item.value"
29-
:label="item.label"
30-
:value="item.value"
31-
/>
32-
</el-select> -->
27+
<el-option :label="$t('common.status.success')" value="SUCCESS" />
28+
<el-option :label="$t('common.status.fail')" value="FAILURE" />
29+
<el-option :label="$t('common.status.padding')" value="PADDING" />
30+
</el-select>
3331
<el-input
32+
v-else
3433
v-model="query.user_name"
3534
@change="getList"
3635
:placeholder="$t('common.search')"
@@ -75,6 +74,16 @@
7574
{{ row.run_time != undefined ? row.run_time + 's' : '-' }}
7675
</template>
7776
</el-table-column>
77+
<el-table-column
78+
prop="create_time"
79+
:label="$t('chat.executionDetails.createTime')"
80+
width="180"
81+
>
82+
<template #default="{ row }">
83+
{{ datetimeFormat(row.create_time) }}
84+
</template>
85+
</el-table-column>
86+
7887
<el-table-column :label="$t('common.operation')" width="80">
7988
<template #default="{ row }">
8089
<el-tooltip effect="dark" :content="$t('chat.executionDetails.title')" placement="top">
@@ -85,16 +94,18 @@
8594
</template>
8695
</el-table-column>
8796
</app-table-infinite-scroll>
97+
<ExecutionDetailDrawer ref="ExecutionDetailDrawerRef" />
8898
</el-drawer>
8999
</template>
90100
<script setup lang="ts">
91101
import { loadSharedApi } from '@/utils/dynamics-api/shared-api'
92102
import AppTableInfiniteScroll from '@/components/app-table-infinite-scroll/index.vue'
103+
import ExecutionDetailDrawer from './ExecutionDetailDrawer.vue'
93104
import { computed, ref, reactive } from 'vue'
94105
import { useRoute, useRouter } from 'vue-router'
106+
import { datetimeFormat } from '@/utils/time'
95107
const drawer = ref<boolean>(false)
96108
const route = useRoute()
97-
const toDetails = (row: any) => {}
98109
99110
const apiType = computed(() => {
100111
if (route.path.includes('shared')) {
@@ -112,17 +123,23 @@ const paginationConfig = reactive({
112123
})
113124
const query = ref<any>({
114125
user_name: '',
126+
status: '',
115127
})
116128
const loading = ref(false)
117129
const filter_type = ref<string>('user_name')
118130
const active_knowledge_id = ref<string>('')
119131
const data = ref<Array<any>>([])
132+
const ExecutionDetailDrawerRef = ref<any>()
133+
134+
const toDetails = (row: any) => {
135+
ExecutionDetailDrawerRef.value.open(row)
136+
}
137+
120138
const changeFilterHandle = () => {
121-
query.value = { user_name: '' }
139+
query.value = { user_name: '', status: '' }
122140
}
123141
const changePage = () => {
124142
paginationConfig.current_page += 1
125-
console.log(paginationConfig.current_page)
126143
getList()
127144
}
128145

0 commit comments

Comments
 (0)