mirror of
https://github.com/labring/FastGPT.git
synced 2025-12-25 20:02:47 +00:00
fix: openapi (#6121)
Some checks failed
Build FastGPT images in Personal warehouse / get-vars (push) Waiting to run
Build FastGPT images in Personal warehouse / build-fastgpt-images (map[arch:amd64 runs-on:ubuntu-24.04]) (push) Blocked by required conditions
Build FastGPT images in Personal warehouse / build-fastgpt-images (map[arch:arm64 runs-on:ubuntu-24.04-arm]) (push) Blocked by required conditions
Build FastGPT images in Personal warehouse / release-fastgpt-images (push) Blocked by required conditions
Document deploy / sync-images (push) Has been cancelled
Document deploy / generate-timestamp (push) Has been cancelled
Document deploy / build-images (map[domain:https://fastgpt.cn suffix:cn]) (push) Has been cancelled
Document deploy / build-images (map[domain:https://fastgpt.io suffix:io]) (push) Has been cancelled
Document deploy / update-images (map[deployment:fastgpt-docs domain:https://fastgpt.cn kube_config:KUBE_CONFIG_CN suffix:cn]) (push) Has been cancelled
Document deploy / update-images (map[deployment:fastgpt-docs domain:https://fastgpt.io kube_config:KUBE_CONFIG_IO suffix:io]) (push) Has been cancelled
Some checks failed
Build FastGPT images in Personal warehouse / get-vars (push) Waiting to run
Build FastGPT images in Personal warehouse / build-fastgpt-images (map[arch:amd64 runs-on:ubuntu-24.04]) (push) Blocked by required conditions
Build FastGPT images in Personal warehouse / build-fastgpt-images (map[arch:arm64 runs-on:ubuntu-24.04-arm]) (push) Blocked by required conditions
Build FastGPT images in Personal warehouse / release-fastgpt-images (push) Blocked by required conditions
Document deploy / sync-images (push) Has been cancelled
Document deploy / generate-timestamp (push) Has been cancelled
Document deploy / build-images (map[domain:https://fastgpt.cn suffix:cn]) (push) Has been cancelled
Document deploy / build-images (map[domain:https://fastgpt.io suffix:io]) (push) Has been cancelled
Document deploy / update-images (map[deployment:fastgpt-docs domain:https://fastgpt.cn kube_config:KUBE_CONFIG_CN suffix:cn]) (push) Has been cancelled
Document deploy / update-images (map[deployment:fastgpt-docs domain:https://fastgpt.io kube_config:KUBE_CONFIG_IO suffix:io]) (push) Has been cancelled
* fix: openapi * fix: openapi * fix: default maxResponse load * fix: default maxResponse load * doc
This commit is contained in:
parent
5231f4281f
commit
d398c9cd39
|
|
@ -17,6 +17,7 @@ description: 'FastGPT V4.14.5 更新说明'
|
|||
1. MCP 工具创建时,使用自定义鉴权头会报错。
|
||||
2. 获取对话日志列表时,如果用户头像为空,会抛错。
|
||||
3. chatAgent 未开启问题优化时,前端 UI 显示开启。
|
||||
4. 加载默认模型时,maxTokens 字段未赋值,导致模型最大响应值配置为空。
|
||||
|
||||
|
||||
## 插件
|
||||
|
|
|
|||
|
|
@ -120,7 +120,7 @@
|
|||
"document/content/docs/upgrading/4-14/4142.mdx": "2025-11-18T19:27:14+08:00",
|
||||
"document/content/docs/upgrading/4-14/4143.mdx": "2025-11-26T20:52:05+08:00",
|
||||
"document/content/docs/upgrading/4-14/4144.mdx": "2025-12-16T14:56:04+08:00",
|
||||
"document/content/docs/upgrading/4-14/4145.mdx": "2025-12-18T11:09:13+08:00",
|
||||
"document/content/docs/upgrading/4-14/4145.mdx": "2025-12-18T23:25:48+08:00",
|
||||
"document/content/docs/upgrading/4-8/40.mdx": "2025-08-02T19:38:37+08:00",
|
||||
"document/content/docs/upgrading/4-8/41.mdx": "2025-08-02T19:38:37+08:00",
|
||||
"document/content/docs/upgrading/4-8/42.mdx": "2025-08-02T19:38:37+08:00",
|
||||
|
|
|
|||
|
|
@ -1,68 +0,0 @@
|
|||
import type { OutLinkChatAuthType } from '../../support/permission/chat/type';
|
||||
import { OutLinkChatAuthSchema } from '../../support/permission/chat/type';
|
||||
import { ObjectIdSchema } from '../../common/type/mongo';
|
||||
import z from 'zod';
|
||||
|
||||
export const PresignChatFileGetUrlSchema = z
|
||||
.object({
|
||||
key: z.string().min(1),
|
||||
appId: ObjectIdSchema,
|
||||
outLinkAuthData: OutLinkChatAuthSchema.optional()
|
||||
})
|
||||
.meta({
|
||||
description: '获取对话文件预览链接',
|
||||
example: {
|
||||
key: '1234567890',
|
||||
appId: '1234567890',
|
||||
outLinkAuthData: {
|
||||
shareId: '1234567890',
|
||||
outLinkUid: '1234567890'
|
||||
}
|
||||
}
|
||||
});
|
||||
export type PresignChatFileGetUrlParams = z.infer<typeof PresignChatFileGetUrlSchema> & {
|
||||
outLinkAuthData?: OutLinkChatAuthType;
|
||||
};
|
||||
|
||||
export const PresignChatFilePostUrlSchema = z
|
||||
.object({
|
||||
filename: z.string().min(1),
|
||||
appId: ObjectIdSchema,
|
||||
chatId: ObjectIdSchema,
|
||||
outLinkAuthData: OutLinkChatAuthSchema.optional()
|
||||
})
|
||||
.meta({
|
||||
description: '获取上传对话文件预签名 URL',
|
||||
example: {
|
||||
filename: '1234567890',
|
||||
appId: '1234567890',
|
||||
chatId: '1234567890',
|
||||
outLinkAuthData: {
|
||||
shareId: '1234567890',
|
||||
outLinkUid: '1234567890'
|
||||
}
|
||||
}
|
||||
});
|
||||
export type PresignChatFilePostUrlParams = z.infer<typeof PresignChatFilePostUrlSchema> & {
|
||||
outLinkAuthData?: OutLinkChatAuthType;
|
||||
};
|
||||
|
||||
export const UpdateChatFeedbackSchema = z
|
||||
.object({
|
||||
appId: z.string().min(1),
|
||||
chatId: z.string().min(1),
|
||||
dataId: z.string().min(1),
|
||||
userBadFeedback: z.string().optional(),
|
||||
userGoodFeedback: z.string().optional()
|
||||
})
|
||||
.meta({
|
||||
description: '更新对话反馈',
|
||||
example: {
|
||||
appId: '1234567890',
|
||||
chatId: '1234567890',
|
||||
dataId: '1234567890',
|
||||
userBadFeedback: '1234567890',
|
||||
userGoodFeedback: '1234567890'
|
||||
}
|
||||
});
|
||||
export type UpdateChatFeedbackProps = z.infer<typeof UpdateChatFeedbackSchema>;
|
||||
|
|
@ -1,9 +1,9 @@
|
|||
import { z } from 'zod';
|
||||
|
||||
export const PaginationSchema = z.object({
|
||||
pageSize: z.union([z.number(), z.string()]).optional(),
|
||||
offset: z.union([z.number(), z.string()]).optional(),
|
||||
pageNum: z.union([z.number(), z.string()]).optional()
|
||||
pageSize: z.union([z.number(), z.string()]).optional().describe('每页条数'),
|
||||
offset: z.union([z.number(), z.string()]).optional().describe('偏移量(与页码二选一)'),
|
||||
pageNum: z.union([z.number(), z.string()]).optional().describe('页码(与偏移量二选一)')
|
||||
});
|
||||
export type PaginationType = z.infer<typeof PaginationSchema>;
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,42 @@
|
|||
import type { OutLinkChatAuthType } from '../../../support/permission/chat/type';
|
||||
import { OutLinkChatAuthSchema } from '../../../support/permission/chat/type';
|
||||
import { ObjectIdSchema } from '../../../common/type/mongo';
|
||||
import z from 'zod';
|
||||
|
||||
export const PresignChatFileGetUrlSchema = z
|
||||
.object({
|
||||
key: z.string().min(1).describe('文件key'),
|
||||
appId: ObjectIdSchema.describe('应用ID'),
|
||||
outLinkAuthData: OutLinkChatAuthSchema.optional().describe('外链鉴权数据')
|
||||
})
|
||||
.meta({
|
||||
example: {
|
||||
key: '1234567890',
|
||||
appId: '1234567890',
|
||||
outLinkAuthData: {
|
||||
shareId: '1234567890',
|
||||
outLinkUid: '1234567890'
|
||||
}
|
||||
}
|
||||
});
|
||||
export type PresignChatFileGetUrlParams = z.infer<typeof PresignChatFileGetUrlSchema>;
|
||||
|
||||
export const PresignChatFilePostUrlSchema = z
|
||||
.object({
|
||||
filename: z.string().min(1).describe('文件名'),
|
||||
appId: ObjectIdSchema.describe('应用ID'),
|
||||
chatId: z.string().min(1).describe('对话ID'),
|
||||
outLinkAuthData: OutLinkChatAuthSchema.optional().describe('外链鉴权数据')
|
||||
})
|
||||
.meta({
|
||||
example: {
|
||||
filename: '1234567890',
|
||||
appId: '1234567890',
|
||||
chatId: '1234567890',
|
||||
outLinkAuthData: {
|
||||
shareId: '1234567890',
|
||||
outLinkUid: '1234567890'
|
||||
}
|
||||
}
|
||||
});
|
||||
export type PresignChatFilePostUrlParams = z.infer<typeof PresignChatFilePostUrlSchema>;
|
||||
|
|
@ -14,81 +14,9 @@ import {
|
|||
} from './api';
|
||||
|
||||
export const ChatFeedbackPath: OpenAPIPath = {
|
||||
'/core/chat/feedback/updateFeedbackReadStatus': {
|
||||
post: {
|
||||
summary: '更新反馈阅读状态',
|
||||
description: '标记指定消息的反馈为已读或未读状态',
|
||||
tags: [TagsMap.chatFeedback],
|
||||
requestBody: {
|
||||
content: {
|
||||
'application/json': {
|
||||
schema: UpdateFeedbackReadStatusBodySchema
|
||||
}
|
||||
}
|
||||
},
|
||||
responses: {
|
||||
200: {
|
||||
description: '成功更新反馈阅读状态',
|
||||
content: {
|
||||
'application/json': {
|
||||
schema: UpdateFeedbackReadStatusResponseSchema
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
'/core/chat/feedback/adminUpdate': {
|
||||
post: {
|
||||
summary: '管理员标注反馈',
|
||||
description: '管理员为指定消息添加或更新标注反馈,包含数据集关联信息',
|
||||
tags: [TagsMap.chatFeedback],
|
||||
requestBody: {
|
||||
content: {
|
||||
'application/json': {
|
||||
schema: AdminUpdateFeedbackBodySchema
|
||||
}
|
||||
}
|
||||
},
|
||||
responses: {
|
||||
200: {
|
||||
description: '成功更新管理员反馈标注',
|
||||
content: {
|
||||
'application/json': {
|
||||
schema: AdminUpdateFeedbackResponseSchema
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
'/core/chat/feedback/closeCustom': {
|
||||
post: {
|
||||
summary: '关闭自定义反馈',
|
||||
description: '删除或关闭指定索引位置的自定义反馈条目',
|
||||
tags: [TagsMap.chatFeedback],
|
||||
requestBody: {
|
||||
content: {
|
||||
'application/json': {
|
||||
schema: CloseCustomFeedbackBodySchema
|
||||
}
|
||||
}
|
||||
},
|
||||
responses: {
|
||||
200: {
|
||||
description: '成功关闭自定义反馈',
|
||||
content: {
|
||||
'application/json': {
|
||||
schema: CloseCustomFeedbackResponseSchema
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
'/core/chat/feedback/updateUserFeedback': {
|
||||
post: {
|
||||
summary: '更新用户反馈',
|
||||
summary: '添加/更新用户反馈',
|
||||
description: '用户对消息添加或更新好评/差评反馈',
|
||||
tags: [TagsMap.chatFeedback],
|
||||
requestBody: {
|
||||
|
|
@ -133,5 +61,77 @@ export const ChatFeedbackPath: OpenAPIPath = {
|
|||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
'/core/chat/feedback/updateFeedbackReadStatus': {
|
||||
post: {
|
||||
summary: '应用管理员-更新反馈阅读状态',
|
||||
description: '标记指定消息的反馈为已读或未读状态',
|
||||
tags: [TagsMap.chatFeedback],
|
||||
requestBody: {
|
||||
content: {
|
||||
'application/json': {
|
||||
schema: UpdateFeedbackReadStatusBodySchema
|
||||
}
|
||||
}
|
||||
},
|
||||
responses: {
|
||||
200: {
|
||||
description: '成功更新反馈阅读状态',
|
||||
content: {
|
||||
'application/json': {
|
||||
schema: UpdateFeedbackReadStatusResponseSchema
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
'/core/chat/feedback/adminUpdate': {
|
||||
post: {
|
||||
summary: '应用管理员-标注反馈',
|
||||
description: '管理员为指定消息添加或更新标注反馈,包含数据集关联信息',
|
||||
tags: [TagsMap.chatFeedback],
|
||||
requestBody: {
|
||||
content: {
|
||||
'application/json': {
|
||||
schema: AdminUpdateFeedbackBodySchema
|
||||
}
|
||||
}
|
||||
},
|
||||
responses: {
|
||||
200: {
|
||||
description: '成功更新管理员反馈标注',
|
||||
content: {
|
||||
'application/json': {
|
||||
schema: AdminUpdateFeedbackResponseSchema
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
'/core/chat/feedback/closeCustom': {
|
||||
post: {
|
||||
summary: '应用管理员-关闭自定义反馈',
|
||||
description: '删除或关闭指定索引位置的自定义反馈条目',
|
||||
tags: [TagsMap.chatFeedback],
|
||||
requestBody: {
|
||||
content: {
|
||||
'application/json': {
|
||||
schema: CloseCustomFeedbackBodySchema
|
||||
}
|
||||
}
|
||||
},
|
||||
responses: {
|
||||
200: {
|
||||
description: '成功关闭自定义反馈',
|
||||
content: {
|
||||
'application/json': {
|
||||
schema: CloseCustomFeedbackResponseSchema
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -5,18 +5,14 @@ import { ChatSourceEnum } from '../../../../core/chat/constants';
|
|||
import { PaginationSchema, PaginationResponseSchema } from '../../../api';
|
||||
|
||||
// Get chat histories schema
|
||||
export const GetHistoriesBodySchema = PaginationSchema.and(
|
||||
OutLinkChatAuthSchema.and(
|
||||
z.object({
|
||||
appId: z.string().optional().describe('应用ID'),
|
||||
source: z.enum(ChatSourceEnum).optional().describe('对话来源'),
|
||||
startCreateTime: z.string().optional().describe('创建时间开始'),
|
||||
endCreateTime: z.string().optional().describe('创建时间结束'),
|
||||
startUpdateTime: z.string().optional().describe('更新时间开始'),
|
||||
endUpdateTime: z.string().optional().describe('更新时间结束')
|
||||
})
|
||||
)
|
||||
);
|
||||
export const GetHistoriesBodySchema = PaginationSchema.extend(OutLinkChatAuthSchema.shape).extend({
|
||||
appId: z.string().optional().describe('应用ID'),
|
||||
source: z.enum(ChatSourceEnum).optional().describe('对话来源'),
|
||||
startCreateTime: z.string().optional().describe('创建时间开始'),
|
||||
endCreateTime: z.string().optional().describe('创建时间结束'),
|
||||
startUpdateTime: z.string().optional().describe('更新时间开始'),
|
||||
endUpdateTime: z.string().optional().describe('更新时间结束')
|
||||
});
|
||||
export type GetHistoriesBodyType = z.infer<typeof GetHistoriesBodySchema>;
|
||||
export const GetHistoriesResponseSchema = PaginationResponseSchema(
|
||||
z.object({
|
||||
|
|
@ -43,20 +39,16 @@ export const UpdateHistoryBodySchema = OutLinkChatAuthSchema.and(
|
|||
export type UpdateHistoryBodyType = z.infer<typeof UpdateHistoryBodySchema>;
|
||||
|
||||
// Delete single chat history schema
|
||||
export const DelChatHistorySchema = OutLinkChatAuthSchema.and(
|
||||
z.object({
|
||||
appId: ObjectIdSchema.describe('应用ID'),
|
||||
chatId: z.string().min(1).describe('对话ID')
|
||||
})
|
||||
);
|
||||
export const DelChatHistorySchema = OutLinkChatAuthSchema.extend({
|
||||
appId: ObjectIdSchema.describe('应用ID'),
|
||||
chatId: z.string().min(1).describe('对话ID')
|
||||
});
|
||||
export type DelChatHistoryType = z.infer<typeof DelChatHistorySchema>;
|
||||
|
||||
// Clear all chat histories schema
|
||||
export const ClearChatHistoriesSchema = OutLinkChatAuthSchema.and(
|
||||
z.object({
|
||||
appId: ObjectIdSchema.describe('应用ID')
|
||||
})
|
||||
);
|
||||
export const ClearChatHistoriesSchema = OutLinkChatAuthSchema.extend({
|
||||
appId: ObjectIdSchema.describe('应用ID')
|
||||
});
|
||||
export type ClearChatHistoriesType = z.infer<typeof ClearChatHistoriesSchema>;
|
||||
|
||||
// Batch delete chat histories schema (for log manager)
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ import { ChatFeedbackPath } from './feedback/index';
|
|||
import { ChatHistoryPath } from './history/index';
|
||||
import { z } from 'zod';
|
||||
import { CreatePostPresignedUrlResultSchema } from '../../../../service/common/s3/type';
|
||||
import { PresignChatFileGetUrlSchema, PresignChatFilePostUrlSchema } from '../../../core/chat/api';
|
||||
import { PresignChatFileGetUrlSchema, PresignChatFilePostUrlSchema } from './api';
|
||||
import { TagsMap } from '../../tag';
|
||||
|
||||
export const ChatPath: OpenAPIPath = {
|
||||
|
|
@ -14,34 +14,10 @@ export const ChatPath: OpenAPIPath = {
|
|||
...ChatFeedbackPath,
|
||||
...ChatHistoryPath,
|
||||
|
||||
'/core/chat/presignChatFileGetUrl': {
|
||||
post: {
|
||||
summary: '获取对话文件预签名 URL',
|
||||
description: '获取对话文件的预签名 URL',
|
||||
tags: [TagsMap.chatPage],
|
||||
requestBody: {
|
||||
content: {
|
||||
'application/json': {
|
||||
schema: PresignChatFileGetUrlSchema
|
||||
}
|
||||
}
|
||||
},
|
||||
responses: {
|
||||
200: {
|
||||
description: '成功获取对话文件预签名 URL',
|
||||
content: {
|
||||
'application/json': {
|
||||
schema: z.string()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
'/core/chat/presignChatFilePostUrl': {
|
||||
post: {
|
||||
summary: '上传对话文件预签名 URL',
|
||||
description: '上传对话文件的预签名 URL',
|
||||
summary: '获取文件上传 URL',
|
||||
description: '获取文件上传 URL',
|
||||
tags: [TagsMap.chatPage],
|
||||
requestBody: {
|
||||
content: {
|
||||
|
|
@ -61,5 +37,29 @@ export const ChatPath: OpenAPIPath = {
|
|||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
'/core/chat/presignChatFileGetUrl': {
|
||||
post: {
|
||||
summary: '获取文件预览地址',
|
||||
description: '获取文件预览地址',
|
||||
tags: [TagsMap.chatPage],
|
||||
requestBody: {
|
||||
content: {
|
||||
'application/json': {
|
||||
schema: PresignChatFileGetUrlSchema
|
||||
}
|
||||
}
|
||||
},
|
||||
responses: {
|
||||
200: {
|
||||
description: '成功获取对话文件预签名 URL',
|
||||
content: {
|
||||
'application/json': {
|
||||
schema: z.string()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -12,5 +12,5 @@ export const TeamChatAuthSchema = z.object({
|
|||
});
|
||||
export type TeamChatAuthProps = z.infer<typeof TeamChatAuthSchema>;
|
||||
|
||||
export const OutLinkChatAuthSchema = ShareChatAuthSchema.and(TeamChatAuthSchema);
|
||||
export const OutLinkChatAuthSchema = ShareChatAuthSchema.extend(TeamChatAuthSchema.shape);
|
||||
export type OutLinkChatAuthProps = z.infer<typeof OutLinkChatAuthSchema>;
|
||||
|
|
|
|||
|
|
@ -140,9 +140,13 @@ export const loadSystemModels = async (init = false, language = 'en') => {
|
|||
type: dbModel?.metadata?.type || model.type,
|
||||
isCustom: false,
|
||||
|
||||
...(model.type === ModelTypeEnum.llm && {
|
||||
maxResponse: model.maxTokens || 4000
|
||||
}),
|
||||
|
||||
...(model.type === ModelTypeEnum.llm && dbModel?.metadata?.type === ModelTypeEnum.llm
|
||||
? {
|
||||
maxResponse: dbModel?.metadata?.maxResponse ?? model.maxTokens ?? 1000,
|
||||
maxResponse: dbModel?.metadata?.maxResponse ?? model.maxTokens ?? 4000,
|
||||
defaultConfig: mergeObject(model.defaultConfig, dbModel?.metadata?.defaultConfig),
|
||||
fieldMap: mergeObject(model.fieldMap, dbModel?.metadata?.fieldMap),
|
||||
maxTokens: undefined
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ import type { ApiRequestProps } from '@fastgpt/service/type/next';
|
|||
import { NextAPI } from '@/service/middleware/entry';
|
||||
import { getS3ChatSource } from '@fastgpt/service/common/s3/sources/chat';
|
||||
import { authChatCrud } from '@/service/support/permission/auth/chat';
|
||||
import type { PresignChatFileGetUrlParams } from '@fastgpt/global/core/chat/api';
|
||||
import type { PresignChatFileGetUrlParams } from '@fastgpt/global/openapi/core/chat/api';
|
||||
|
||||
async function handler(req: ApiRequestProps<PresignChatFileGetUrlParams>): Promise<string> {
|
||||
const { key, appId, outLinkAuthData } = req.body;
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ import { getS3ChatSource } from '@fastgpt/service/common/s3/sources/chat';
|
|||
import { authChatCrud } from '@/service/support/permission/auth/chat';
|
||||
import { authFrequencyLimit } from '@/service/common/frequencyLimit/api';
|
||||
import { addSeconds } from 'date-fns';
|
||||
import type { PresignChatFilePostUrlParams } from '@fastgpt/global/core/chat/api';
|
||||
import type { PresignChatFilePostUrlParams } from '@fastgpt/global/openapi/core/chat/api';
|
||||
|
||||
const authUploadLimit = (tmbId: string) => {
|
||||
if (!global.feConfigs.uploadFileMaxAmount) return;
|
||||
|
|
|
|||
Loading…
Reference in New Issue