perf: prompt and gpt4

This commit is contained in:
archer
2023-05-10 12:03:54 +08:00
parent e3c9b8179e
commit cdf4b9f324
12 changed files with 47 additions and 24 deletions

View File

@@ -68,11 +68,11 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse)
return res.send(searchPrompts[0]?.value);
}
prompts.splice(prompts.length - 1, 0, ...searchPrompts);
prompts.splice(prompts.length - 3, 0, ...searchPrompts);
} else {
// 没有用知识库搜索,仅用系统提示词
model.chat.systemPrompt &&
prompts.splice(prompts.length - 1, 0, {
prompts.splice(prompts.length - 3, 0, {
obj: ChatRoleEnum.System,
value: model.chat.systemPrompt
});

View File

@@ -0,0 +1,16 @@
// Next.js API route support: https://nextjs.org/docs/api-routes/introduction
import type { NextApiRequest, NextApiResponse } from 'next';
import { jsonRes } from '@/service/response';
import { clearCookie } from '@/service/utils/tools';
export default async function handler(req: NextApiRequest, res: NextApiResponse<any>) {
try {
clearCookie(res);
jsonRes(res);
} catch (err) {
jsonRes(res, {
code: 500,
error: err
});
}
}

View File

@@ -7,7 +7,7 @@ import { useToast } from '@/hooks/useToast';
import { useGlobalStore } from '@/store/global';
import { useUserStore } from '@/store/user';
import { UserType } from '@/types/user';
import { clearToken } from '@/utils/user';
import { clearCookie } from '@/utils/user';
import { useRouter } from 'next/router';
import { useQuery } from '@tanstack/react-query';
import dynamic from 'next/dynamic';
@@ -75,7 +75,7 @@ const NumberSetting = () => {
);
const onclickLogOut = useCallback(() => {
clearToken();
clearCookie();
setUserInfo(null);
router.replace('/login');
}, [router, setUserInfo]);

View File

@@ -81,7 +81,7 @@ const OpenApi = () => {
mr={4}
variant={'outline'}
onClick={() => {
copyData(`${location.origin}?inviterId=${userInfo?._id}`, '已复制邀请链接');
copyData(`${location.origin}/?inviterId=${userInfo?._id}`, '已复制邀请链接');
}}
>