-
Notifications
You must be signed in to change notification settings - Fork 693
Expand file tree
/
Copy pathExecutionDetails.vue
More file actions
176 lines (159 loc) · 4.16 KB
/
ExecutionDetails.vue
File metadata and controls
176 lines (159 loc) · 4.16 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
<script lang="ts" setup>
import { ref, onMounted, onUnmounted } from 'vue'
import gou_icon from '@/assets/svg/gou_icon.svg'
import icon_error from '@/assets/svg/icon_error.svg'
import icon_database_colorful from '@/assets/svg/icon_database_colorful.svg'
import icon_alarm_clock_colorful from '@/assets/svg/icon_alarm-clock_colorful.svg'
import { chatApi, type ChatLogHistory } from '@/api/chat.ts'
import { useI18n } from 'vue-i18n'
import { debounce } from 'lodash-es'
const { t } = useI18n()
const logHistory = ref<ChatLogHistory>({})
const dialogFormVisible = ref(false)
const drawerSize = ref('600px')
function getLogList(recordId: any) {
setDrawerSize()
chatApi.get_chart_log_history(recordId).then((res) => {
logHistory.value = chatApi.toChatLogHistory(res) as ChatLogHistory
dialogFormVisible.value = true
})
}
const setDrawerSize = debounce(() => {
drawerSize.value = window.innerWidth < 500 ? '460px' : '600px'
}, 500)
onMounted(() => {
window.addEventListener('resize', setDrawerSize)
})
onUnmounted(() => {
window.removeEventListener('resize', setDrawerSize)
})
defineExpose({
getLogList,
})
</script>
<template>
<el-drawer
v-model="dialogFormVisible"
:title="t('parameter.execution_details')"
destroy-on-close
modal-class="execution-details"
:size="drawerSize"
>
<div class="title">{{ t('parameter.overview') }}</div>
<div class="overview">
<div class="item">
<el-icon size="40">
<icon_database_colorful></icon_database_colorful>
</el-icon>
<div class="name">{{ t('parameter.tokens_required') }}</div>
<div class="value">{{ logHistory.total_tokens }}</div>
</div>
<div class="item">
<el-icon size="40">
<icon_alarm_clock_colorful></icon_alarm_clock_colorful>
</el-icon>
<div class="name">{{ t('parameter.time_execution') }}</div>
<div class="value">{{ logHistory.duration }}s</div>
</div>
</div>
<div class="title">{{ t('parameter.execution_details') }}</div>
<div class="list">
<div v-for="ele in logHistory.steps" :key="ele.duration" class="list-item">
<div class="name">
{{ ele.operate }}
</div>
<div class="status">
<div
v-if="ele.total_tokens && ele.total_tokens > 0"
class="time"
style="margin-right: 12px"
>
{{ ele.total_tokens }} tokens
</div>
<div class="time">{{ ele.duration }}s</div>
<el-icon size="16">
<icon_error v-if="ele.error"></icon_error>
<gou_icon v-else></gou_icon>
</el-icon>
</div>
</div>
</div>
</el-drawer>
</template>
<style lang="less">
.execution-details {
.title {
font-weight: 500;
font-size: 16px;
line-height: 24px;
margin-bottom: 16px;
}
.overview {
display: flex;
align-items: center;
justify-content: space-between;
margin-bottom: 24px;
.item {
width: calc(50% - 8px);
height: 86px;
border-radius: 12px;
border: 1px solid #dee0e3;
padding: 16px;
.ed-icon {
float: left;
margin: 8px 12px 0 0;
}
.name {
float: left;
color: #646a73;
font-weight: 400;
font-size: 14px;
line-height: 22px;
width: 64%;
}
.value {
float: left;
font-weight: 500;
font-size: 20px;
line-height: 28px;
color: #1f2329;
margin-top: 4px;
}
}
}
.list {
.list-item {
width: 100%;
height: 54px;
border-radius: 12px;
border: 1px solid #dee0e3;
padding: 16px;
margin-bottom: 8px;
display: flex;
align-items: center;
.status {
display: flex;
align-items: center;
margin-left: auto;
}
.name {
font-weight: 500;
font-size: 14px;
line-height: 22px;
display: flex;
flex-direction: row;
gap: 12px;
}
.time {
font-weight: 400;
font-size: 14px;
line-height: 22px;
color: #646a73;
}
.ed-icon {
margin-left: 12px;
}
}
}
}
</style>