mirror of
https://github.com/tencentmusic/supersonic.git
synced 2025-12-11 12:07:42 +00:00
(improvement)(chat-sdk) optimize tip and card title (#1652)
This commit is contained in:
@@ -9,6 +9,7 @@ import React, { ReactNode, useState } from 'react';
|
|||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
queryId?: number;
|
queryId?: number;
|
||||||
|
question: string;
|
||||||
queryMode?: string;
|
queryMode?: string;
|
||||||
executeLoading: boolean;
|
executeLoading: boolean;
|
||||||
entitySwitchLoading: boolean;
|
entitySwitchLoading: boolean;
|
||||||
@@ -24,6 +25,7 @@ type Props = {
|
|||||||
|
|
||||||
const ExecuteItem: React.FC<Props> = ({
|
const ExecuteItem: React.FC<Props> = ({
|
||||||
queryId,
|
queryId,
|
||||||
|
question,
|
||||||
queryMode,
|
queryMode,
|
||||||
executeLoading,
|
executeLoading,
|
||||||
entitySwitchLoading,
|
entitySwitchLoading,
|
||||||
@@ -124,6 +126,7 @@ const ExecuteItem: React.FC<Props> = ({
|
|||||||
isSimpleMode={isSimpleMode}
|
isSimpleMode={isSimpleMode}
|
||||||
forceShowTable={showMsgContentTable}
|
forceShowTable={showMsgContentTable}
|
||||||
queryId={queryId}
|
queryId={queryId}
|
||||||
|
question={question}
|
||||||
data={data}
|
data={data}
|
||||||
chartIndex={chartIndex}
|
chartIndex={chartIndex}
|
||||||
triggerResize={triggerResize}
|
triggerResize={triggerResize}
|
||||||
|
|||||||
@@ -365,6 +365,7 @@ const ChatItem: React.FC<Props> = ({
|
|||||||
<ExecuteItem
|
<ExecuteItem
|
||||||
isSimpleMode={isSimpleMode}
|
isSimpleMode={isSimpleMode}
|
||||||
queryId={parseInfo?.queryId}
|
queryId={parseInfo?.queryId}
|
||||||
|
question={msg}
|
||||||
queryMode={parseInfo?.queryMode}
|
queryMode={parseInfo?.queryMode}
|
||||||
executeLoading={executeLoading}
|
executeLoading={executeLoading}
|
||||||
entitySwitchLoading={entitySwitchLoading}
|
entitySwitchLoading={entitySwitchLoading}
|
||||||
|
|||||||
@@ -10,11 +10,12 @@ import { useState } from 'react';
|
|||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
data: MsgDataType;
|
data: MsgDataType;
|
||||||
|
question: string;
|
||||||
loading: boolean;
|
loading: boolean;
|
||||||
onApplyAuth?: (model: string) => void;
|
onApplyAuth?: (model: string) => void;
|
||||||
};
|
};
|
||||||
|
|
||||||
const MetricCard: React.FC<Props> = ({ data, loading, onApplyAuth }) => {
|
const MetricCard: React.FC<Props> = ({ data, question, loading, onApplyAuth }) => {
|
||||||
const { queryMode, queryColumns, queryResults, entityInfo, aggregateInfo } = data;
|
const { queryMode, queryColumns, queryResults, entityInfo, aggregateInfo } = data;
|
||||||
|
|
||||||
const { metricInfos } = aggregateInfo || {};
|
const { metricInfos } = aggregateInfo || {};
|
||||||
@@ -39,11 +40,7 @@ const MetricCard: React.FC<Props> = ({ data, loading, onApplyAuth }) => {
|
|||||||
return (
|
return (
|
||||||
<div className={matricCardClass}>
|
<div className={matricCardClass}>
|
||||||
<div className={`${prefixCls}-top-bar`}>
|
<div className={`${prefixCls}-top-bar`}>
|
||||||
{indicatorColumn?.name ? (
|
<div className={`${prefixCls}-indicator-name`}>{question}</div>
|
||||||
<div className={`${prefixCls}-indicator-name`}>{indicatorColumn?.name}</div>
|
|
||||||
) : (
|
|
||||||
<div style={{ height: 10 }} />
|
|
||||||
)}
|
|
||||||
</div>
|
</div>
|
||||||
<Spin spinning={loading}>
|
<Spin spinning={loading}>
|
||||||
<div className={`${prefixCls}-indicator`}>
|
<div className={`${prefixCls}-indicator`}>
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ const Text: React.FC<Props> = ({ columns, referenceColumn, dataSource }) => {
|
|||||||
|
|
||||||
const initData = () => {
|
const initData = () => {
|
||||||
let textValue = dataSource[0][columns[0].nameEn];
|
let textValue = dataSource[0][columns[0].nameEn];
|
||||||
setText(textValue === undefined ? '暂无数据,如有疑问请联系管理员' : textValue);
|
setText(textValue === undefined ? '暂无数据' : textValue);
|
||||||
if (referenceColumn) {
|
if (referenceColumn) {
|
||||||
const referenceDataValue = dataSource[0][referenceColumn.nameEn];
|
const referenceDataValue = dataSource[0][referenceColumn.nameEn];
|
||||||
setReferenceData(referenceDataValue || []);
|
setReferenceData(referenceDataValue || []);
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ import { isMobile } from '../../utils/utils';
|
|||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
queryId?: number;
|
queryId?: number;
|
||||||
|
question: string;
|
||||||
data: MsgDataType;
|
data: MsgDataType;
|
||||||
chartIndex: number;
|
chartIndex: number;
|
||||||
triggerResize?: boolean;
|
triggerResize?: boolean;
|
||||||
@@ -25,6 +26,7 @@ type Props = {
|
|||||||
|
|
||||||
const ChatMsg: React.FC<Props> = ({
|
const ChatMsg: React.FC<Props> = ({
|
||||||
queryId,
|
queryId,
|
||||||
|
question,
|
||||||
data,
|
data,
|
||||||
chartIndex,
|
chartIndex,
|
||||||
triggerResize,
|
triggerResize,
|
||||||
@@ -176,6 +178,7 @@ const ChatMsg: React.FC<Props> = ({
|
|||||||
return (
|
return (
|
||||||
<MetricCard
|
<MetricCard
|
||||||
data={{ ...data, queryColumns: columns, queryResults: dataSource }}
|
data={{ ...data, queryColumns: columns, queryResults: dataSource }}
|
||||||
|
question={question}
|
||||||
loading={loading}
|
loading={loading}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
@@ -342,7 +345,7 @@ const ChatMsg: React.FC<Props> = ({
|
|||||||
return (
|
return (
|
||||||
<div className={chartMsgClass} style={style}>
|
<div className={chartMsgClass} style={style}>
|
||||||
{dataSource?.length === 0 ? (
|
{dataSource?.length === 0 ? (
|
||||||
<div>暂无数据,如有疑问请联系管理员</div>
|
<div>暂无数据</div>
|
||||||
) : (
|
) : (
|
||||||
<div>
|
<div>
|
||||||
{getMsgContent()}
|
{getMsgContent()}
|
||||||
|
|||||||
Reference in New Issue
Block a user