mirror of
https://github.com/tencentmusic/supersonic.git
synced 2025-12-17 16:02:14 +00:00
first commit
This commit is contained in:
50
webapp/packages/chat-sdk/src/common/constants.ts
Normal file
50
webapp/packages/chat-sdk/src/common/constants.ts
Normal file
@@ -0,0 +1,50 @@
|
||||
import { MsgValidTypeEnum } from './type';
|
||||
|
||||
export enum NumericUnit {
|
||||
None = '无',
|
||||
TenThousand = '万',
|
||||
EnTenThousand = 'w',
|
||||
OneHundredMillion = '亿',
|
||||
Thousand = 'k',
|
||||
Million = 'M',
|
||||
Giga = 'G',
|
||||
}
|
||||
|
||||
export const PRIMARY_COLOR = '#f87653';
|
||||
export const CHART_BLUE_COLOR = '#446dff';
|
||||
|
||||
export const CHAT_BLUE = '#1b4aef';
|
||||
|
||||
export const CHART_SECONDARY_COLOR = 'rgba(153, 153, 153, 0.3)';
|
||||
|
||||
export const CLS_PREFIX = 'ss-chat';
|
||||
|
||||
export const DATE_TYPES = {
|
||||
DAY: [{ label: '近7天', value: 7 }, { label: '近30天', value: 30 }, { label: '近60天', value: 60 }, { label: '近90天', value: 90 }],
|
||||
WEEK: [{ label: '近4周', value: 4 }, { label: '近12周', value: 12 }, { label: '近24周', value: 24 }, { label: '近52周', value: 52 }],
|
||||
MONTH: [{ label: '近3个月', value: 3 }, { label: '近6个月', value: 6 }, { label: '近12个月', value: 12 }, { label: '近24个月', value: 24 }],
|
||||
};
|
||||
|
||||
export const THEME_COLOR_LIST = [
|
||||
'#3369FF',
|
||||
'#36D2B8',
|
||||
'#DB8D76',
|
||||
'#47B359',
|
||||
'#8545E6',
|
||||
'#E0B18B',
|
||||
'#7258F3',
|
||||
'#0095FF',
|
||||
'#52CC8F',
|
||||
'#6675FF',
|
||||
'#CC516E',
|
||||
'#5CA9E6',
|
||||
];
|
||||
|
||||
export const PARSE_ERROR_TIP = '小Q不太懂您说什么呐,回去一定补充知识';
|
||||
|
||||
export const MSG_VALID_TIP = {
|
||||
[MsgValidTypeEnum.SEARCH_EXCEPTION]: '数据查询异常',
|
||||
[MsgValidTypeEnum.INVALID]: '小Q不太懂您说什么呐,回去一定补充知识',
|
||||
};
|
||||
|
||||
export const PREFIX_CLS = 'ss-chat';
|
||||
148
webapp/packages/chat-sdk/src/common/type.ts
Normal file
148
webapp/packages/chat-sdk/src/common/type.ts
Normal file
@@ -0,0 +1,148 @@
|
||||
export type SearchRecommendItem = {
|
||||
complete: boolean;
|
||||
domainId: number;
|
||||
domainName: string;
|
||||
recommend: string;
|
||||
subRecommend: string;
|
||||
schemaElementType: string;
|
||||
};
|
||||
|
||||
export type FieldType = {
|
||||
bizName: string;
|
||||
id: number;
|
||||
name: string;
|
||||
status: number;
|
||||
value: string;
|
||||
};
|
||||
|
||||
export type DomainInfoType = {
|
||||
bizName: string;
|
||||
itemId: number;
|
||||
name: string;
|
||||
primaryEntityBizName: string;
|
||||
value: string;
|
||||
words: string[];
|
||||
};
|
||||
|
||||
export type EntityInfoType = {
|
||||
domainInfo: DomainInfoType;
|
||||
dimensions: FieldType[];
|
||||
metrics: FieldType[];
|
||||
entityId: number;
|
||||
};
|
||||
|
||||
export type DateInfoType = {
|
||||
dateList: any[];
|
||||
dateMode: number;
|
||||
period: string;
|
||||
startDate: string;
|
||||
endDate: string;
|
||||
text: string;
|
||||
unit: number;
|
||||
};
|
||||
|
||||
export type FilterItemType = {
|
||||
elementID: number;
|
||||
name: string;
|
||||
operator: string;
|
||||
type: string;
|
||||
value: string;
|
||||
};
|
||||
|
||||
export type ChatContextType = {
|
||||
aggType: string;
|
||||
domainId: number;
|
||||
domainName: string;
|
||||
dateInfo: DateInfoType;
|
||||
dimensions: FieldType[];
|
||||
metrics: FieldType[];
|
||||
entity: number;
|
||||
filters: FilterItemType[];
|
||||
};
|
||||
|
||||
export enum MsgValidTypeEnum {
|
||||
NORMAL = 0,
|
||||
SEARCH_EXCEPTION = 1,
|
||||
EMPTY = 2,
|
||||
INVALID = 3,
|
||||
};
|
||||
|
||||
export type MsgDataType = {
|
||||
id: number;
|
||||
question: string;
|
||||
aggregateType: string;
|
||||
appletResponse: string;
|
||||
chatContext: ChatContextType;
|
||||
entityInfo: EntityInfoType;
|
||||
queryAuthorization: any;
|
||||
queryColumns: ColumnType[];
|
||||
queryResults: any[];
|
||||
queryId: number;
|
||||
queryMode: string;
|
||||
queryState: MsgValidTypeEnum;
|
||||
};
|
||||
|
||||
export type QueryDataType = {
|
||||
queryColumns: ColumnType[];
|
||||
queryResults: any[];
|
||||
};
|
||||
|
||||
export type ColumnType = {
|
||||
authorized: boolean;
|
||||
name: string;
|
||||
nameEn: string;
|
||||
showType: string;
|
||||
type: string;
|
||||
dataFormatType: string;
|
||||
dataFormat: {
|
||||
decimalPlaces: number;
|
||||
needmultiply100: boolean;
|
||||
};
|
||||
};
|
||||
|
||||
export enum SemanticTypeEnum {
|
||||
DOMAIN = 'DOMAIN',
|
||||
DIMENSION = 'DIMENSION',
|
||||
METRIC = 'METRIC',
|
||||
VALUE = 'VALUE',
|
||||
};
|
||||
|
||||
export const SEMANTIC_TYPE_MAP = {
|
||||
[SemanticTypeEnum.DOMAIN]: '主题域',
|
||||
[SemanticTypeEnum.DIMENSION]: '维度',
|
||||
[SemanticTypeEnum.METRIC]: '指标',
|
||||
[SemanticTypeEnum.VALUE]: '维度值',
|
||||
};
|
||||
|
||||
export type SuggestionItemType = {
|
||||
domain: number;
|
||||
name: string;
|
||||
bizName: string
|
||||
};
|
||||
|
||||
export type SuggestionType = {
|
||||
dimensions: SuggestionItemType[];
|
||||
metrics: SuggestionItemType[];
|
||||
};
|
||||
|
||||
export type SuggestionDataType = {
|
||||
currentAggregateType: string,
|
||||
columns: ColumnType[],
|
||||
mainEntity: EntityInfoType,
|
||||
suggestions: SuggestionType,
|
||||
};
|
||||
|
||||
export type HistoryMsgItemType = {
|
||||
questionId: number;
|
||||
queryText: string;
|
||||
queryResponse: MsgDataType;
|
||||
chatId: number;
|
||||
createTime: string;
|
||||
feedback: string;
|
||||
score: number;
|
||||
};
|
||||
|
||||
export type HistoryType = {
|
||||
hasNextPage: boolean;
|
||||
list: HistoryMsgItemType[];
|
||||
};
|
||||
Reference in New Issue
Block a user