websoft-uniapp仓库模板
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

30 lines
773 B

import request from '@/utils/request';
import type { ApiResult } from '@/api';
import { ChatParam } from '@/api/oa/chatgpt/model';
/**
* 发送
*/
export async function send(data: ChatParam) {
const res = await request.post<ApiResult<unknown>>('/open/chat/send', data);
if (res.data.code === 0) {
return res.data.data;
}
return Promise.reject(new Error(res.data.message));
}
/**
* 请求openAI
* /open/chat/chat
* 'https://chatgpt.websoft.top/api/open/chat/chat',
*/
export async function chat(data: ChatParam) {
const res = await request.post<ApiResult<unknown>>(
'https://chatgpt.websoft.top/api/open/chat/chat',
data
);
if (res.data.code === 0) {
return res.data.message;
}
return Promise.reject(new Error(res.data.message));
}