Skip to content

Commit 181f743

Browse files
c121914yuxqvvuYYH211
authored
fix: parent datasetId type;fix: v1 completions; (#6775)
* fix: parent datasetId type * doc * fix(chat): keep stream resume out of v1 completions (#6774) * fix(chat): avoid duplicate v1 completion history items * fix(chat): restore v1 completion persistence flow * fix(chat): keep stream resume out of v1 completions * fix(chat): revert pushChatRecords append flow * Mobile UI (#6776) * doc * perf: review * fix: review --------- Co-authored-by: Ryo <whoeverimf5@gmail.com> Co-authored-by: YeYuheng <57035043+YYH211@users.noreply.github.com>
1 parent d9b0968 commit 181f743

10 files changed

Lines changed: 253 additions & 256 deletions

File tree

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
---
2+
title: 'V4.14.12'
3+
description: 'FastGPT V4.14.12 更新说明'
4+
---
5+
6+
7+
8+
## 🐛 修复
9+
10+
1. 知识库三级目录 path 接口报 zod 校验出错。
11+
2. v1/completions 接口 dataId 异常,导致 api 调用时候,对话日志里无法获取到运行详情。
12+
13+
## 🚀 新增内容
14+
15+
1. 响应值允许自定义 HttpStatus 状态码。
16+
2. Agent 调度器支持 PI Agent 模式(beta功能)。
17+
18+
## ⚙️ 优化
19+
20+
1. skill 接口错误处理。
21+

document/content/docs/toc.mdx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,7 @@ description: FastGPT 文档目录
115115
- [/docs/self-host/upgrading/4-14/4141](/docs/self-host/upgrading/4-14/4141)
116116
- [/docs/self-host/upgrading/4-14/41410](/docs/self-host/upgrading/4-14/41410)
117117
- [/docs/self-host/upgrading/4-14/41411](/docs/self-host/upgrading/4-14/41411)
118+
- [/docs/self-host/upgrading/4-14/41412](/docs/self-host/upgrading/4-14/41412)
118119
- [/docs/self-host/upgrading/4-14/4142](/docs/self-host/upgrading/4-14/4142)
119120
- [/docs/self-host/upgrading/4-14/4143](/docs/self-host/upgrading/4-14/4143)
120121
- [/docs/self-host/upgrading/4-14/4144](/docs/self-host/upgrading/4-14/4144)

document/data/doc-last-modified.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -225,6 +225,7 @@
225225
"document/content/docs/self-host/upgrading/4-14/41410.en.mdx": "2026-03-31T23:15:29+08:00",
226226
"document/content/docs/self-host/upgrading/4-14/41410.mdx": "2026-04-18T20:47:39+08:00",
227227
"document/content/docs/self-host/upgrading/4-14/41411.mdx": "2026-04-18T20:47:39+08:00",
228+
"document/content/docs/self-host/upgrading/4-14/41412.mdx": "2026-04-20T15:54:50+08:00",
228229
"document/content/docs/self-host/upgrading/4-14/4142.en.mdx": "2026-03-03T17:39:47+08:00",
229230
"document/content/docs/self-host/upgrading/4-14/4142.mdx": "2026-03-03T17:39:47+08:00",
230231
"document/content/docs/self-host/upgrading/4-14/4143.en.mdx": "2026-03-03T17:39:47+08:00",
@@ -384,9 +385,9 @@
384385
"document/content/docs/self-host/upgrading/outdated/499.en.mdx": "2026-03-03T17:39:47+08:00",
385386
"document/content/docs/self-host/upgrading/outdated/499.mdx": "2026-03-03T17:39:47+08:00",
386387
"document/content/docs/self-host/upgrading/upgrade-intruction.en.mdx": "2026-03-03T17:39:47+08:00",
387-
"document/content/docs/self-host/upgrading/upgrade-intruction.mdx": "2026-03-03T17:39:47+08:00",
388+
"document/content/docs/self-host/upgrading/upgrade-intruction.mdx": "2026-04-20T13:51:34+08:00",
388389
"document/content/docs/toc.en.mdx": "2026-04-17T23:28:43+08:00",
389-
"document/content/docs/toc.mdx": "2026-04-17T23:28:43+08:00",
390+
"document/content/docs/toc.mdx": "2026-04-20T15:24:07+08:00",
390391
"document/content/docs/use-cases/app-cases/dalle3.en.mdx": "2026-02-26T22:14:30+08:00",
391392
"document/content/docs/use-cases/app-cases/dalle3.mdx": "2025-07-23T21:35:03+08:00",
392393
"document/content/docs/use-cases/app-cases/english_essay_correction_bot.en.mdx": "2026-02-26T22:14:30+08:00",

packages/global/common/parentFolder/type.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
import z from 'zod';
22

3-
export const ParentIdSchema = z.string().nullish();
3+
export const ParentIdSchema = z
4+
.preprocess(
5+
(value) => (value !== null && typeof value === 'object' ? String(value) : value),
6+
z.string().regex(/^([0-9a-fA-F]{24})?$/)
7+
)
8+
.nullish();
49
export type ParentIdType = string | null | undefined;
510

611
export const GetPathPropsSchema = z.object({

packages/service/core/chat/saveChat.ts

Lines changed: 19 additions & 150 deletions
Original file line numberDiff line numberDiff line change
@@ -387,72 +387,6 @@ export const prepareChatRound = async (params: PrepareChatRoundParams) => {
387387
});
388388
};
389389

390-
export const ensurePendingChatRoundItems = async (params: EnsurePendingChatRoundParams) => {
391-
const { chatId, appId, teamId, tmbId, responseChatItemId } = params;
392-
if (!chatId || chatId === 'NO_RECORD_HISTORIES') return;
393-
394-
const humanDataId = params.userContent.dataId ?? responseChatItemId;
395-
396-
const existingAi = await MongoChatItem.findOne({
397-
appId,
398-
chatId,
399-
dataId: responseChatItemId,
400-
obj: ChatRoleEnum.AI
401-
})
402-
.select('_id')
403-
.lean();
404-
405-
if (existingAi) return;
406-
407-
const userPayload: UserChatItemType & { dataId: string; obj: typeof ChatRoleEnum.Human } = {
408-
...params.userContent,
409-
dataId: humanDataId,
410-
obj: ChatRoleEnum.Human
411-
};
412-
413-
userPayload.value?.forEach((item) => {
414-
if ('file' in item && item.file?.key) {
415-
item.file.url = '';
416-
}
417-
});
418-
419-
const aiPlaceholder: AIChatItemType & { dataId: string } = {
420-
dataId: responseChatItemId,
421-
obj: ChatRoleEnum.AI,
422-
value: []
423-
};
424-
425-
await mongoSessionRun(async (session) => {
426-
const upsertOpts = { session, upsert: true };
427-
await MongoChatItem.updateOne(
428-
{ appId, chatId, dataId: humanDataId, obj: ChatRoleEnum.Human },
429-
{
430-
$setOnInsert: {
431-
teamId,
432-
tmbId,
433-
chatId,
434-
appId,
435-
...userPayload
436-
}
437-
},
438-
upsertOpts
439-
);
440-
await MongoChatItem.updateOne(
441-
{ appId, chatId, dataId: responseChatItemId, obj: ChatRoleEnum.AI },
442-
{
443-
$setOnInsert: {
444-
teamId,
445-
tmbId,
446-
chatId,
447-
appId,
448-
...aiPlaceholder
449-
}
450-
},
451-
upsertOpts
452-
);
453-
});
454-
};
455-
456390
export const finalizeChatRound = async (props: Props) => {
457391
beforeProcess(props);
458392

@@ -771,96 +705,30 @@ export const pushChatRecords = async (props: Props) => {
771705
errorMsg
772706
});
773707
const processedContent = [userContent, aiResponse];
774-
const humanRoundDataId = (processedContent[0] as { dataId?: string }).dataId as string;
775-
const aiRoundDataId = (processedContent[1] as { dataId?: string }).dataId as string;
776708

777709
await mongoSessionRun(async (session) => {
778-
const humanExisting = await MongoChatItem.findOne({
779-
appId,
780-
chatId,
781-
dataId: humanRoundDataId,
782-
obj: ChatRoleEnum.Human
783-
}).session(session);
784-
const aiExisting = await MongoChatItem.findOne({
785-
appId,
786-
chatId,
787-
dataId: aiRoundDataId,
788-
obj: ChatRoleEnum.AI
789-
}).session(session);
790-
791-
let chatItemIdHuman: unknown;
792-
let chatItemIdAi: unknown;
793-
let responseDataId = aiRoundDataId;
794-
795-
if (humanExisting && aiExisting) {
796-
await MongoChatItem.updateOne(
797-
{ _id: humanExisting._id },
798-
{
799-
$set: {
800-
...(processedContent[0] as Record<string, unknown>),
801-
obj: ChatRoleEnum.Human
802-
}
803-
},
804-
{ session }
805-
);
806-
await MongoChatItem.updateOne(
807-
{ _id: aiExisting._id },
808-
{
809-
$set: {
810-
...(processedContent[1] as Record<string, unknown>),
811-
obj: ChatRoleEnum.AI
812-
}
813-
},
814-
{ session }
815-
);
816-
817-
await MongoChatItemResponse.deleteMany(
818-
{ appId, chatId, chatItemDataId: aiRoundDataId },
819-
{ session }
820-
);
821-
822-
if (nodeResponses?.length) {
823-
await MongoChatItemResponse.create(
824-
nodeResponses.map((item) => ({
825-
teamId,
826-
appId,
827-
chatId,
828-
chatItemDataId: aiRoundDataId,
829-
data: item
830-
})),
831-
{ session, ordered: true }
832-
);
833-
}
710+
const [{ _id: chatItemIdHuman }, { _id: chatItemIdAi, dataId }] = await MongoChatItem.create(
711+
processedContent.map((item) => ({
712+
chatId,
713+
teamId,
714+
tmbId,
715+
appId,
716+
...item
717+
})),
718+
{ session, ordered: true, ...writePrimary }
719+
);
834720

835-
chatItemIdHuman = humanExisting._id;
836-
chatItemIdAi = aiExisting._id;
837-
} else {
838-
const [humanCreated, aiCreated] = await MongoChatItem.create(
839-
processedContent.map((item) => ({
840-
chatId,
721+
if (nodeResponses) {
722+
await MongoChatItemResponse.create(
723+
nodeResponses.map((item) => ({
841724
teamId,
842-
tmbId,
843725
appId,
844-
...item
726+
chatId,
727+
chatItemDataId: dataId,
728+
data: item
845729
})),
846-
{ session, ordered: true }
730+
{ session, ordered: true, ...writePrimary }
847731
);
848-
chatItemIdHuman = humanCreated._id;
849-
chatItemIdAi = aiCreated._id;
850-
responseDataId = aiCreated.dataId;
851-
852-
if (nodeResponses) {
853-
await MongoChatItemResponse.create(
854-
nodeResponses.map((item) => ({
855-
teamId,
856-
appId,
857-
chatId,
858-
chatItemDataId: responseDataId,
859-
data: item
860-
})),
861-
{ session, ordered: true }
862-
);
863-
}
864732
}
865733

866734
await MongoChat.updateOne(
@@ -894,7 +762,8 @@ export const pushChatRecords = async (props: Props) => {
894762
},
895763
{
896764
session,
897-
upsert: true
765+
upsert: true,
766+
...writePrimary
898767
}
899768
);
900769

projects/app/src/components/core/ai/ModelTable/index.tsx

Lines changed: 49 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -217,34 +217,50 @@ const ModelTable = ({ permissionConfig = false }: { permissionConfig?: boolean }
217217
});
218218

219219
return (
220-
<Flex flexDirection={'column'} h={'100%'}>
221-
<Flex>
222-
<HStack flexShrink={0}>
223-
<Box fontSize={'sm'} color={'myGray.900'}>
220+
<Flex flexDirection={'column'} h={'100%'} minW={0}>
221+
<Flex flexDirection={['column', 'row']} gap={[3, 0]} alignItems={['stretch', 'center']}>
222+
<Flex flexShrink={0} w={['100%', 'auto']} alignItems={'center'} gap={2}>
223+
<Box
224+
w={['84px', 'auto']}
225+
flexShrink={0}
226+
fontSize={'sm'}
227+
color={'myGray.900'}
228+
textAlign={'left'}
229+
>
224230
{t('common:model.provider')}
225231
</Box>
226-
<MySelect
227-
w={'200px'}
228-
bg={'myGray.50'}
229-
value={provider}
230-
onChange={setProvider}
231-
list={filterProviderList}
232-
/>
233-
</HStack>
234-
<HStack flexShrink={0} ml={6}>
235-
<Box fontSize={'sm'} color={'myGray.900'}>
232+
<Box flex={1} minW={0} w={['100%', '200px']}>
233+
<MySelect
234+
w={'100%'}
235+
bg={'myGray.50'}
236+
value={provider}
237+
onChange={setProvider}
238+
list={filterProviderList}
239+
/>
240+
</Box>
241+
</Flex>
242+
<Flex flexShrink={0} ml={[0, 6]} w={['100%', 'auto']} alignItems={'center'} gap={2}>
243+
<Box
244+
w={['84px', 'auto']}
245+
flexShrink={0}
246+
fontSize={'sm'}
247+
color={'myGray.900'}
248+
textAlign={'left'}
249+
>
236250
{t('common:model.model_type')}
237251
</Box>
238-
<MySelect
239-
w={'150px'}
240-
bg={'myGray.50'}
241-
value={modelType}
242-
onChange={setModelType}
243-
list={selectModelTypeList.current}
244-
/>
245-
</HStack>
246-
<Box flex={1} />
247-
<Box flex={'0 0 250px'}>
252+
<Box flex={1} minW={0} w={['100%', '150px']}>
253+
<MySelect
254+
w={'100%'}
255+
bg={'myGray.50'}
256+
value={modelType}
257+
onChange={setModelType}
258+
list={selectModelTypeList.current}
259+
/>
260+
</Box>
261+
</Flex>
262+
<Box flex={1} display={['none', 'block']} />
263+
<Box w={['100%', '250px']} flex={['none', '0 0 250px']}>
248264
<SearchInput
249265
bg={'myGray.50'}
250266
value={search}
@@ -253,7 +269,15 @@ const ModelTable = ({ permissionConfig = false }: { permissionConfig?: boolean }
253269
/>
254270
</Box>
255271
</Flex>
256-
<TableContainer mt={5} flex={'1 0 0'} h={0} overflowY={'auto'}>
272+
<TableContainer
273+
mt={5}
274+
flex={'1 0 0'}
275+
h={0}
276+
w={'100%'}
277+
maxW={'100%'}
278+
overflowY={'auto'}
279+
overflowX={'auto'}
280+
>
257281
<Table>
258282
<Thead>
259283
<Tr color={'myGray.600'}>

projects/app/src/pageComponents/price/Points.tsx

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,15 @@ const Points = () => {
2020
<Link href="https://tiktokenizer.vercel.app/" target="_blank" mb={['30px', 10]}>
2121
{t('common:support.wallet.subscription.token_compute')}
2222
</Link>
23-
<Box p={5} w={'100%'} h={'666px'} bg={'white'} borderRadius={'lg'} boxShadow={'md'}>
23+
<Box
24+
p={[3, 5]}
25+
w={'100%'}
26+
h={'666px'}
27+
bg={'white'}
28+
borderRadius={'lg'}
29+
boxShadow={'md'}
30+
overflow={'hidden'}
31+
>
2432
<ModelTable />
2533
</Box>
2634
</Flex>

0 commit comments

Comments
 (0)