diff --git a/frontend/src/views/chat/component/PredictChartBlock.vue b/frontend/src/views/chat/component/PredictChartBlock.vue index 220a3144..6d931481 100644 --- a/frontend/src/views/chat/component/PredictChartBlock.vue +++ b/frontend/src/views/chat/component/PredictChartBlock.vue @@ -3,6 +3,7 @@ import type { ChatMessage } from '@/api/chat.ts' import { computed, watch, ref } from 'vue' import type { ChartTypes } from '@/views/chat/component/BaseChart.ts' import DisplayChartBlock from '@/views/chat/component/DisplayChartBlock.vue' +import { concat } from 'lodash-es' const props = defineProps<{ id?: number | string @@ -11,7 +12,18 @@ const props = defineProps<{ data: string }>() +const dataObject = computed<{ + fields: Array + data: Array<{ [key: string]: any }> +}>(() => { + if (props.message?.record?.data) { + return JSON.parse(props.message.record.data) + } + return {} +}) + const _data = computed(() => { + let _list = [] if ( props.data && props.data.length > 0 && @@ -19,13 +31,21 @@ const _data = computed(() => { props.data.trim().endsWith(']') ) { try { - return JSON.parse(props.data) + _list = JSON.parse(props.data) } catch (e) { console.error(e) } } - return [] + if (_list.length == 0) { + return _list + } + + if (dataObject.value.data && dataObject.value.data.length > 0) { + return concat(dataObject.value.data, _list) + } + + return _list }) const blockRef = ref()