mirror of
https://github.com/tencentmusic/supersonic.git
synced 2025-12-10 11:07:06 +00:00
(improvement)(chat-sdk) add agentId to execute api and add PLAIN_TEXT query mode (#1223)
This commit is contained in:
@@ -96,7 +96,7 @@ const SqlItem: React.FC<Props> = ({
|
|||||||
setSqlType(sqlType === 's2SQL' ? '' : 's2SQL');
|
setSqlType(sqlType === 's2SQL' ? '' : 's2SQL');
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{queryMode === 'LLM_S2SQL' ? 'LLM' : 'Rule'}解析S2SQL
|
{queryMode === 'LLM_S2SQL' || queryMode === 'PLAIN_TEXT' ? 'LLM' : 'Rule'}解析S2SQL
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
{sqlInfo.correctS2SQL && (
|
{sqlInfo.correctS2SQL && (
|
||||||
|
|||||||
@@ -123,7 +123,7 @@ const ChatItem: React.FC<Props> = ({
|
|||||||
setExecuteLoading(true);
|
setExecuteLoading(true);
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
const res: any = await chatExecute(msg, conversationId!, parseInfoValue);
|
const res: any = await chatExecute(msg, conversationId!, parseInfoValue, agentId);
|
||||||
const valid = updateData(res);
|
const valid = updateData(res);
|
||||||
onMsgDataLoaded?.(
|
onMsgDataLoaded?.(
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -86,11 +86,13 @@ const ChatMsg: React.FC<Props> = ({
|
|||||||
const isMetricCard = (queryMode.includes('METRIC') || isDslMetricCard) && singleData;
|
const isMetricCard = (queryMode.includes('METRIC') || isDslMetricCard) && singleData;
|
||||||
|
|
||||||
const isText =
|
const isText =
|
||||||
columns.length === 1 &&
|
queryMode === 'PLAIN_TEXT' ||
|
||||||
columns[0].showType === 'CATEGORY' &&
|
(columns.length === 1 &&
|
||||||
((!queryMode.includes('METRIC') && !queryMode.includes('ENTITY')) ||
|
columns[0].showType === 'CATEGORY' &&
|
||||||
queryMode === 'METRIC_INTERPRET') &&
|
((!queryMode.includes('METRIC') && !queryMode.includes('ENTITY')) ||
|
||||||
singleData;
|
queryMode === 'METRIC_INTERPRET') &&
|
||||||
|
singleData);
|
||||||
|
|
||||||
if (isText) {
|
if (isText) {
|
||||||
return MsgContentTypeEnum.TEXT;
|
return MsgContentTypeEnum.TEXT;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -61,9 +61,15 @@ export function chatParse(
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
export function chatExecute(queryText: string, chatId: number, parseInfo: ChatContextType) {
|
export function chatExecute(
|
||||||
|
queryText: string,
|
||||||
|
chatId: number,
|
||||||
|
parseInfo: ChatContextType,
|
||||||
|
agentId?: number
|
||||||
|
) {
|
||||||
return axios.post<MsgDataType>(`${prefix}/chat/query/execute`, {
|
return axios.post<MsgDataType>(`${prefix}/chat/query/execute`, {
|
||||||
queryText,
|
queryText,
|
||||||
|
agentId,
|
||||||
chatId: chatId || DEFAULT_CHAT_ID,
|
chatId: chatId || DEFAULT_CHAT_ID,
|
||||||
queryId: parseInfo.queryId,
|
queryId: parseInfo.queryId,
|
||||||
parseId: parseInfo.id,
|
parseId: parseInfo.id,
|
||||||
|
|||||||
Reference in New Issue
Block a user