Fix some bug (#5048)

* fix: chat log time range

* fix: repeat system prompt

* perf: nanoid random

* fix: get files from histories

* fix: ts

* ts config

* perf: search dataset collection
This commit is contained in:
Archer
2025-06-17 16:10:01 +08:00
committed by GitHub
parent 7981b61ca9
commit af3221fa47
21 changed files with 121 additions and 79 deletions

View File

@@ -1,5 +1,5 @@
--- ---
title: 'V4.9.12(进行中)' title: 'V4.9.12'
description: 'FastGPT V4.9.12 更新说明' description: 'FastGPT V4.9.12 更新说明'
icon: 'upgrade' icon: 'upgrade'
draft: false draft: false
@@ -7,6 +7,16 @@ toc: true
weight: 788 weight: 788
--- ---
## 更新指南
### 1. 更新镜像:
- 更新 FastGPT 镜像 tag: v4.9.12
- 更新 FastGPT 商业版镜像 tag: v4.9.12
- mcp_server 无需更新
- Sandbox 无需更新
- 更新 AIProxy 镜像 tag: v0.2.2
## 🚀 新增内容 ## 🚀 新增内容
1. AI proxy 监控完善,支持以图表/表格形式查看模型调用和性能情况。 1. AI proxy 监控完善,支持以图表/表格形式查看模型调用和性能情况。

View File

@@ -0,0 +1,23 @@
---
title: 'V4.9.13(进行中)'
description: 'FastGPT V4.9.13 更新说明'
icon: 'upgrade'
draft: false
toc: true
weight: 787
---
## 🚀 新增内容
## ⚙️ 优化
1. 所有 NodeId 调整随机值生成,避免首字母数字开头。
2. 知识库集合搜索,支持嵌套搜索。
## 🐛 修复
1. 对话日志,日期范围选择问题。
2. API 调用时,传入的 system 提示词可能会重复。
3. AI 对话/工具调用,未选择文件链接时,也会从历史记录读取文件。

View File

@@ -8,12 +8,12 @@ import {
FlowNodeOutputTypeEnum, FlowNodeOutputTypeEnum,
FlowNodeTypeEnum FlowNodeTypeEnum
} from '../../workflow/node/constant'; } from '../../workflow/node/constant';
import { nanoid } from 'nanoid';
import { type McpToolConfigType } from '../type'; import { type McpToolConfigType } from '../type';
import { i18nT } from '../../../../web/i18n/utils'; import { i18nT } from '../../../../web/i18n/utils';
import { type RuntimeNodeItemType } from '../../workflow/runtime/type'; import { type RuntimeNodeItemType } from '../../workflow/runtime/type';
import { type StoreSecretValueType } from '../../../common/secret/type'; import { type StoreSecretValueType } from '../../../common/secret/type';
import { jsonSchema2NodeInput } from '../jsonschema'; import { jsonSchema2NodeInput } from '../jsonschema';
import { getNanoid } from '../../../common/string/tools';
export const getMCPToolSetRuntimeNode = ({ export const getMCPToolSetRuntimeNode = ({
url, url,
@@ -29,7 +29,7 @@ export const getMCPToolSetRuntimeNode = ({
avatar?: string; avatar?: string;
}): RuntimeNodeItemType => { }): RuntimeNodeItemType => {
return { return {
nodeId: nanoid(16), nodeId: getNanoid(16),
flowNodeType: FlowNodeTypeEnum.toolSet, flowNodeType: FlowNodeTypeEnum.toolSet,
avatar, avatar,
intro: 'MCP Tools', intro: 'MCP Tools',
@@ -64,7 +64,7 @@ export const getMCPToolRuntimeNode = ({
avatar?: string; avatar?: string;
}): RuntimeNodeItemType => { }): RuntimeNodeItemType => {
return { return {
nodeId: nanoid(16), nodeId: getNanoid(16),
flowNodeType: FlowNodeTypeEnum.tool, flowNodeType: FlowNodeTypeEnum.tool,
avatar, avatar,
intro: tool.description, intro: tool.description,

View File

@@ -1,10 +1,7 @@
{ {
"extends": "../../tsconfig.json", "extends": "../../tsconfig.json",
"compilerOptions": { "compilerOptions": {
"baseUrl": ".", "baseUrl": "."
"paths": {
"@fastgpt/global/*": ["./*"]
}
}, },
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", "**/*.d.ts"] "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", "**/*.d.ts"]
} }

View File

@@ -14,10 +14,7 @@
"isolatedModules": true, "isolatedModules": true,
"jsx": "preserve", "jsx": "preserve",
"incremental": true, "incremental": true,
"baseUrl": ".", "baseUrl": "."
"paths": {
"@fastgpt/plugins/*": ["./*"]
}
}, },
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", "**/*.d.ts", "../**/*.d.ts"], "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", "**/*.d.ts", "../**/*.d.ts"],
"exclude": ["node_modules"] "exclude": ["node_modules"]

View File

@@ -105,8 +105,9 @@ export const loadRequestMessages = async ({
const arrayContent = content const arrayContent = content
.filter((item) => item.text) .filter((item) => item.text)
.map((item) => ({ ...item, text: addEndpointToImageUrl(item.text) })); .map((item) => addEndpointToImageUrl(item.text))
if (arrayContent.length === 0) return; .join('\n');
return arrayContent; return arrayContent;
}; };
// Parse user content(text and img) Store history => api messages // Parse user content(text and img) Store history => api messages

View File

@@ -42,8 +42,8 @@ type Response = DispatchNodeResultType<{
}>; }>;
export const dispatchRunTools = async (props: DispatchToolModuleProps): Promise<Response> => { export const dispatchRunTools = async (props: DispatchToolModuleProps): Promise<Response> => {
const { let {
node: { nodeId, name, isEntry, version }, node: { nodeId, name, isEntry, version, inputs },
runtimeNodes, runtimeNodes,
runtimeEdges, runtimeEdges,
histories, histories,
@@ -70,6 +70,11 @@ export const dispatchRunTools = async (props: DispatchToolModuleProps): Promise<
props.params.aiChatVision = aiChatVision && toolModel.vision; props.params.aiChatVision = aiChatVision && toolModel.vision;
props.params.aiChatReasoning = aiChatReasoning && toolModel.reasoning; props.params.aiChatReasoning = aiChatReasoning && toolModel.reasoning;
const fileUrlInput = inputs.find((item) => item.key === NodeInputKeyEnum.fileUrlList);
if (!fileUrlInput || !fileUrlInput.value || fileUrlInput.value.length === 0) {
fileLinks = undefined;
}
console.log(fileLinks, 22);
const toolNodeIds = filterToolNodeIdByEdges({ nodeId, edges: runtimeEdges }); const toolNodeIds = filterToolNodeIdByEdges({ nodeId, edges: runtimeEdges });

View File

@@ -13,7 +13,6 @@ import { createChatCompletion } from '../../../ai/config';
import type { import type {
ChatCompletionMessageParam, ChatCompletionMessageParam,
CompletionFinishReason, CompletionFinishReason,
CompletionUsage,
StreamChatType StreamChatType
} from '@fastgpt/global/core/ai/type.d'; } from '@fastgpt/global/core/ai/type.d';
import { formatModelChars2Points } from '../../../../support/wallet/usage/utils'; import { formatModelChars2Points } from '../../../../support/wallet/usage/utils';
@@ -45,7 +44,8 @@ import type { ModuleDispatchProps } from '@fastgpt/global/core/workflow/runtime/
import { responseWriteController } from '../../../../common/response'; import { responseWriteController } from '../../../../common/response';
import { getLLMModel } from '../../../ai/model'; import { getLLMModel } from '../../../ai/model';
import type { SearchDataResponseItemType } from '@fastgpt/global/core/dataset/type'; import type { SearchDataResponseItemType } from '@fastgpt/global/core/dataset/type';
import type { NodeInputKeyEnum, NodeOutputKeyEnum } from '@fastgpt/global/core/workflow/constants'; import type { NodeOutputKeyEnum } from '@fastgpt/global/core/workflow/constants';
import { NodeInputKeyEnum } from '@fastgpt/global/core/workflow/constants';
import { DispatchNodeResponseKeyEnum } from '@fastgpt/global/core/workflow/runtime/constants'; import { DispatchNodeResponseKeyEnum } from '@fastgpt/global/core/workflow/runtime/constants';
import { checkQuoteQAValue, getHistories } from '../utils'; import { checkQuoteQAValue, getHistories } from '../utils';
import { filterSearchResultsByMaxChars } from '../../utils'; import { filterSearchResultsByMaxChars } from '../../utils';
@@ -82,7 +82,7 @@ export const dispatchChatCompletion = async (props: ChatProps): Promise<ChatResp
retainDatasetCite = true, retainDatasetCite = true,
externalProvider, externalProvider,
histories, histories,
node: { name, version }, node: { name, version, inputs },
query, query,
runningUserInfo, runningUserInfo,
workflowStreamResponse, workflowStreamResponse,
@@ -119,6 +119,11 @@ export const dispatchChatCompletion = async (props: ChatProps): Promise<ChatResp
aiChatVision = modelConstantsData.vision && aiChatVision; aiChatVision = modelConstantsData.vision && aiChatVision;
aiChatReasoning = !!aiChatReasoning && !!modelConstantsData.reasoning; aiChatReasoning = !!aiChatReasoning && !!modelConstantsData.reasoning;
// Check fileLinks is reference variable
const fileUrlInput = inputs.find((item) => item.key === NodeInputKeyEnum.fileUrlList);
if (!fileUrlInput || !fileUrlInput.value || fileUrlInput.value.length === 0) {
fileLinks = undefined;
}
const chatHistories = getHistories(history, histories); const chatHistories = getHistories(history, histories);
quoteQA = checkQuoteQAValue(quoteQA); quoteQA = checkQuoteQAValue(quoteQA);

View File

@@ -84,10 +84,12 @@ export const filterToolNodeIdByEdges = ({
export const getHistories = (history?: ChatItemType[] | number, histories: ChatItemType[] = []) => { export const getHistories = (history?: ChatItemType[] | number, histories: ChatItemType[] = []) => {
if (!history) return []; if (!history) return [];
const systemHistories = histories.filter((item) => item.obj === ChatRoleEnum.System); const systemHistoryIndex = histories.findIndex((item) => item.obj !== ChatRoleEnum.System);
const systemHistories = histories.slice(0, systemHistoryIndex);
const chatHistories = histories.slice(systemHistoryIndex);
const filterHistories = (() => { const filterHistories = (() => {
if (typeof history === 'number') return histories.slice(-(history * 2)); if (typeof history === 'number') return chatHistories.slice(-(history * 2));
if (Array.isArray(history)) return history; if (Array.isArray(history)) return history;
return []; return [];
})(); })();

View File

@@ -1,10 +1,7 @@
{ {
"extends": "../../tsconfig.json", "extends": "../../tsconfig.json",
"compilerOptions": { "compilerOptions": {
"baseUrl": ".", "baseUrl": "."
"paths": {
"@fastgpt/servive/*": ["./*"]
}
}, },
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", "**/*.d.ts", "../../**/*.d.ts"] "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", "**/*.d.ts", "../../**/*.d.ts"]
} }

View File

@@ -1,12 +1,17 @@
import React, { useState, useMemo, useRef, useEffect } from 'react'; import React, { useState, useMemo, useRef, useEffect } from 'react';
import { Box, Card, Flex, useTheme, useOutsideClick, Button } from '@chakra-ui/react'; import { Box, Card, Flex, useTheme, useOutsideClick, Button } from '@chakra-ui/react';
import { addDays, format } from 'date-fns'; import { addDays, format } from 'date-fns';
import { type DateRange, DayPicker } from 'react-day-picker'; import { DayPicker } from 'react-day-picker';
import 'react-day-picker/dist/style.css'; import 'react-day-picker/dist/style.css';
import zhCN from 'date-fns/locale/zh-CN'; import zhCN from 'date-fns/locale/zh-CN';
import { useTranslation } from 'next-i18next'; import { useTranslation } from 'next-i18next';
import MyIcon from '../Icon'; import MyIcon from '../Icon';
export type DateRangeType = {
from: Date;
to: Date;
};
const DateRangePicker = ({ const DateRangePicker = ({
onChange, onChange,
onSuccess, onSuccess,
@@ -17,16 +22,16 @@ const DateRangePicker = ({
}, },
dateRange dateRange
}: { }: {
onChange?: (date: DateRange) => void; onChange?: (date: DateRangeType) => void;
onSuccess?: (date: DateRange) => void; onSuccess?: (date: DateRangeType) => void;
position?: 'bottom' | 'top'; position?: 'bottom' | 'top';
defaultDate?: DateRange; defaultDate?: DateRangeType;
dateRange?: DateRange; dateRange?: DateRangeType;
}) => { }) => {
const { t } = useTranslation(); const { t } = useTranslation();
const theme = useTheme(); const theme = useTheme();
const OutRangeRef = useRef(null); const OutRangeRef = useRef(null);
const [range, setRange] = useState<DateRange | undefined>(defaultDate); const [range, setRange] = useState<DateRangeType>(defaultDate);
const [showSelected, setShowSelected] = useState(false); const [showSelected, setShowSelected] = useState(false);
useEffect(() => { useEffect(() => {
@@ -87,28 +92,30 @@ const DateRangePicker = ({
defaultMonth={defaultDate.to} defaultMonth={defaultDate.to}
selected={range} selected={range}
disabled={[ disabled={[
{ from: new Date(2022, 3, 1), to: addDays(new Date(), -90) }, { from: new Date(2022, 3, 1), to: addDays(new Date(), -180) },
{ from: addDays(new Date(), 1), to: new Date(2099, 1, 1) } { from: addDays(new Date(), 1), to: new Date(2099, 1, 1) }
]} ]}
onSelect={(date) => { onSelect={(date) => {
if (date?.from === undefined) { let typeDate = date as DateRangeType;
date = { if (!typeDate || typeDate?.from === undefined) {
typeDate = {
from: range?.from, from: range?.from,
to: range?.from to: range?.from
}; };
} }
if (date?.to === undefined) { if (typeDate?.to === undefined) {
date.to = date.from; typeDate.to = typeDate.from;
} }
if (date?.from) { if (typeDate?.from) {
date.from = new Date(date.from.setHours(0, 0, 0, 0)); typeDate.from = new Date(typeDate.from.setHours(0, 0, 0, 0));
} }
if (date?.to) { if (typeDate?.to) {
date.to = new Date(date.to.setHours(23, 59, 59, 999)); typeDate.to = new Date(typeDate.to.setHours(23, 59, 59, 999));
} }
setRange(date);
onChange?.(date); setRange(typeDate);
onChange?.(typeDate);
}} }}
footer={ footer={
<Flex justifyContent={'flex-end'}> <Flex justifyContent={'flex-end'}>
@@ -139,4 +146,3 @@ const DateRangePicker = ({
}; };
export default DateRangePicker; export default DateRangePicker;
export type DateRangeType = DateRange;

View File

@@ -258,6 +258,7 @@ export function usePagination<DataT, ResT = {}>(
return { return {
pageNum, pageNum,
setPageNum,
pageSize, pageSize,
total: totalDataLength, total: totalDataLength,
data, data,

View File

@@ -1,10 +1,7 @@
{ {
"extends": "../../tsconfig.json", "extends": "../../tsconfig.json",
"compilerOptions": { "compilerOptions": {
"baseUrl": ".", "baseUrl": "."
"paths": {
"@fastgpt/web/*": ["./*"]
}
}, },
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", "**/*.d.ts", "../**/*.d.ts"] "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", "**/*.d.ts", "../**/*.d.ts"]
} }

View File

@@ -21,7 +21,6 @@ import {
import type { VariableItemType } from '@fastgpt/global/core/app/type.d'; import type { VariableItemType } from '@fastgpt/global/core/app/type.d';
import MyIcon from '@fastgpt/web/components/common/Icon'; import MyIcon from '@fastgpt/web/components/common/Icon';
import { useForm, type UseFormReset } from 'react-hook-form'; import { useForm, type UseFormReset } from 'react-hook-form';
import { customAlphabet } from 'nanoid';
import MyModal from '@fastgpt/web/components/common/MyModal'; import MyModal from '@fastgpt/web/components/common/MyModal';
import { useTranslation } from 'next-i18next'; import { useTranslation } from 'next-i18next';
import { useToast } from '@fastgpt/web/hooks/useToast'; import { useToast } from '@fastgpt/web/hooks/useToast';
@@ -36,11 +35,10 @@ import DndDrag, {
type DraggableProvided, type DraggableProvided,
type DraggableStateSnapshot type DraggableStateSnapshot
} from '@fastgpt/web/components/common/DndDrag'; } from '@fastgpt/web/components/common/DndDrag';
import { getNanoid } from '@fastgpt/global/common/string/tools';
const nanoid = customAlphabet('abcdefghijklmnopqrstuvwxyz1234567890', 6);
export const defaultVariable: VariableItemType = { export const defaultVariable: VariableItemType = {
id: nanoid(), id: getNanoid(6),
key: '', key: '',
label: '', label: '',
type: VariableInputEnum.input, type: VariableInputEnum.input,
@@ -136,7 +134,7 @@ const VariableEdit = ({
} else { } else {
onChangeVariable.push({ onChangeVariable.push({
...data, ...data,
id: nanoid() id: getNanoid(6)
}); });
} }

View File

@@ -306,7 +306,7 @@ const ChatInput = ({
isChatting ? 'primary.50' : canSendMessage ? 'primary.500' : 'rgba(17, 24, 36, 0.1)' isChatting ? 'primary.50' : canSendMessage ? 'primary.500' : 'rgba(17, 24, 36, 0.1)'
} }
borderRadius={['md', 'lg']} borderRadius={['md', 'lg']}
cursor={canSendMessage ? 'pointer' : 'not-allowed'} cursor={isChatting ? 'pointer' : canSendMessage ? 'pointer' : 'not-allowed'}
onClick={() => { onClick={() => {
if (isChatting) { if (isChatting) {
return onStop(); return onStop();

View File

@@ -1,4 +1,4 @@
import React, { useMemo, useState } from 'react'; import React, { useEffect, useMemo, useState } from 'react';
import { import {
Flex, Flex,
Box, Box,
@@ -46,8 +46,8 @@ const Logs = () => {
const appId = useContextSelector(AppContext, (v) => v.appId); const appId = useContextSelector(AppContext, (v) => v.appId);
const [dateRange, setDateRange] = useState<DateRangeType>({ const [dateRange, setDateRange] = useState<DateRangeType>({
from: addDays(new Date(), -7), from: new Date(addDays(new Date(), -6).setHours(0, 0, 0, 0)),
to: new Date() to: new Date(new Date().setHours(23, 59, 59, 999))
}); });
const [detailLogsId, setDetailLogsId] = useState<string>(); const [detailLogsId, setDetailLogsId] = useState<string>();
@@ -69,6 +69,16 @@ const Logs = () => {
[t] [t]
); );
const params = useMemo(
() => ({
appId,
dateStart: dateRange.from!,
dateEnd: dateRange.to!,
sources: isSelectAllSource ? undefined : chatSources,
logTitle
}),
[appId, chatSources, dateRange.from, dateRange.to, isSelectAllSource, logTitle]
);
const { const {
data: logs, data: logs,
isLoading, isLoading,
@@ -78,14 +88,8 @@ const Logs = () => {
total total
} = usePagination(getAppChatLogs, { } = usePagination(getAppChatLogs, {
pageSize: 20, pageSize: 20,
params: { params,
appId, refreshDeps: [params]
dateStart: dateRange.from || new Date(),
dateEnd: addDays(dateRange.to || new Date(), 1),
sources: isSelectAllSource ? undefined : chatSources,
logTitle
},
refreshDeps: [chatSources, logTitle]
}); });
const { runAsync: exportLogs } = useRequest2( const { runAsync: exportLogs } = useRequest2(
@@ -116,7 +120,7 @@ const Logs = () => {
refreshDeps: [chatSources, logTitle] refreshDeps: [chatSources, logTitle]
} }
); );
console.log(dateRange, 111);
return ( return (
<Flex <Flex
flexDirection={'column'} flexDirection={'column'}
@@ -153,8 +157,9 @@ const Logs = () => {
<DateRangePicker <DateRangePicker
defaultDate={dateRange} defaultDate={dateRange}
position="bottom" position="bottom"
onChange={setDateRange} onSuccess={(date) => {
onSuccess={() => getData(1)} setDateRange(date);
}}
/> />
</Flex> </Flex>
<Flex alignItems={'center'} gap={2}> <Flex alignItems={'center'} gap={2}>

View File

@@ -30,8 +30,7 @@ import { useContextSelector } from 'use-context-selector';
import { DatasetPageContext } from '@/web/core/dataset/context/datasetPageContext'; import { DatasetPageContext } from '@/web/core/dataset/context/datasetPageContext';
import EmptyTip from '@fastgpt/web/components/common/EmptyTip'; import EmptyTip from '@fastgpt/web/components/common/EmptyTip';
import QuestionTip from '@fastgpt/web/components/common/MyTooltip/QuestionTip'; import QuestionTip from '@fastgpt/web/components/common/MyTooltip/QuestionTip';
import { getNanoid } from '@fastgpt/global/common/string/tools';
const nanoid = customAlphabet('abcdefghijklmnopqrstuvwxyz1234567890', 12);
const DatasetParamsModal = dynamic(() => import('@/components/core/app/DatasetParamsModal')); const DatasetParamsModal = dynamic(() => import('@/components/core/app/DatasetParamsModal'));
@@ -108,7 +107,7 @@ const Test = ({ datasetId }: { datasetId: string }) => {
} }
const testItem: SearchTestStoreItemType = { const testItem: SearchTestStoreItemType = {
id: nanoid(), id: getNanoid(),
datasetId, datasetId,
text: getValues('inputText').trim(), text: getValues('inputText').trim(),
time: new Date(), time: new Date(),

View File

@@ -38,13 +38,14 @@ async function handler(req: NextApiRequest) {
const match = { const match = {
teamId: new Types.ObjectId(teamId), teamId: new Types.ObjectId(teamId),
datasetId: new Types.ObjectId(datasetId), datasetId: new Types.ObjectId(datasetId),
parentId: parentId ? new Types.ObjectId(parentId) : null,
...(selectFolder ? { type: DatasetCollectionTypeEnum.folder } : {}), ...(selectFolder ? { type: DatasetCollectionTypeEnum.folder } : {}),
...(searchText ...(searchText
? { ? {
name: new RegExp(searchText, 'i') name: new RegExp(searchText, 'i')
} }
: {}), : {
parentId: parentId ? new Types.ObjectId(parentId) : null
}),
...(filterTags.length ? { tags: { $in: filterTags } } : {}) ...(filterTags.length ? { tags: { $in: filterTags } } : {})
}; };

View File

@@ -43,13 +43,14 @@ async function handler(
const match = { const match = {
teamId: new Types.ObjectId(teamId), teamId: new Types.ObjectId(teamId),
datasetId: new Types.ObjectId(datasetId), datasetId: new Types.ObjectId(datasetId),
parentId: parentId ? new Types.ObjectId(parentId) : null,
...(selectFolder ? { type: DatasetCollectionTypeEnum.folder } : {}), ...(selectFolder ? { type: DatasetCollectionTypeEnum.folder } : {}),
...(searchText ...(searchText
? { ? {
name: new RegExp(searchText, 'i') name: new RegExp(searchText, 'i')
} }
: {}), : {
parentId: parentId ? new Types.ObjectId(parentId) : null
}),
...(filterTags.length ? { tags: { $in: filterTags } } : {}) ...(filterTags.length ? { tags: { $in: filterTags } } : {})
}; };

View File

@@ -1,7 +1,6 @@
import { MongoOutLink } from '@fastgpt/service/support/outLink/schema'; import { MongoOutLink } from '@fastgpt/service/support/outLink/schema';
import { authApp } from '@fastgpt/service/support/permission/app/auth'; import { authApp } from '@fastgpt/service/support/permission/app/auth';
import type { OutLinkEditType } from '@fastgpt/global/support/outLink/type.d'; import type { OutLinkEditType } from '@fastgpt/global/support/outLink/type.d';
import { customAlphabet } from 'nanoid';
import type { PublishChannelEnum } from '@fastgpt/global/support/outLink/constant'; import type { PublishChannelEnum } from '@fastgpt/global/support/outLink/constant';
import { ManagePermissionVal } from '@fastgpt/global/support/permission/constant'; import { ManagePermissionVal } from '@fastgpt/global/support/permission/constant';
import type { ApiRequestProps } from '@fastgpt/service/type/next'; import type { ApiRequestProps } from '@fastgpt/service/type/next';
@@ -9,8 +8,7 @@ import { NextAPI } from '@/service/middleware/entry';
import { addOperationLog } from '@fastgpt/service/support/operationLog/addOperationLog'; import { addOperationLog } from '@fastgpt/service/support/operationLog/addOperationLog';
import { OperationLogEventEnum } from '@fastgpt/global/support/operationLog/constants'; import { OperationLogEventEnum } from '@fastgpt/global/support/operationLog/constants';
import { getI18nAppType } from '@fastgpt/service/support/operationLog/util'; import { getI18nAppType } from '@fastgpt/service/support/operationLog/util';
/* create a shareChat */ import { getNanoid } from '@fastgpt/global/common/string/tools';
const nanoid = customAlphabet('abcdefghijklmnopqrstuvwxyz1234567890', 24);
export type OutLinkCreateQuery = {}; export type OutLinkCreateQuery = {};
export type OutLinkCreateBody = OutLinkEditType & export type OutLinkCreateBody = OutLinkEditType &
@@ -32,7 +30,7 @@ async function handler(
per: ManagePermissionVal per: ManagePermissionVal
}); });
const shareId = nanoid(); const shareId = getNanoid(24);
await MongoOutLink.create({ await MongoOutLink.create({
shareId, shareId,
teamId, teamId,

View File

@@ -16,7 +16,6 @@
"incremental": true, "incremental": true,
"baseUrl": ".", "baseUrl": ".",
"paths": { "paths": {
"@/*": ["projects/app/src/*"],
"@fastgpt/*": ["packages/*"], "@fastgpt/*": ["packages/*"],
"@test": ["test/*"] "@test": ["test/*"]
} }