(feature)(webapp) change model name to model names tag (#455)

This commit is contained in:
williamhliu
2023-11-30 21:36:09 +08:00
committed by GitHub
parent 39a85dc4ed
commit c6d59701db
2 changed files with 33 additions and 26 deletions

View File

@@ -37,7 +37,7 @@ export type EntityInfoType = {
export type DateInfoType = { export type DateInfoType = {
dateList: any[]; dateList: any[];
dateMode: string; dateMode: string;
period: string; period: string;
startDate: string; startDate: string;
endDate: string; endDate: string;
text: string; text: string;
@@ -59,22 +59,23 @@ export type ModelType = {
id: number; id: number;
model: number; model: number;
name: string; name: string;
modelNames: string[];
type: string; type: string;
useCnt: number; useCnt: number;
} };
export type EntityDimensionType = { export type EntityDimensionType = {
bizName: string; bizName: string;
itemId: number; itemId: number;
name: string; name: string;
value: string; value: string;
} };
export type SqlInfoType = { export type SqlInfoType = {
s2SQL: string; s2SQL: string;
correctS2SQL: string; correctS2SQL: string;
querySQL: string; querySQL: string;
} };
export type ChatContextType = { export type ChatContextType = {
id: number; id: number;
@@ -86,12 +87,12 @@ export type ChatContextType = {
dateInfo: DateInfoType; dateInfo: DateInfoType;
dimensions: FieldType[]; dimensions: FieldType[];
metrics: FieldType[]; metrics: FieldType[];
entity: { alias: string[], id: number }; entity: { alias: string[]; id: number };
entityInfo: EntityInfoType; entityInfo: EntityInfoType;
elementMatches: any[]; elementMatches: any[];
nativeQuery: boolean; nativeQuery: boolean;
queryMode: string; queryMode: string;
queryType: 'METRIC' | 'TAG' | 'OTHER'; queryType: 'METRIC' | 'TAG' | 'OTHER';
dimensionFilters: FilterItemType[]; dimensionFilters: FilterItemType[];
properties: any; properties: any;
sqlInfo: SqlInfoType; sqlInfo: SqlInfoType;
@@ -102,26 +103,26 @@ export enum MsgValidTypeEnum {
SEARCH_EXCEPTION = 1, SEARCH_EXCEPTION = 1,
EMPTY = 2, EMPTY = 2,
INVALID = 3, INVALID = 3,
}; }
export type PluginResonseType = { export type PluginResonseType = {
description: string; description: string;
webPage: { url: string, paramOptions: any, params: any, valueParams: any }; webPage: { url: string; paramOptions: any; params: any; valueParams: any };
pluginId: number; pluginId: number;
pluginType: string; pluginType: string;
name: string; name: string;
} };
export type MetricInfoType = { export type MetricInfoType = {
date: string; date: string;
name: string; name: string;
statistics: any; statistics: any;
value: string; value: string;
} };
export type AggregateInfoType = { export type AggregateInfoType = {
metricInfos: MetricInfoType[] metricInfos: MetricInfoType[];
} };
export type MsgDataType = { export type MsgDataType = {
id: number; id: number;
@@ -155,7 +156,7 @@ export type ParseDataType = {
selectedParses: ChatContextType[]; selectedParses: ChatContextType[];
candidateParses: ChatContextType[]; candidateParses: ChatContextType[];
similarSolvedQuery: SimilarQuestionType[]; similarSolvedQuery: SimilarQuestionType[];
} };
export type QueryDataType = { export type QueryDataType = {
chatContext: ChatContextType; chatContext: ChatContextType;
@@ -182,7 +183,7 @@ export enum SemanticTypeEnum {
DIMENSION = 'DIMENSION', DIMENSION = 'DIMENSION',
METRIC = 'METRIC', METRIC = 'METRIC',
VALUE = 'VALUE', VALUE = 'VALUE',
}; }
export const SEMANTIC_TYPE_MAP = { export const SEMANTIC_TYPE_MAP = {
[SemanticTypeEnum.DOMAIN]: '数据模型', [SemanticTypeEnum.DOMAIN]: '数据模型',
@@ -194,7 +195,7 @@ export const SEMANTIC_TYPE_MAP = {
export type SuggestionItemType = { export type SuggestionItemType = {
model: number; model: number;
name: string; name: string;
bizName: string bizName: string;
}; };
export type SuggestionType = { export type SuggestionType = {
@@ -203,10 +204,10 @@ export type SuggestionType = {
}; };
export type SuggestionDataType = { export type SuggestionDataType = {
currentAggregateType: string, currentAggregateType: string;
columns: ColumnType[], columns: ColumnType[];
mainEntity: EntityInfoType, mainEntity: EntityInfoType;
suggestions: SuggestionType, suggestions: SuggestionType;
}; };
export type HistoryMsgItemType = { export type HistoryMsgItemType = {
@@ -231,22 +232,22 @@ export type DrillDownDimensionType = {
model: number; model: number;
name: string; name: string;
bizName: string; bizName: string;
} };
export type SendMsgParamsType = { export type SendMsgParamsType = {
msg: string; msg: string;
agentId: number; agentId: number;
modelId: number; modelId: number;
filters?: FilterItemType[]; filters?: FilterItemType[];
} };
export type SimilarQuestionType = { export type SimilarQuestionType = {
// queryId: number; // queryId: number;
// parseId: number; // parseId: number;
queryText: string; queryText: string;
} };
export type ParseTimeCostType = { export type ParseTimeCostType = {
parseTime: number; parseTime: number;
sqlTime: number; sqlTime: number;
} };

View File

@@ -1,7 +1,7 @@
import React, { ReactNode } from 'react'; import React, { ReactNode } from 'react';
import { AGG_TYPE_MAP, PREFIX_CLS } from '../../common/constants'; import { AGG_TYPE_MAP, PREFIX_CLS } from '../../common/constants';
import { ChatContextType, DateInfoType, EntityInfoType, FilterItemType } from '../../common/type'; import { ChatContextType, DateInfoType, EntityInfoType, FilterItemType } from '../../common/type';
import { Button, DatePicker } from 'antd'; import { Button, DatePicker, Tag } from 'antd';
import { CheckCircleFilled, ReloadOutlined } from '@ant-design/icons'; import { CheckCircleFilled, ReloadOutlined } from '@ant-design/icons';
import Loading from './Loading'; import Loading from './Loading';
import FilterItem from './FilterItem'; import FilterItem from './FilterItem';
@@ -89,7 +89,7 @@ const ParseTip: React.FC<Props> = ({
const { const {
modelId, modelId,
modelName, model,
dimensions, dimensions,
metrics, metrics,
aggType, aggType,
@@ -101,6 +101,8 @@ const ParseTip: React.FC<Props> = ({
nativeQuery, nativeQuery,
} = currentParseInfo || {}; } = currentParseInfo || {};
const { modelNames } = model || {};
const entityAlias = entity?.alias?.[0]?.split('.')?.[0]; const entityAlias = entity?.alias?.[0]?.split('.')?.[0];
const entityDimensions = entityInfo?.dimensions?.filter( const entityDimensions = entityInfo?.dimensions?.filter(
@@ -149,7 +151,11 @@ const ParseTip: React.FC<Props> = ({
) : ( ) : (
<div className={`${prefixCls}-tip-item`}> <div className={`${prefixCls}-tip-item`}>
<div className={`${prefixCls}-tip-item-name`}></div> <div className={`${prefixCls}-tip-item-name`}></div>
<div className={itemValueClass}>{modelName}</div> <div className={itemValueClass}>
{modelNames?.map(modelName => (
<Tag key={modelName}>{modelName}</Tag>
))}
</div>
</div> </div>
)} )}
{(queryType === 'METRIC' || queryType === 'TAG') && ( {(queryType === 'METRIC' || queryType === 'TAG') && (