|
| 1 | +<script lang="ts" setup> |
| 2 | +import { ref } from 'vue' |
| 3 | +import gou_icon from '@/assets/svg/gou_icon.svg' |
| 4 | +import icon_error from '@/assets/svg/icon_error.svg' |
| 5 | +import icon_database_colorful from '@/assets/svg/icon_database_colorful.svg' |
| 6 | +import icon_alarm_clock_colorful from '@/assets/svg/icon_alarm-clock_colorful.svg' |
| 7 | +import { chatApi, type ChatLogHistory } from '@/api/chat.ts' |
| 8 | +import { useI18n } from 'vue-i18n' |
| 9 | +
|
| 10 | +const { t } = useI18n() |
| 11 | +const logHistory = ref<ChatLogHistory>({}) |
| 12 | +const dialogFormVisible = ref(false) |
| 13 | +
|
| 14 | +function getLogList(recordId: any) { |
| 15 | + chatApi.get_chart_log_history(recordId).then((res) => { |
| 16 | + logHistory.value = chatApi.toChatLogHistory(res) as ChatLogHistory |
| 17 | + dialogFormVisible.value = true |
| 18 | + }) |
| 19 | +} |
| 20 | +
|
| 21 | +defineExpose({ |
| 22 | + getLogList, |
| 23 | +}) |
| 24 | +</script> |
| 25 | + |
| 26 | +<template> |
| 27 | + <el-drawer |
| 28 | + v-model="dialogFormVisible" |
| 29 | + :title="t('parameter.execution_details')" |
| 30 | + destroy-on-close |
| 31 | + modal-class="execution-details" |
| 32 | + size="600px" |
| 33 | + > |
| 34 | + <div class="title">{{ t('parameter.overview') }}</div> |
| 35 | + <div class="overview"> |
| 36 | + <div class="item"> |
| 37 | + <el-icon size="40"> |
| 38 | + <icon_database_colorful></icon_database_colorful> |
| 39 | + </el-icon> |
| 40 | + <div class="name">{{ t('parameter.tokens_required') }}</div> |
| 41 | + <div class="value">{{ logHistory.total_tokens }}</div> |
| 42 | + </div> |
| 43 | + <div class="item"> |
| 44 | + <el-icon size="40"> |
| 45 | + <icon_alarm_clock_colorful></icon_alarm_clock_colorful> |
| 46 | + </el-icon> |
| 47 | + <div class="name">{{ t('parameter.time_execution') }}</div> |
| 48 | + <div class="value">{{ logHistory.duration }}s</div> |
| 49 | + </div> |
| 50 | + </div> |
| 51 | + <div class="title">{{ t('parameter.execution_details') }}</div> |
| 52 | + |
| 53 | + <div class="list"> |
| 54 | + <div class="list-item" :key="ele.duration" v-for="ele in logHistory.steps"> |
| 55 | + <div class="name">{{ ele.operate }}</div> |
| 56 | + <div class="status"> |
| 57 | + <div class="time">{{ ele.duration }}s</div> |
| 58 | + <el-icon size="16"> |
| 59 | + <gou_icon v-if="true"></gou_icon> |
| 60 | + <icon_error v-else></icon_error> |
| 61 | + </el-icon> |
| 62 | + </div> |
| 63 | + </div> |
| 64 | + </div> |
| 65 | + </el-drawer> |
| 66 | +</template> |
| 67 | + |
| 68 | +<style lang="less"> |
| 69 | +.execution-details { |
| 70 | + .title { |
| 71 | + font-weight: 500; |
| 72 | + font-size: 16px; |
| 73 | + line-height: 24px; |
| 74 | + margin-bottom: 16px; |
| 75 | + } |
| 76 | +
|
| 77 | + .overview { |
| 78 | + display: flex; |
| 79 | + align-items: center; |
| 80 | + justify-content: space-between; |
| 81 | + margin-bottom: 24px; |
| 82 | + .item { |
| 83 | + width: 268px; |
| 84 | + height: 86px; |
| 85 | + border-radius: 12px; |
| 86 | + border: 1px solid #dee0e3; |
| 87 | + padding: 16px; |
| 88 | +
|
| 89 | + .ed-icon { |
| 90 | + float: left; |
| 91 | + margin: 8px 12px 0 0; |
| 92 | + } |
| 93 | +
|
| 94 | + .name { |
| 95 | + float: left; |
| 96 | + color: #646a73; |
| 97 | + font-family: PingFang SC; |
| 98 | + font-weight: 400; |
| 99 | + font-size: 14px; |
| 100 | + line-height: 22px; |
| 101 | + width: 180px; |
| 102 | + } |
| 103 | +
|
| 104 | + .value { |
| 105 | + float: left; |
| 106 | + font-weight: 500; |
| 107 | + font-size: 20px; |
| 108 | + line-height: 28px; |
| 109 | + color: #1f2329; |
| 110 | + margin-top: 4px; |
| 111 | + } |
| 112 | + } |
| 113 | + } |
| 114 | +
|
| 115 | + .list { |
| 116 | + .list-item { |
| 117 | + width: 552px; |
| 118 | + height: 54px; |
| 119 | + border-radius: 12px; |
| 120 | + border: 1px solid #dee0e3; |
| 121 | + padding: 16px; |
| 122 | + margin-bottom: 8px; |
| 123 | + display: flex; |
| 124 | + align-items: center; |
| 125 | +
|
| 126 | + .status { |
| 127 | + display: flex; |
| 128 | + align-items: center; |
| 129 | + margin-left: auto; |
| 130 | + } |
| 131 | + .name { |
| 132 | + font-weight: 500; |
| 133 | + font-size: 14px; |
| 134 | + line-height: 22px; |
| 135 | + } |
| 136 | +
|
| 137 | + .time { |
| 138 | + font-weight: 400; |
| 139 | + font-size: 14px; |
| 140 | + line-height: 22px; |
| 141 | + color: #646a73; |
| 142 | + } |
| 143 | +
|
| 144 | + .ed-icon { |
| 145 | + margin-left: 12px; |
| 146 | + } |
| 147 | + } |
| 148 | + } |
| 149 | +} |
| 150 | +</style> |
0 commit comments