mirror of
https://gh-proxy.org/https://github.com/klinsmaya/SQLBot.git
synced 2026-11-09 01:36:57 +08:00
feat(dashboard): The dashboard supports displaying real-time data (#930)
This commit is contained in:
@@ -39,6 +39,7 @@ export class ChatRecord {
|
||||
question?: string
|
||||
sql_answer?: string
|
||||
sql?: string
|
||||
datasource?: number
|
||||
data?: string | any
|
||||
chart_answer?: string
|
||||
chart?: string
|
||||
@@ -67,6 +68,7 @@ export class ChatRecord {
|
||||
question: string,
|
||||
sql_answer: string | undefined,
|
||||
sql: string | undefined,
|
||||
datasource: number | undefined,
|
||||
data: string | any | undefined,
|
||||
chart_answer: string | undefined,
|
||||
chart: string | undefined,
|
||||
@@ -94,6 +96,7 @@ export class ChatRecord {
|
||||
question?: string,
|
||||
sql_answer?: string,
|
||||
sql?: string,
|
||||
datasource?: number | undefined,
|
||||
data?: string | any,
|
||||
chart_answer?: string,
|
||||
chart?: string,
|
||||
@@ -120,6 +123,7 @@ export class ChatRecord {
|
||||
this.question = question
|
||||
this.sql_answer = sql_answer
|
||||
this.sql = sql
|
||||
this.datasource = datasource
|
||||
this.data = data
|
||||
this.chart_answer = chart_answer
|
||||
this.chart = chart
|
||||
@@ -263,6 +267,7 @@ const toChatRecord = (data?: any): ChatRecord | undefined => {
|
||||
data.question,
|
||||
data.sql_answer,
|
||||
data.sql,
|
||||
data.datasource,
|
||||
data.data,
|
||||
data.chart_answer,
|
||||
data.chart,
|
||||
|
||||
@@ -55,6 +55,8 @@ const dataObject = computed<{
|
||||
fields: Array<string>
|
||||
data: Array<{ [key: string]: any }>
|
||||
limit: number | undefined
|
||||
datasource: number | undefined
|
||||
sql: string | undefined
|
||||
}>(() => {
|
||||
if (props.message?.record?.data) {
|
||||
if (typeof props.message?.record?.data === 'string') {
|
||||
@@ -220,6 +222,8 @@ function addToDashboard() {
|
||||
data: {
|
||||
data: data.value,
|
||||
},
|
||||
sql: props.message?.record?.sql,
|
||||
datasource: props.message?.record?.datasource,
|
||||
chart: {},
|
||||
}
|
||||
// @ts-expect-error eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
|
||||
@@ -143,7 +143,13 @@ function adaptorChartInfoList(chatInfo: ChatInfo) {
|
||||
record?.predict_record_id !== null &&
|
||||
data?.data?.length > 0)
|
||||
) {
|
||||
const recordeInfo = { id: chatInfo.id + '_' + record.id, data: data, chart: {} }
|
||||
const recordeInfo = {
|
||||
id: chatInfo.id + '_' + record.id,
|
||||
sql: record.sql,
|
||||
datasource: record.datasource,
|
||||
data: data,
|
||||
chart: {},
|
||||
}
|
||||
const chartBaseInfo = JSON.parse(record.chart)
|
||||
if (chartBaseInfo) {
|
||||
let yAxis = []
|
||||
|
||||
Reference in New Issue
Block a user