perf: init chat content.use mongo aggregate

This commit is contained in:
archer
2023-04-24 17:49:39 +08:00
parent 1f112f7715
commit e60c36b423
6 changed files with 49 additions and 57 deletions

View File

@@ -1,5 +1,5 @@
import { GET, POST, DELETE } from './request';
import type { ChatItemType, ChatSiteItemType } from '@/types/chat';
import type { ChatItemType } from '@/types/chat';
import type { InitChatResponse } from './response/chat';
/**
@@ -8,24 +8,6 @@ import type { InitChatResponse } from './response/chat';
export const getInitChatSiteInfo = (modelId: string, chatId: '' | string) =>
GET<InitChatResponse>(`/chat/init?modelId=${modelId}&chatId=${chatId}`);
/**
* 发送 GPT3 prompt
*/
export const postGPT3SendPrompt = ({
chatId,
prompt
}: {
prompt: ChatSiteItemType[];
chatId: string;
}) =>
POST<string>(`/chat/gpt3`, {
chatId,
prompt: prompt.map((item) => ({
obj: item.obj,
value: item.value
}))
});
/**
* 获取历史记录
*/