Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions frontend/src/i18n/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -635,6 +635,7 @@
"error": "Error",
"exec-sql-err": "Execute SQL failed",
"no_data": "No Data",
"loading_data": "Loading ...",
"show_error_detail": "Show error info"
},
"about": {
Expand Down
3 changes: 2 additions & 1 deletion frontend/src/i18n/ko-KR.json
Original file line number Diff line number Diff line change
Expand Up @@ -635,6 +635,7 @@
"error": "오류",
"exec-sql-err": "SQL 실행 실패",
"no_data": "데이터가 없습니다",
"loading_data": "로딩 중 ...",
"show_error_detail": "구체적인 정보 보기"
},
"about": {
Expand Down Expand Up @@ -733,4 +734,4 @@
"modelType": {
"llm": "대형 언어 모델"
}
}
}
3 changes: 2 additions & 1 deletion frontend/src/i18n/zh-CN.json
Original file line number Diff line number Diff line change
Expand Up @@ -635,6 +635,7 @@
"error": "错误",
"exec-sql-err": "执行SQL失败",
"no_data": "暂无数据",
"loading_data": "加载中...",
"show_error_detail": "查看具体信息"
},
"about": {
Expand Down Expand Up @@ -733,4 +734,4 @@
"modelType": {
"llm": "大语言模型"
}
}
}
11 changes: 10 additions & 1 deletion frontend/src/views/chat/answer/ChartAnswer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,10 @@ const sendMessage = async () => {
}
}

const loadingData = ref(false)

function getChatData(recordId?: number) {
loadingData.value = true
chatApi
.get_chart_data(recordId)
.then((response) => {
Expand All @@ -229,6 +232,7 @@ function getChatData(recordId?: number) {
})
})
.finally(() => {
loadingData.value = false
emits('scrollBottom')
})
}
Expand All @@ -254,7 +258,12 @@ defineExpose({ sendMessage, index: () => index.value, stop })

<template>
<BaseAnswer v-if="message" :message="message" :reasoning-name="reasoningName" :loading="_loading">
<ChartBlock style="margin-top: 6px" :message="message" :record-id="recordId" />
<ChartBlock
style="margin-top: 6px"
:message="message"
:record-id="recordId"
:loading-data="loadingData"
/>
<slot></slot>
<template #tool>
<slot name="tool"></slot>
Expand Down
34 changes: 26 additions & 8 deletions frontend/src/views/chat/answer/PredictAnswer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -204,32 +204,49 @@ const sendMessage = async () => {

const chartBlockRef = ref()

const loadingData = ref(false)

function getChatPredictData(recordId?: number) {
chatApi.get_chart_predict_data(recordId).then((response) => {
_currentChat.value.records.forEach((record) => {
if (record.id === recordId) {
record.predict_data = response ?? []
loadingData.value = true
chatApi
.get_chart_predict_data(recordId)
.then((response) => {
let has = false
_currentChat.value.records.forEach((record) => {
if (record.id === recordId) {
has = true
record.predict_data = response ?? []

if (record.predict_data.length > 1) {
getChatData(recordId)
if (record.predict_data.length > 1) {
getChatData(recordId)
} else {
loadingData.value = false
}
}
})
if (!has) {
_loading.value = false
}
})
})
.catch((e) => {
loadingData.value = false
console.error(e)
})
}

function getChatData(recordId?: number) {
loadingData.value = true
chatApi
.get_chart_data(recordId)
.then((response) => {
_currentChat.value.records.forEach((record) => {
if (record.id === recordId) {
record.data = response
console.log(record.data)
}
})
})
.finally(() => {
loadingData.value = false
emits('scrollBottom')
})
}
Expand Down Expand Up @@ -262,6 +279,7 @@ defineExpose({ sendMessage, index: () => index.value, chatList: () => _chatList,
style="margin-top: 12px"
:record-id="recordId"
:message="message"
:loading-data="loadingData"
is-predict
/>
<slot></slot>
Expand Down
5 changes: 5 additions & 0 deletions frontend/src/views/chat/chat-block/ChartBlock.vue
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,14 @@ const props = withDefaults(
isPredict?: boolean
chatType?: ChartTypes
enlarge?: boolean
loadingData?: boolean
}>(),
{
recordId: undefined,
isPredict: false,
chatType: undefined,
enlarge: false,
loadingData: false,
}
)

Expand Down Expand Up @@ -473,6 +475,7 @@ watch(
:chart-type="chartType"
:message="message"
:data="data"
:loading-data="loadingData"
/>
</div>
<div v-if="dataObject.limit" class="over-limit-hint">
Expand All @@ -493,8 +496,10 @@ watch(
<ChartBlock
v-if="dialogVisible"
:message="message"
:record-id="recordId"
:is-predict="isPredict"
:chat-type="chartType"
:loading-data="loadingData"
enlarge
@exit-full-screen="onExitFullScreen"
/>
Expand Down
3 changes: 2 additions & 1 deletion frontend/src/views/chat/component/DisplayChartBlock.vue
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ const props = defineProps<{
chartType: ChartTypes
message: ChatMessage
data: Array<{ [key: string]: any }>
loadingData?: boolean
}>()

const { t } = useI18n()
Expand Down Expand Up @@ -94,7 +95,7 @@ defineExpose({
:series="series"
:data="data"
/>
<el-empty v-else :description="t('chat.no_data')" />
<el-empty v-else :description="loadingData ? t('chat.loading_data') : t('chat.no_data')" />
</div>
</template>

Expand Down