mirror of
https://github.com/tencentmusic/supersonic.git
synced 2025-12-13 13:07:32 +00:00
(improvement)(chat-sdk) optimize card show type (#1775)
This commit is contained in:
@@ -86,16 +86,8 @@ const ChatMsg: React.FC<Props> = ({
|
|||||||
}
|
}
|
||||||
const isDslMetricCard =
|
const isDslMetricCard =
|
||||||
queryMode === 'LLM_S2SQL' && singleData && metricFields.length === 1 && columns.length === 1;
|
queryMode === 'LLM_S2SQL' && singleData && metricFields.length === 1 && columns.length === 1;
|
||||||
|
|
||||||
const isMetricCard = (queryMode.includes('METRIC') || isDslMetricCard) && singleData;
|
const isMetricCard = (queryMode.includes('METRIC') || isDslMetricCard) && singleData;
|
||||||
|
const isText = !queryColumns?.length;
|
||||||
const isText =
|
|
||||||
queryMode === 'PLAIN_TEXT' ||
|
|
||||||
(columns.length === 1 &&
|
|
||||||
columns[0].showType === 'CATEGORY' &&
|
|
||||||
((!queryMode.includes('METRIC') && !queryMode.includes('ENTITY')) ||
|
|
||||||
queryMode === 'METRIC_INTERPRET') &&
|
|
||||||
singleData);
|
|
||||||
|
|
||||||
if (isText) {
|
if (isText) {
|
||||||
return MsgContentTypeEnum.TEXT;
|
return MsgContentTypeEnum.TEXT;
|
||||||
@@ -120,6 +112,8 @@ const ChatMsg: React.FC<Props> = ({
|
|||||||
const isMetricTrend =
|
const isMetricTrend =
|
||||||
dateField &&
|
dateField &&
|
||||||
metricFields.length > 0 &&
|
metricFields.length > 0 &&
|
||||||
|
categoryField.length <= 1 &&
|
||||||
|
!(metricFields.length > 1 && categoryField.length > 0) &&
|
||||||
!dataSource.every(item => item[dateField.nameEn] === dataSource[0][dateField.nameEn]);
|
!dataSource.every(item => item[dateField.nameEn] === dataSource[0][dateField.nameEn]);
|
||||||
|
|
||||||
if (isMetricTrend) {
|
if (isMetricTrend) {
|
||||||
|
|||||||
Reference in New Issue
Block a user