mirror of
https://github.com/labring/FastGPT.git
synced 2025-07-24 22:03:54 +00:00
Dir tree doc and move some code (#1466)
* tree doc and move some code * fix: ts
This commit is contained in:
@@ -133,3 +133,57 @@ FastGPT 在`pnpm i`后会执行`postinstall`脚本,用于自动生成`ChakraUI
|
||||
遇到困难了吗?有任何问题吗? 加入微信群与开发者和用户保持沟通。
|
||||
|
||||
<img width="400px" src="https://oss.laf.run/htr4n1-images/fastgpt-qr-code.jpg" class="medium-zoom-image" />
|
||||
|
||||
## 代码结构说明
|
||||
|
||||
### nextjs
|
||||
|
||||
FastGPT 使用了 nextjs 的 page route 作为框架。为了区分好前后端代码,在目录分配上会分成 global, service, web 3个自目录,分别对应着 `前后端共用`、`后端专用`、`前端专用`的代码。
|
||||
|
||||
### monorepo
|
||||
FastGPT 才用 pnpm workspace 方式构建 monorepo 项目,主要分为两个部分:
|
||||
|
||||
- projects/app - FastGPT 主项目
|
||||
- packages/ - 子模块
|
||||
- global - 共用代码,通常是放一些前后端都能执行的函数、类型声明、常量。
|
||||
- service - 服务端代码
|
||||
- web - 前端代码
|
||||
- plugin - 工作流自定义插件的代码
|
||||
|
||||
### 领域驱动模式(DDD)
|
||||
|
||||
FastGPT 在代码模块划分时,按DDD的思想进行划分,主要分为以下几个领域:
|
||||
|
||||
core - 核心功能(知识库,工作流,应用,对话)
|
||||
support - 支撑功能(用户体系,计费,鉴权等)
|
||||
common - 基础功能(日志管理,文件读写等)
|
||||
|
||||
{{% details title="代码结构说明" closed="true" %}}
|
||||
```
|
||||
.
|
||||
├── .github // github 相关配置
|
||||
├── .husky // 格式化配置
|
||||
├── docSite // 文档
|
||||
├── files // 一些外部文件,例如 docker-compose, helm
|
||||
├── packages // 子包
|
||||
│ ├── global // 前后端通用子包
|
||||
│ ├── plugins // 工作流插件(需要自定义包时候使用到)
|
||||
│ ├── service // 后端子包
|
||||
│ └── web // 前端子包
|
||||
├── projects
|
||||
│ └── app // FastGPT 主项目
|
||||
├── python // 存放一些模型代码,和 FastGPT 本身无关
|
||||
└── scripts // 一些自动化脚本
|
||||
├── icon // icon预览脚本,可以在顶层 pnpm initIcon(把svg写入到代码中), pnpm previewIcon(预览icon)
|
||||
└── postinstall.sh // chakraUI自定义theme初始化 ts 类型
|
||||
├── package.json // 顶层monorepo
|
||||
├── pnpm-lock.yaml
|
||||
├── pnpm-workspace.yaml // monorepo 声明
|
||||
├── Dockerfile
|
||||
├── LICENSE
|
||||
├── README.md
|
||||
├── README_en.md
|
||||
├── README_ja.md
|
||||
├── dev.md
|
||||
```
|
||||
{{% /details %}}
|
||||
|
@@ -6,6 +6,42 @@ export const formatTime2YMDHM = (time?: Date) =>
|
||||
export const formatTime2YMD = (time?: Date) => (time ? dayjs(time).format('YYYY-MM-DD') : '');
|
||||
export const formatTime2HM = (time: Date = new Date()) => dayjs(time).format('HH:mm');
|
||||
|
||||
/**
|
||||
* 格式化时间成聊天格式
|
||||
*/
|
||||
export const formatTimeToChatTime = (time: Date) => {
|
||||
const now = dayjs();
|
||||
const target = dayjs(time);
|
||||
|
||||
// 如果传入时间小于60秒,返回刚刚
|
||||
if (now.diff(target, 'second') < 60) {
|
||||
return '刚刚';
|
||||
}
|
||||
|
||||
// 如果时间是今天,展示几时:几分
|
||||
if (now.isSame(target, 'day')) {
|
||||
return target.format('HH:mm');
|
||||
}
|
||||
|
||||
// 如果是昨天,展示昨天
|
||||
if (now.subtract(1, 'day').isSame(target, 'day')) {
|
||||
return '昨天';
|
||||
}
|
||||
|
||||
// 如果是前天,展示前天
|
||||
if (now.subtract(2, 'day').isSame(target, 'day')) {
|
||||
return '前天';
|
||||
}
|
||||
|
||||
// 如果是今年,展示某月某日
|
||||
if (now.isSame(target, 'year')) {
|
||||
return target.format('MM/DD');
|
||||
}
|
||||
|
||||
// 如果是更久之前,展示某年某月某日
|
||||
return target.format('YYYY/M/D');
|
||||
};
|
||||
|
||||
/* cron time parse */
|
||||
export const cronParser2Fields = (cronString: string) => {
|
||||
try {
|
||||
|
@@ -1 +0,0 @@
|
||||
82dc3f099ca89165c3415d2ba96d195d3a1805b98373e8eb3d814b6994e62489
|
@@ -1,23 +0,0 @@
|
||||
{
|
||||
"$schema": "https://inlang.com/schema/project-settings",
|
||||
"sourceLanguageTag": "en",
|
||||
"languageTags": [
|
||||
"en",
|
||||
"zh"
|
||||
],
|
||||
"modules": [
|
||||
"https://cdn.jsdelivr.net/npm/@inlang/plugin-i18next@4/dist/index.js",
|
||||
"https://cdn.jsdelivr.net/npm/@inlang/message-lint-rule-empty-pattern@1/dist/index.js",
|
||||
"https://cdn.jsdelivr.net/npm/@inlang/message-lint-rule-identical-pattern@1/dist/index.js",
|
||||
"https://cdn.jsdelivr.net/npm/@inlang/message-lint-rule-without-source@1/dist/index.js",
|
||||
"https://cdn.jsdelivr.net/npm/@inlang/message-lint-rule-missing-translation@1/dist/index.js"
|
||||
],
|
||||
"plugin.inlang.i18next": {
|
||||
"pathPattern": {
|
||||
"common": "./projects/app/i18n/{languageTag}/common.json"
|
||||
},
|
||||
"variableReferencePattern": [
|
||||
"{{", "}}"
|
||||
]
|
||||
}
|
||||
}
|
@@ -1,7 +1,7 @@
|
||||
import { ExportChatType } from '@/types/chat';
|
||||
import { ChatItemType } from '@fastgpt/global/core/chat/type';
|
||||
import { useCallback } from 'react';
|
||||
import { htmlTemplate } from '@/constants/common';
|
||||
import { htmlTemplate } from '@/web/core/chat/constants';
|
||||
import { fileDownload } from '@/web/common/file/utils';
|
||||
|
||||
export const useChatBox = () => {
|
||||
|
@@ -4,7 +4,7 @@ import { QuestionOutlineIcon } from '@chakra-ui/icons';
|
||||
import { Box, Button, Flex, ModalBody, useDisclosure, Image } from '@chakra-ui/react';
|
||||
import React, { useCallback, useMemo } from 'react';
|
||||
import { useTranslation } from 'next-i18next';
|
||||
import { TTSTypeEnum } from '@/constants/app';
|
||||
import { TTSTypeEnum } from '@/web/core/app/constants';
|
||||
import type { AppTTSConfigType } from '@fastgpt/global/core/app/type.d';
|
||||
import { useAudioPlay } from '@/web/common/utils/voice';
|
||||
import { useSystemStore } from '@/web/common/system/useSystemStore';
|
||||
|
@@ -11,7 +11,7 @@ import TTSSelect from '@/components/core/app/TTSSelect';
|
||||
import WhisperConfig from '@/components/core/app/WhisperConfig';
|
||||
import { splitGuideModule } from '@fastgpt/global/core/workflow/utils';
|
||||
import { useTranslation } from 'next-i18next';
|
||||
import { TTSTypeEnum } from '@/constants/app';
|
||||
import { TTSTypeEnum } from '@/web/core/app/constants';
|
||||
import MyIcon from '@fastgpt/web/components/common/Icon';
|
||||
import MyTooltip from '@/components/MyTooltip';
|
||||
import NodeCard from './render/NodeCard';
|
||||
|
@@ -1,56 +0,0 @@
|
||||
import { defaultQAModels, defaultVectorModels } from '@fastgpt/global/core/ai/model';
|
||||
import type {
|
||||
DatasetCollectionItemType,
|
||||
DatasetItemType
|
||||
} from '@fastgpt/global/core/dataset/type.d';
|
||||
|
||||
export const defaultDatasetDetail: DatasetItemType = {
|
||||
_id: '',
|
||||
parentId: '',
|
||||
userId: '',
|
||||
teamId: '',
|
||||
tmbId: '',
|
||||
updateTime: new Date(),
|
||||
type: 'dataset',
|
||||
avatar: '/icon/logo.svg',
|
||||
name: '',
|
||||
intro: '',
|
||||
status: 'active',
|
||||
permission: 'private',
|
||||
isOwner: false,
|
||||
canWrite: false,
|
||||
vectorModel: defaultVectorModels[0],
|
||||
agentModel: defaultQAModels[0]
|
||||
};
|
||||
|
||||
export const defaultCollectionDetail: DatasetCollectionItemType = {
|
||||
_id: '',
|
||||
teamId: '',
|
||||
tmbId: '',
|
||||
datasetId: {
|
||||
_id: '',
|
||||
parentId: '',
|
||||
userId: '',
|
||||
teamId: '',
|
||||
tmbId: '',
|
||||
updateTime: new Date(),
|
||||
type: 'dataset',
|
||||
avatar: '/icon/logo.svg',
|
||||
name: '',
|
||||
intro: '',
|
||||
status: 'active',
|
||||
permission: 'private',
|
||||
vectorModel: defaultVectorModels[0].model,
|
||||
agentModel: defaultQAModels[0].model
|
||||
},
|
||||
parentId: '',
|
||||
name: '',
|
||||
type: 'file',
|
||||
updateTime: new Date(),
|
||||
canWrite: false,
|
||||
sourceName: '',
|
||||
sourceId: '',
|
||||
createTime: new Date(),
|
||||
trainingType: 'chunk',
|
||||
chunkSize: 0
|
||||
};
|
@@ -3,6 +3,7 @@ import { useRouter } from 'next/router';
|
||||
import { serviceSideProps } from '@/web/common/utils/i18n';
|
||||
import { useSystemStore } from '@/web/common/system/useSystemStore';
|
||||
import { Box } from '@chakra-ui/react';
|
||||
import { TrackEventName } from '@/web/common/system/constants';
|
||||
|
||||
function Error() {
|
||||
const router = useRouter();
|
||||
@@ -10,7 +11,7 @@ function Error() {
|
||||
|
||||
useEffect(() => {
|
||||
setTimeout(() => {
|
||||
window.umami?.track('pageError', {
|
||||
window.umami?.track(TrackEventName.pageError, {
|
||||
userAgent: navigator.userAgent,
|
||||
platform: navigator.platform,
|
||||
appName: navigator.appName,
|
||||
|
@@ -2,7 +2,7 @@ import React from 'react';
|
||||
import { Box, Button, Flex, useTheme } from '@chakra-ui/react';
|
||||
import { getInforms, readInform } from '@/web/support/user/inform/api';
|
||||
import type { UserInformSchema } from '@fastgpt/global/support/user/inform/type';
|
||||
import { formatTimeToChatTime } from '@/utils/tools';
|
||||
import { formatTimeToChatTime } from '@fastgpt/global/common/string/time';
|
||||
import { useSystemStore } from '@/web/common/system/useSystemStore';
|
||||
import MyIcon from '@fastgpt/web/components/common/Icon';
|
||||
import { usePagination } from '@fastgpt/web/hooks/usePagination';
|
||||
|
@@ -15,9 +15,9 @@ import MyIcon from '@fastgpt/web/components/common/Icon';
|
||||
import { useLoading } from '@fastgpt/web/hooks/useLoading';
|
||||
import { useQuery } from '@tanstack/react-query';
|
||||
import { getShareChatList, delShareChatById } from '@/web/support/outLink/api';
|
||||
import { formatTimeToChatTime } from '@/utils/tools';
|
||||
import { formatTimeToChatTime } from '@fastgpt/global/common/string/time';
|
||||
import { useCopyData } from '@/web/common/hooks/useCopyData';
|
||||
import { defaultFeishuOutLinkForm } from '@/constants/app';
|
||||
import { defaultFeishuOutLinkForm } from '@/web/core/app/constants';
|
||||
import type { FeishuType, OutLinkEditType } from '@fastgpt/global/support/outLink/type.d';
|
||||
import { PublishChannelEnum } from '@fastgpt/global/support/outLink/constant';
|
||||
import { useTranslation } from 'next-i18next';
|
||||
|
@@ -27,10 +27,10 @@ import {
|
||||
createShareChat,
|
||||
putShareChat
|
||||
} from '@/web/support/outLink/api';
|
||||
import { formatTimeToChatTime } from '@/utils/tools';
|
||||
import { formatTimeToChatTime } from '@fastgpt/global/common/string/time';
|
||||
import { useCopyData } from '@/web/common/hooks/useCopyData';
|
||||
import { useForm } from 'react-hook-form';
|
||||
import { defaultOutLinkForm } from '@/constants/app';
|
||||
import { defaultOutLinkForm } from '@/web/core/app/constants';
|
||||
import type { OutLinkEditType, OutLinkSchema } from '@fastgpt/global/support/outLink/type.d';
|
||||
import { useRequest } from '@/web/common/hooks/useRequest';
|
||||
import { PublishChannelEnum } from '@fastgpt/global/support/outLink/constant';
|
||||
|
@@ -26,7 +26,7 @@ import SearchParamsTip from '@/components/core/dataset/SearchParamsTip';
|
||||
import SettingLLMModel from '@/components/core/ai/SettingLLMModel';
|
||||
import type { SettingAIDataType } from '@fastgpt/global/core/app/type.d';
|
||||
import DeleteIcon, { hoverDeleteStyles } from '@fastgpt/web/components/common/Icon/delete';
|
||||
import { TTSTypeEnum } from '@/constants/app';
|
||||
import { TTSTypeEnum } from '@/web/core/app/constants';
|
||||
import { getSystemVariables } from '@/web/core/app/utils';
|
||||
import { useUpdate } from 'ahooks';
|
||||
import { useI18n } from '@/web/context/I18n';
|
||||
|
@@ -20,7 +20,7 @@ import { getDefaultIndex } from '@fastgpt/global/core/dataset/utils';
|
||||
import { DatasetDataIndexItemType } from '@fastgpt/global/core/dataset/type';
|
||||
import SideTabs from '@/components/SideTabs';
|
||||
import DeleteIcon from '@fastgpt/web/components/common/Icon/delete';
|
||||
import { defaultCollectionDetail } from '@/constants/dataset';
|
||||
import { defaultCollectionDetail } from '@/web/core/dataset/constants';
|
||||
import { getDocPath } from '@/web/common/system/doc';
|
||||
import RawSourceBox from '@/components/core/dataset/RawSourceBox';
|
||||
import MyBox from '@fastgpt/web/components/common/MyBox';
|
||||
|
@@ -5,7 +5,7 @@ import { useSearchTestStore, SearchTestStoreItemType } from '@/web/core/dataset/
|
||||
import { postSearchText } from '@/web/core/dataset/api';
|
||||
import MyIcon from '@fastgpt/web/components/common/Icon';
|
||||
import { useRequest } from '@fastgpt/web/hooks/useRequest';
|
||||
import { formatTimeToChatTime } from '@/utils/tools';
|
||||
import { formatTimeToChatTime } from '@fastgpt/global/common/string/time';
|
||||
import { getErrText } from '@fastgpt/global/common/error/utils';
|
||||
import { useToast } from '@fastgpt/web/hooks/useToast';
|
||||
import { customAlphabet } from 'nanoid';
|
||||
|
@@ -1,7 +1,7 @@
|
||||
import React, { useState, Dispatch, useCallback } from 'react';
|
||||
import { FormControl, Box, Input, Button } from '@chakra-ui/react';
|
||||
import { useForm } from 'react-hook-form';
|
||||
import { LoginPageTypeEnum } from '@/constants/user';
|
||||
import { LoginPageTypeEnum } from '@/web/support/user/login/constants';
|
||||
import { postFindPassword } from '@/web/support/user/api';
|
||||
import { useSendCode } from '@/web/support/user/hooks/useSendCode';
|
||||
import type { ResLogin } from '@/global/support/api/userRes.d';
|
||||
|
@@ -1,7 +1,7 @@
|
||||
import React, { useState, Dispatch, useCallback } from 'react';
|
||||
import { FormControl, Flex, Input, Button, Box, Link } from '@chakra-ui/react';
|
||||
import { useForm } from 'react-hook-form';
|
||||
import { LoginPageTypeEnum } from '@/constants/user';
|
||||
import { LoginPageTypeEnum } from '@/web/support/user/login/constants';
|
||||
import { postLogin } from '@/web/support/user/api';
|
||||
import type { ResLogin } from '@/global/support/api/userRes';
|
||||
import { useToast } from '@fastgpt/web/hooks/useToast';
|
||||
|
@@ -1,5 +1,5 @@
|
||||
import React, { Dispatch } from 'react';
|
||||
import { LoginPageTypeEnum } from '@/constants/user';
|
||||
import { LoginPageTypeEnum } from '@/web/support/user/login/constants';
|
||||
import type { ResLogin } from '@/global/support/api/userRes';
|
||||
import { Box, Center, Image } from '@chakra-ui/react';
|
||||
import { useQuery } from '@tanstack/react-query';
|
||||
|
@@ -1,4 +1,4 @@
|
||||
import { LoginPageTypeEnum } from '@/constants/user';
|
||||
import { LoginPageTypeEnum } from '@/web/support/user/login/constants';
|
||||
import { useSystemStore } from '@/web/common/system/useSystemStore';
|
||||
import { AbsoluteCenter, Box, Button, Flex, Image } from '@chakra-ui/react';
|
||||
import { LOGO_ICON } from '@fastgpt/global/common/system/constants';
|
||||
|
@@ -1,7 +1,7 @@
|
||||
import React, { useState, Dispatch, useCallback } from 'react';
|
||||
import { FormControl, Box, Input, Button } from '@chakra-ui/react';
|
||||
import { useForm } from 'react-hook-form';
|
||||
import { LoginPageTypeEnum } from '@/constants/user';
|
||||
import { LoginPageTypeEnum } from '@/web/support/user/login/constants';
|
||||
import { postRegister } from '@/web/support/user/api';
|
||||
import { useSendCode } from '@/web/support/user/hooks/useSendCode';
|
||||
import type { ResLogin } from '@/global/support/api/userRes';
|
||||
|
@@ -1,6 +1,6 @@
|
||||
import React, { useState, useCallback, useEffect } from 'react';
|
||||
import { Box, Center, Flex, useDisclosure } from '@chakra-ui/react';
|
||||
import { LoginPageTypeEnum } from '@/constants/user';
|
||||
import { LoginPageTypeEnum } from '@/web/support/user/login/constants';
|
||||
import { useSystemStore } from '@/web/common/system/useSystemStore';
|
||||
import type { ResLogin } from '@/global/support/api/userRes.d';
|
||||
import { useRouter } from 'next/router';
|
||||
|
4
projects/app/src/types/index.d.ts
vendored
4
projects/app/src/types/index.d.ts
vendored
@@ -7,7 +7,7 @@ import {
|
||||
VectorModelItemType,
|
||||
WhisperModelType
|
||||
} from '@fastgpt/global/core/ai/model.d';
|
||||
import { TrackEventName } from '@/constants/common';
|
||||
import { TrackEventName } from '@/web/common/system/constants';
|
||||
import { SubPlanType } from '@fastgpt/global/support/wallet/sub/type';
|
||||
|
||||
export type PagingData<T> = {
|
||||
@@ -31,7 +31,7 @@ declare global {
|
||||
grecaptcha: any;
|
||||
QRCode: any;
|
||||
umami?: {
|
||||
track: (event: `${TrackEventName}`, data: any) => void;
|
||||
track: (event: TrackEventName, data: any) => void;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@@ -1,81 +0,0 @@
|
||||
import dayjs from 'dayjs';
|
||||
|
||||
/**
|
||||
* 对象转成 query 字符串
|
||||
*/
|
||||
export const Obj2Query = (obj: Record<string, string | number>) => {
|
||||
const queryParams = new URLSearchParams();
|
||||
for (const key in obj) {
|
||||
queryParams.append(key, `${obj[key]}`);
|
||||
}
|
||||
return queryParams.toString();
|
||||
};
|
||||
|
||||
/**
|
||||
* parse string to query object
|
||||
*/
|
||||
export const parseQueryString = (str: string) => {
|
||||
const queryObject: Record<string, any> = {};
|
||||
|
||||
const splitStr = str.split('?');
|
||||
|
||||
str = splitStr[1] || splitStr[0];
|
||||
|
||||
// 将字符串按照 '&' 分割成键值对数组
|
||||
const keyValuePairs = str.split('&');
|
||||
|
||||
// 遍历键值对数组,将每个键值对解析为对象的属性和值
|
||||
keyValuePairs.forEach(function (keyValuePair) {
|
||||
const pair = keyValuePair.split('=');
|
||||
const key = decodeURIComponent(pair[0]);
|
||||
const value = decodeURIComponent(pair[1] || '');
|
||||
|
||||
// 如果对象中已经存在该属性,则将值转换为数组
|
||||
if (queryObject.hasOwnProperty(key)) {
|
||||
if (!Array.isArray(queryObject[key])) {
|
||||
queryObject[key] = [queryObject[key]];
|
||||
}
|
||||
queryObject[key].push(value);
|
||||
} else {
|
||||
queryObject[key] = value;
|
||||
}
|
||||
});
|
||||
|
||||
return queryObject;
|
||||
};
|
||||
|
||||
/**
|
||||
* 格式化时间成聊天格式
|
||||
*/
|
||||
export const formatTimeToChatTime = (time: Date) => {
|
||||
const now = dayjs();
|
||||
const target = dayjs(time);
|
||||
|
||||
// 如果传入时间小于60秒,返回刚刚
|
||||
if (now.diff(target, 'second') < 60) {
|
||||
return '刚刚';
|
||||
}
|
||||
|
||||
// 如果时间是今天,展示几时:几分
|
||||
if (now.isSame(target, 'day')) {
|
||||
return target.format('HH:mm');
|
||||
}
|
||||
|
||||
// 如果是昨天,展示昨天
|
||||
if (now.subtract(1, 'day').isSame(target, 'day')) {
|
||||
return '昨天';
|
||||
}
|
||||
|
||||
// 如果是前天,展示前天
|
||||
if (now.subtract(2, 'day').isSame(target, 'day')) {
|
||||
return '前天';
|
||||
}
|
||||
|
||||
// 如果是今年,展示某月某日
|
||||
if (now.isSame(target, 'year')) {
|
||||
return target.format('MM/DD');
|
||||
}
|
||||
|
||||
// 如果是更久之前,展示某年某月某日
|
||||
return target.format('YYYY/M/D');
|
||||
};
|
5
projects/app/src/web/common/system/constants.ts
Normal file
5
projects/app/src/web/common/system/constants.ts
Normal file
@@ -0,0 +1,5 @@
|
||||
export enum TrackEventName {
|
||||
windowError = 'windowError',
|
||||
pageError = 'pageError',
|
||||
wordReadError = 'wordReadError'
|
||||
}
|
@@ -2,7 +2,7 @@ import { useState, useCallback, useEffect, useMemo, useRef } from 'react';
|
||||
import { useToast } from '@fastgpt/web/hooks/useToast';
|
||||
import { getErrText } from '@fastgpt/global/common/error/utils';
|
||||
import type { AppTTSConfigType } from '@fastgpt/global/core/app/type.d';
|
||||
import { TTSTypeEnum } from '@/constants/app';
|
||||
import { TTSTypeEnum } from '@/web/core/app/constants';
|
||||
import { useTranslation } from 'next-i18next';
|
||||
import type { OutLinkChatAuthProps } from '@fastgpt/global/support/permission/chat.d';
|
||||
import { getToken } from '@/web/support/user/auth';
|
||||
|
@@ -6,6 +6,7 @@ import { useSystemStore } from '@/web/common/system/useSystemStore';
|
||||
import type { FastGPTFeConfigsType } from '@fastgpt/global/common/system/types/index.d';
|
||||
import { change2DefaultLng, setLngStore } from '@/web/common/utils/i18n';
|
||||
import { useMemoizedFn, useMount } from 'ahooks';
|
||||
import { TrackEventName } from '../common/system/constants';
|
||||
|
||||
export const useInitApp = () => {
|
||||
const router = useRouter();
|
||||
@@ -52,7 +53,7 @@ export const useInitApp = () => {
|
||||
initUserLanguage();
|
||||
|
||||
const errorTrack = (event: ErrorEvent) => {
|
||||
window.umami?.track('windowError', {
|
||||
window.umami?.track(TrackEventName.windowError, {
|
||||
device: {
|
||||
userAgent: navigator.userAgent,
|
||||
platform: navigator.platform,
|
||||
|
@@ -2,7 +2,7 @@ import { create } from 'zustand';
|
||||
import { devtools, persist } from 'zustand/middleware';
|
||||
import { immer } from 'zustand/middleware/immer';
|
||||
import { getMyApps, getModelById, putAppById } from '@/web/core/app/api';
|
||||
import { defaultApp } from '@/constants/app';
|
||||
import { defaultApp } from '../constants';
|
||||
import type { AppUpdateParams } from '@/global/core/app/api.d';
|
||||
import { AppDetailType, AppListItemType } from '@fastgpt/global/core/app/type.d';
|
||||
import { PostPublishAppProps } from '@/global/core/app/api';
|
||||
|
@@ -1,9 +1,3 @@
|
||||
export enum TrackEventName {
|
||||
windowError = 'windowError',
|
||||
pageError = 'pageError',
|
||||
wordReadError = 'wordReadError'
|
||||
}
|
||||
|
||||
export const htmlTemplate = `<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
@@ -1,3 +1,60 @@
|
||||
import { defaultQAModels, defaultVectorModels } from '@fastgpt/global/core/ai/model';
|
||||
import type {
|
||||
DatasetCollectionItemType,
|
||||
DatasetItemType
|
||||
} from '@fastgpt/global/core/dataset/type.d';
|
||||
|
||||
export const defaultDatasetDetail: DatasetItemType = {
|
||||
_id: '',
|
||||
parentId: '',
|
||||
userId: '',
|
||||
teamId: '',
|
||||
tmbId: '',
|
||||
updateTime: new Date(),
|
||||
type: 'dataset',
|
||||
avatar: '/icon/logo.svg',
|
||||
name: '',
|
||||
intro: '',
|
||||
status: 'active',
|
||||
permission: 'private',
|
||||
isOwner: false,
|
||||
canWrite: false,
|
||||
vectorModel: defaultVectorModels[0],
|
||||
agentModel: defaultQAModels[0]
|
||||
};
|
||||
|
||||
export const defaultCollectionDetail: DatasetCollectionItemType = {
|
||||
_id: '',
|
||||
teamId: '',
|
||||
tmbId: '',
|
||||
datasetId: {
|
||||
_id: '',
|
||||
parentId: '',
|
||||
userId: '',
|
||||
teamId: '',
|
||||
tmbId: '',
|
||||
updateTime: new Date(),
|
||||
type: 'dataset',
|
||||
avatar: '/icon/logo.svg',
|
||||
name: '',
|
||||
intro: '',
|
||||
status: 'active',
|
||||
permission: 'private',
|
||||
vectorModel: defaultVectorModels[0].model,
|
||||
agentModel: defaultQAModels[0].model
|
||||
},
|
||||
parentId: '',
|
||||
name: '',
|
||||
type: 'file',
|
||||
updateTime: new Date(),
|
||||
canWrite: false,
|
||||
sourceName: '',
|
||||
sourceId: '',
|
||||
createTime: new Date(),
|
||||
trainingType: 'chunk',
|
||||
chunkSize: 0
|
||||
};
|
||||
|
||||
export enum ImportProcessWayEnum {
|
||||
auto = 'auto',
|
||||
custom = 'custom'
|
||||
|
@@ -9,7 +9,7 @@ import {
|
||||
putDatasetById,
|
||||
postWebsiteSync
|
||||
} from '@/web/core/dataset/api';
|
||||
import { defaultDatasetDetail } from '@/constants/dataset';
|
||||
import { defaultDatasetDetail } from '../constants';
|
||||
import type { DatasetUpdateBody } from '@fastgpt/global/core/dataset/api.d';
|
||||
import { DatasetStatusEnum } from '@fastgpt/global/core/dataset/constants';
|
||||
import { postCreateTrainingUsage } from '@/web/support/wallet/usage/api';
|
||||
|
@@ -4,8 +4,3 @@ export enum LoginPageTypeEnum {
|
||||
forgetPassword = 'forgetPassword',
|
||||
wechat = 'wechat'
|
||||
}
|
||||
|
||||
export enum PromotionEnum {
|
||||
register = 'register',
|
||||
pay = 'pay'
|
||||
}
|
Reference in New Issue
Block a user