Skip to content

Commit d398c9c

Browse files
authored
fix: openapi (#6121)
* fix: openapi * fix: openapi * fix: default maxResponse load * fix: default maxResponse load * doc
1 parent 5231f42 commit d398c9c

File tree

12 files changed

+113
-142
lines changed

12 files changed

+113
-142
lines changed

document/content/docs/upgrading/4-14/4145.mdx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ description: 'FastGPT V4.14.5 更新说明'
1717
1. MCP 工具创建时,使用自定义鉴权头会报错。
1818
2. 获取对话日志列表时,如果用户头像为空,会抛错。
1919
3. chatAgent 未开启问题优化时,前端 UI 显示开启。
20+
4. 加载默认模型时,maxTokens 字段未赋值,导致模型最大响应值配置为空。
2021

2122

2223
## 插件

document/data/doc-last-modified.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@
120120
"document/content/docs/upgrading/4-14/4142.mdx": "2025-11-18T19:27:14+08:00",
121121
"document/content/docs/upgrading/4-14/4143.mdx": "2025-11-26T20:52:05+08:00",
122122
"document/content/docs/upgrading/4-14/4144.mdx": "2025-12-16T14:56:04+08:00",
123-
"document/content/docs/upgrading/4-14/4145.mdx": "2025-12-18T11:09:13+08:00",
123+
"document/content/docs/upgrading/4-14/4145.mdx": "2025-12-18T23:25:48+08:00",
124124
"document/content/docs/upgrading/4-8/40.mdx": "2025-08-02T19:38:37+08:00",
125125
"document/content/docs/upgrading/4-8/41.mdx": "2025-08-02T19:38:37+08:00",
126126
"document/content/docs/upgrading/4-8/42.mdx": "2025-08-02T19:38:37+08:00",

packages/global/core/chat/api.ts

Lines changed: 0 additions & 68 deletions
This file was deleted.

packages/global/openapi/api.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import { z } from 'zod';
22

33
export const PaginationSchema = z.object({
4-
pageSize: z.union([z.number(), z.string()]).optional(),
5-
offset: z.union([z.number(), z.string()]).optional(),
6-
pageNum: z.union([z.number(), z.string()]).optional()
4+
pageSize: z.union([z.number(), z.string()]).optional().describe('每页条数'),
5+
offset: z.union([z.number(), z.string()]).optional().describe('偏移量(与页码二选一)'),
6+
pageNum: z.union([z.number(), z.string()]).optional().describe('页码(与偏移量二选一)')
77
});
88
export type PaginationType = z.infer<typeof PaginationSchema>;
99

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
import type { OutLinkChatAuthType } from '../../../support/permission/chat/type';
2+
import { OutLinkChatAuthSchema } from '../../../support/permission/chat/type';
3+
import { ObjectIdSchema } from '../../../common/type/mongo';
4+
import z from 'zod';
5+
6+
export const PresignChatFileGetUrlSchema = z
7+
.object({
8+
key: z.string().min(1).describe('文件key'),
9+
appId: ObjectIdSchema.describe('应用ID'),
10+
outLinkAuthData: OutLinkChatAuthSchema.optional().describe('外链鉴权数据')
11+
})
12+
.meta({
13+
example: {
14+
key: '1234567890',
15+
appId: '1234567890',
16+
outLinkAuthData: {
17+
shareId: '1234567890',
18+
outLinkUid: '1234567890'
19+
}
20+
}
21+
});
22+
export type PresignChatFileGetUrlParams = z.infer<typeof PresignChatFileGetUrlSchema>;
23+
24+
export const PresignChatFilePostUrlSchema = z
25+
.object({
26+
filename: z.string().min(1).describe('文件名'),
27+
appId: ObjectIdSchema.describe('应用ID'),
28+
chatId: z.string().min(1).describe('对话ID'),
29+
outLinkAuthData: OutLinkChatAuthSchema.optional().describe('外链鉴权数据')
30+
})
31+
.meta({
32+
example: {
33+
filename: '1234567890',
34+
appId: '1234567890',
35+
chatId: '1234567890',
36+
outLinkAuthData: {
37+
shareId: '1234567890',
38+
outLinkUid: '1234567890'
39+
}
40+
}
41+
});
42+
export type PresignChatFilePostUrlParams = z.infer<typeof PresignChatFilePostUrlSchema>;

packages/global/openapi/core/chat/feedback/index.ts

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -14,120 +14,120 @@ import {
1414
} from './api';
1515

1616
export const ChatFeedbackPath: OpenAPIPath = {
17-
'/core/chat/feedback/updateFeedbackReadStatus': {
17+
'/core/chat/feedback/updateUserFeedback': {
1818
post: {
19-
summary: '更新反馈阅读状态',
20-
description: '标记指定消息的反馈为已读或未读状态',
19+
summary: '添加/更新用户反馈',
20+
description: '用户对消息添加或更新好评/差评反馈',
2121
tags: [TagsMap.chatFeedback],
2222
requestBody: {
2323
content: {
2424
'application/json': {
25-
schema: UpdateFeedbackReadStatusBodySchema
25+
schema: UpdateUserFeedbackBodySchema
2626
}
2727
}
2828
},
2929
responses: {
3030
200: {
31-
description: '成功更新反馈阅读状态',
31+
description: '成功更新用户反馈',
3232
content: {
3333
'application/json': {
34-
schema: UpdateFeedbackReadStatusResponseSchema
34+
schema: UpdateUserFeedbackResponseSchema
3535
}
3636
}
3737
}
3838
}
3939
}
4040
},
41-
'/core/chat/feedback/adminUpdate': {
41+
'/core/chat/feedback/getFeedbackRecordIds': {
4242
post: {
43-
summary: '管理员标注反馈',
44-
description: '管理员为指定消息添加或更新标注反馈,包含数据集关联信息',
43+
summary: '获取反馈记录ID列表',
44+
description: '根据反馈类型和已读状态,获取符合条件的消息ID列表',
4545
tags: [TagsMap.chatFeedback],
4646
requestBody: {
4747
content: {
4848
'application/json': {
49-
schema: AdminUpdateFeedbackBodySchema
49+
schema: GetFeedbackRecordIdsBodySchema
5050
}
5151
}
5252
},
5353
responses: {
5454
200: {
55-
description: '成功更新管理员反馈标注',
55+
description: '成功获取反馈记录ID列表',
5656
content: {
5757
'application/json': {
58-
schema: AdminUpdateFeedbackResponseSchema
58+
schema: GetFeedbackRecordIdsResponseSchema
5959
}
6060
}
6161
}
6262
}
6363
}
6464
},
65-
'/core/chat/feedback/closeCustom': {
65+
'/core/chat/feedback/updateFeedbackReadStatus': {
6666
post: {
67-
summary: '关闭自定义反馈',
68-
description: '删除或关闭指定索引位置的自定义反馈条目',
67+
summary: '应用管理员-更新反馈阅读状态',
68+
description: '标记指定消息的反馈为已读或未读状态',
6969
tags: [TagsMap.chatFeedback],
7070
requestBody: {
7171
content: {
7272
'application/json': {
73-
schema: CloseCustomFeedbackBodySchema
73+
schema: UpdateFeedbackReadStatusBodySchema
7474
}
7575
}
7676
},
7777
responses: {
7878
200: {
79-
description: '成功关闭自定义反馈',
79+
description: '成功更新反馈阅读状态',
8080
content: {
8181
'application/json': {
82-
schema: CloseCustomFeedbackResponseSchema
82+
schema: UpdateFeedbackReadStatusResponseSchema
8383
}
8484
}
8585
}
8686
}
8787
}
8888
},
89-
'/core/chat/feedback/updateUserFeedback': {
89+
'/core/chat/feedback/adminUpdate': {
9090
post: {
91-
summary: '更新用户反馈',
92-
description: '用户对消息添加或更新好评/差评反馈',
91+
summary: '应用管理员-标注反馈',
92+
description: '管理员为指定消息添加或更新标注反馈,包含数据集关联信息',
9393
tags: [TagsMap.chatFeedback],
9494
requestBody: {
9595
content: {
9696
'application/json': {
97-
schema: UpdateUserFeedbackBodySchema
97+
schema: AdminUpdateFeedbackBodySchema
9898
}
9999
}
100100
},
101101
responses: {
102102
200: {
103-
description: '成功更新用户反馈',
103+
description: '成功更新管理员反馈标注',
104104
content: {
105105
'application/json': {
106-
schema: UpdateUserFeedbackResponseSchema
106+
schema: AdminUpdateFeedbackResponseSchema
107107
}
108108
}
109109
}
110110
}
111111
}
112112
},
113-
'/core/chat/feedback/getFeedbackRecordIds': {
113+
'/core/chat/feedback/closeCustom': {
114114
post: {
115-
summary: '获取反馈记录ID列表',
116-
description: '根据反馈类型和已读状态,获取符合条件的消息ID列表',
115+
summary: '应用管理员-关闭自定义反馈',
116+
description: '删除或关闭指定索引位置的自定义反馈条目',
117117
tags: [TagsMap.chatFeedback],
118118
requestBody: {
119119
content: {
120120
'application/json': {
121-
schema: GetFeedbackRecordIdsBodySchema
121+
schema: CloseCustomFeedbackBodySchema
122122
}
123123
}
124124
},
125125
responses: {
126126
200: {
127-
description: '成功获取反馈记录ID列表',
127+
description: '成功关闭自定义反馈',
128128
content: {
129129
'application/json': {
130-
schema: GetFeedbackRecordIdsResponseSchema
130+
schema: CloseCustomFeedbackResponseSchema
131131
}
132132
}
133133
}

packages/global/openapi/core/chat/history/api.ts

Lines changed: 15 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,14 @@ import { ChatSourceEnum } from '../../../../core/chat/constants';
55
import { PaginationSchema, PaginationResponseSchema } from '../../../api';
66

77
// Get chat histories schema
8-
export const GetHistoriesBodySchema = PaginationSchema.and(
9-
OutLinkChatAuthSchema.and(
10-
z.object({
11-
appId: z.string().optional().describe('应用ID'),
12-
source: z.enum(ChatSourceEnum).optional().describe('对话来源'),
13-
startCreateTime: z.string().optional().describe('创建时间开始'),
14-
endCreateTime: z.string().optional().describe('创建时间结束'),
15-
startUpdateTime: z.string().optional().describe('更新时间开始'),
16-
endUpdateTime: z.string().optional().describe('更新时间结束')
17-
})
18-
)
19-
);
8+
export const GetHistoriesBodySchema = PaginationSchema.extend(OutLinkChatAuthSchema.shape).extend({
9+
appId: z.string().optional().describe('应用ID'),
10+
source: z.enum(ChatSourceEnum).optional().describe('对话来源'),
11+
startCreateTime: z.string().optional().describe('创建时间开始'),
12+
endCreateTime: z.string().optional().describe('创建时间结束'),
13+
startUpdateTime: z.string().optional().describe('更新时间开始'),
14+
endUpdateTime: z.string().optional().describe('更新时间结束')
15+
});
2016
export type GetHistoriesBodyType = z.infer<typeof GetHistoriesBodySchema>;
2117
export const GetHistoriesResponseSchema = PaginationResponseSchema(
2218
z.object({
@@ -43,20 +39,16 @@ export const UpdateHistoryBodySchema = OutLinkChatAuthSchema.and(
4339
export type UpdateHistoryBodyType = z.infer<typeof UpdateHistoryBodySchema>;
4440

4541
// Delete single chat history schema
46-
export const DelChatHistorySchema = OutLinkChatAuthSchema.and(
47-
z.object({
48-
appId: ObjectIdSchema.describe('应用ID'),
49-
chatId: z.string().min(1).describe('对话ID')
50-
})
51-
);
42+
export const DelChatHistorySchema = OutLinkChatAuthSchema.extend({
43+
appId: ObjectIdSchema.describe('应用ID'),
44+
chatId: z.string().min(1).describe('对话ID')
45+
});
5246
export type DelChatHistoryType = z.infer<typeof DelChatHistorySchema>;
5347

5448
// Clear all chat histories schema
55-
export const ClearChatHistoriesSchema = OutLinkChatAuthSchema.and(
56-
z.object({
57-
appId: ObjectIdSchema.describe('应用ID')
58-
})
59-
);
49+
export const ClearChatHistoriesSchema = OutLinkChatAuthSchema.extend({
50+
appId: ObjectIdSchema.describe('应用ID')
51+
});
6052
export type ClearChatHistoriesType = z.infer<typeof ClearChatHistoriesSchema>;
6153

6254
// Batch delete chat histories schema (for log manager)

0 commit comments

Comments
 (0)