@lobehub/chat
Version:
Lobe Chat - an open-source, high-performance chatbot framework that supports speech synthesis, multimodal, and extensible Function Call plugin system. Supports one-click free deployment of your private ChatGPT/LLM web application.
37 lines (31 loc) • 1.17 kB
text/typescript
import { SendMessageServerParams, StructureOutputParams } from '@lobechat/types';
import { cleanObject } from '@lobechat/utils';
import { lambdaClient } from '@/libs/trpc/client';
import { createXorKeyVaultsPayload } from '@/services/_auth';
class AiChatService {
sendMessageInServer = async (
params: SendMessageServerParams,
abortController: AbortController,
) => {
return lambdaClient.aiChat.sendMessageInServer.mutate(cleanObject(params), {
context: { showNotification: false },
signal: abortController?.signal,
});
};
generateJSON = async (
params: Omit<StructureOutputParams, 'keyVaultsPayload'>,
abortController: AbortController,
) => {
return lambdaClient.aiChat.outputJSON.mutate(
{ ...params, keyVaultsPayload: createXorKeyVaultsPayload(params.provider) },
{
context: { showNotification: false },
signal: abortController?.signal,
},
);
};
// sendGroupMessageInServer = async (params: SendMessageServerParams) => {
// return lambdaClient.aiChat.sendGroupMessageInServer.mutate(cleanObject(params));
// };
}
export const aiChatService = new AiChatService();