Skip to content

Commit 10663cc

Browse files
committed
fix: get_chart_usage add undefined value check
1 parent d33e420 commit 10663cc

1 file changed

Lines changed: 21 additions & 19 deletions

File tree

frontend/src/views/chat/index.vue

Lines changed: 21 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -937,25 +937,27 @@ async function clickAnalysis(id?: number) {
937937
938938
function getRecordUsage(recordId: any) {
939939
console.debug('getRecordUsage id: ', recordId)
940-
nextTick(() => {
941-
chatApi
942-
.get_chart_usage(recordId)
943-
.then((res) => {
944-
const logHistory = chatApi.toChatLogHistory(res)
945-
if (logHistory) {
946-
currentChat.value.records.forEach((record) => {
947-
if (record.id === recordId) {
948-
record.duration = logHistory.duration
949-
record.finish_time = logHistory.finish_time
950-
record.total_tokens = logHistory.total_tokens
951-
}
952-
})
953-
}
954-
})
955-
.catch((e) => {
956-
console.error(e)
957-
})
958-
})
940+
if (recordId) {
941+
nextTick(() => {
942+
chatApi
943+
.get_chart_usage(recordId)
944+
.then((res) => {
945+
const logHistory = chatApi.toChatLogHistory(res)
946+
if (logHistory) {
947+
currentChat.value.records.forEach((record) => {
948+
if (record.id === recordId) {
949+
record.duration = logHistory.duration
950+
record.finish_time = logHistory.finish_time
951+
record.total_tokens = logHistory.total_tokens
952+
}
953+
})
954+
}
955+
})
956+
.catch((e) => {
957+
console.error(e)
958+
})
959+
})
960+
}
959961
}
960962
961963
const predictAnswerRef = ref()

0 commit comments

Comments
 (0)