diff --git a/frontend/src/views/chat/index.vue b/frontend/src/views/chat/index.vue index 97493d68..54610b62 100644 --- a/frontend/src/views/chat/index.vue +++ b/frontend/src/views/chat/index.vue @@ -934,23 +934,26 @@ async function clickAnalysis(id?: number) { } function getRecordUsage(recordId: any) { - chatApi - .get_chart_usage(recordId) - .then((res) => { - const logHistory = chatApi.toChatLogHistory(res) - if (logHistory) { - currentChat.value.records.forEach((record) => { - if (record.id === recordId) { - record.duration = logHistory.duration - record.finish_time = logHistory.finish_time - record.total_tokens = logHistory.total_tokens - } - }) - } - }) - .catch((e) => { - console.error(e) - }) + console.debug('getRecordUsage id: ', recordId) + nextTick(() => { + chatApi + .get_chart_usage(recordId) + .then((res) => { + const logHistory = chatApi.toChatLogHistory(res) + if (logHistory) { + currentChat.value.records.forEach((record) => { + if (record.id === recordId) { + record.duration = logHistory.duration + record.finish_time = logHistory.finish_time + record.total_tokens = logHistory.total_tokens + } + }) + } + }) + .catch((e) => { + console.error(e) + }) + }) } const predictAnswerRef = ref()