This commit is contained in:
archer
2023-07-18 16:26:57 +08:00
parent 2330186a09
commit a993eba7f0
13 changed files with 45 additions and 42 deletions

View File

@@ -3,7 +3,7 @@ import type { NextApiRequest, NextApiResponse } from 'next';
import { jsonRes } from '@/service/response';
import { authUser, getSystemOpenAiKey } from '@/service/utils/auth';
import axios from 'axios';
import { axiosConfig } from '@/service/utils/tools';
import { axiosConfig } from '@/service/ai/openai';
export type Props = {
input: string;
@@ -33,7 +33,7 @@ export async function sensitiveCheck({ input }: Props) {
}
const response = await axios({
...axiosConfig(getSystemOpenAiKey()),
...axiosConfig(),
method: 'POST',
url: `/moderations`,
data: {

View File

@@ -17,6 +17,7 @@ export async function updateSystemEnv() {
...global.systemEnv,
...res
};
console.log(global.systemEnv);
} catch (error) {
console.log('update system env error');
}

View File

@@ -29,7 +29,7 @@ const AppDetail = ({ currentTab }: { currentTab: `${TabEnum}` }) => {
const router = useRouter();
const theme = useTheme();
const { appId } = router.query as { appId: string };
const { appDetail = defaultApp } = useUserStore();
const { appDetail = defaultApp, clearAppModules } = useUserStore();
const setCurrentTab = useCallback(
(tab: `${TabEnum}`) => {
@@ -53,16 +53,17 @@ const AppDetail = ({ currentTab }: { currentTab: `${TabEnum}` }) => {
[]
);
// useEffect(() => {
// window.onbeforeunload = (e) => {
// e.preventDefault();
// e.returnValue = '内容已修改,确认离开页面吗?';
// };
useEffect(() => {
window.onbeforeunload = (e) => {
e.preventDefault();
e.returnValue = '内容已修改,确认离开页面吗?';
};
// return () => {
// window.onbeforeunload = null;
// };
// }, []);
return () => {
window.onbeforeunload = null;
clearAppModules();
};
}, []);
return (
<PageContainer>

View File

@@ -97,7 +97,6 @@ const QAImport = ({ kbId }: { kbId: string }) => {
}
return '';
})();
console.log(extension, text, '=====', icon);
if (icon && text) {
const splitRes = splitText_token({

View File

@@ -8,7 +8,7 @@ import type { ResLogin } from '@/api/response/user';
import { useToast } from '@/hooks/useToast';
import { useRouter } from 'next/router';
import { postCreateApp } from '@/api/app';
import { chatAppDemo } from '@/constants/app';
import { appTemplates } from '@/constants/flow/ModuleTemplate';
interface Props {
loginSuccess: (e: ResLogin) => void;
@@ -65,9 +65,12 @@ const RegisterForm = ({ setPageType, loginSuccess }: Props) => {
status: 'success'
});
// aut register a model
postCreateApp({
name: '应用1',
modules: chatAppDemo.modules
appTemplates.forEach((template) => {
postCreateApp({
avatar: template.avatar,
name: template.name,
modules: template.modules
});
});
} catch (error: any) {
toast({