(improvement)(chat-sdk) add agentId to execute api and add PLAIN_TEXT query mode (#1223)

This commit is contained in:
williamhliu
2024-06-25 21:12:18 +08:00
committed by GitHub
parent db9a3fa056
commit 7f91993084
4 changed files with 16 additions and 8 deletions

View File

@@ -96,7 +96,7 @@ const SqlItem: React.FC<Props> = ({
setSqlType(sqlType === 's2SQL' ? '' : 's2SQL');
}}
>
{queryMode === 'LLM_S2SQL' ? 'LLM' : 'Rule'}S2SQL
{queryMode === 'LLM_S2SQL' || queryMode === 'PLAIN_TEXT' ? 'LLM' : 'Rule'}S2SQL
</div>
)}
{sqlInfo.correctS2SQL && (

View File

@@ -123,7 +123,7 @@ const ChatItem: React.FC<Props> = ({
setExecuteLoading(true);
}
try {
const res: any = await chatExecute(msg, conversationId!, parseInfoValue);
const res: any = await chatExecute(msg, conversationId!, parseInfoValue, agentId);
const valid = updateData(res);
onMsgDataLoaded?.(
{

View File

@@ -86,11 +86,13 @@ const ChatMsg: React.FC<Props> = ({
const isMetricCard = (queryMode.includes('METRIC') || isDslMetricCard) && singleData;
const isText =
columns.length === 1 &&
columns[0].showType === 'CATEGORY' &&
((!queryMode.includes('METRIC') && !queryMode.includes('ENTITY')) ||
queryMode === 'METRIC_INTERPRET') &&
singleData;
queryMode === 'PLAIN_TEXT' ||
(columns.length === 1 &&
columns[0].showType === 'CATEGORY' &&
((!queryMode.includes('METRIC') && !queryMode.includes('ENTITY')) ||
queryMode === 'METRIC_INTERPRET') &&
singleData);
if (isText) {
return MsgContentTypeEnum.TEXT;
}

View File

@@ -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`, {
queryText,
agentId,
chatId: chatId || DEFAULT_CHAT_ID,
queryId: parseInfo.queryId,
parseId: parseInfo.id,