File tree Expand file tree Collapse file tree 1 file changed +22
-2
lines changed
frontend/src/views/chat/component Expand file tree Collapse file tree 1 file changed +22
-2
lines changed Original file line number Diff line number Diff line change @@ -3,6 +3,7 @@ import type { ChatMessage } from '@/api/chat.ts'
33import { computed , watch , ref } from ' vue'
44import type { ChartTypes } from ' @/views/chat/component/BaseChart.ts'
55import DisplayChartBlock from ' @/views/chat/component/DisplayChartBlock.vue'
6+ import { concat } from ' lodash-es'
67
78const props = defineProps <{
89 id? : number | string
@@ -11,21 +12,40 @@ const props = defineProps<{
1112 data: string
1213}>()
1314
15+ const dataObject = computed <{
16+ fields: Array <string >
17+ data: Array <{ [key : string ]: any }>
18+ }>(() => {
19+ if (props .message ?.record ?.data ) {
20+ return JSON .parse (props .message .record .data )
21+ }
22+ return {}
23+ })
24+
1425const _data = computed (() => {
26+ let _list = []
1527 if (
1628 props .data &&
1729 props .data .length > 0 &&
1830 props .data .trim ().startsWith (' [' ) &&
1931 props .data .trim ().endsWith (' ]' )
2032 ) {
2133 try {
22- return JSON .parse (props .data )
34+ _list = JSON .parse (props .data )
2335 } catch (e ) {
2436 console .error (e )
2537 }
2638 }
2739
28- return []
40+ if (_list .length == 0 ) {
41+ return _list
42+ }
43+
44+ if (dataObject .value .data && dataObject .value .data .length > 0 ) {
45+ return concat (dataObject .value .data , _list )
46+ }
47+
48+ return _list
2949})
3050
3151const blockRef = ref ()
You can’t perform that action at this time.
0 commit comments