mirror of
https://github.com/labring/FastGPT.git
synced 2026-05-02 01:02:05 +08:00
perf: index (#6131)
* perf: index * stop design doc * perf: stop workflow;perf: mongo connection * fix: ts * mq export
This commit is contained in:
@@ -1,8 +1,38 @@
|
||||
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';
|
||||
|
||||
/* ============ v2/chat/stop ============ */
|
||||
export const StopV2ChatSchema = z
|
||||
.object({
|
||||
appId: ObjectIdSchema.describe('应用ID'),
|
||||
chatId: z.string().min(1).describe('对话ID'),
|
||||
outLinkAuthData: OutLinkChatAuthSchema.optional().describe('外链鉴权数据')
|
||||
})
|
||||
.meta({
|
||||
example: {
|
||||
appId: '1234567890',
|
||||
chatId: '1234567890',
|
||||
outLinkAuthData: {
|
||||
shareId: '1234567890',
|
||||
outLinkUid: '1234567890'
|
||||
}
|
||||
}
|
||||
});
|
||||
export type StopV2ChatParams = z.infer<typeof StopV2ChatSchema>;
|
||||
|
||||
export const StopV2ChatResponseSchema = z
|
||||
.object({
|
||||
success: z.boolean().describe('是否成功停止')
|
||||
})
|
||||
.meta({
|
||||
example: {
|
||||
success: true
|
||||
}
|
||||
});
|
||||
export type StopV2ChatResponse = z.infer<typeof StopV2ChatResponseSchema>;
|
||||
|
||||
/* ============ chat file ============ */
|
||||
export const PresignChatFileGetUrlSchema = z
|
||||
.object({
|
||||
key: z.string().min(1).describe('文件key'),
|
||||
|
||||
@@ -5,7 +5,12 @@ 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 './api';
|
||||
import {
|
||||
PresignChatFileGetUrlSchema,
|
||||
PresignChatFilePostUrlSchema,
|
||||
StopV2ChatSchema,
|
||||
StopV2ChatResponseSchema
|
||||
} from './api';
|
||||
import { TagsMap } from '../../tag';
|
||||
|
||||
export const ChatPath: OpenAPIPath = {
|
||||
@@ -14,6 +19,31 @@ export const ChatPath: OpenAPIPath = {
|
||||
...ChatFeedbackPath,
|
||||
...ChatHistoryPath,
|
||||
|
||||
'/v2/chat/stop': {
|
||||
post: {
|
||||
summary: '停止 Agent 运行',
|
||||
description: `优雅停止正在运行的 Agent, 会尝试等待当前节点结束后返回,最长 5s,超过 5s 仍未结束,则会返回成功。
|
||||
LLM 节点,流输出时会同时被终止,但 HTTP 请求节点这种可能长时间运行的,不会被终止。`,
|
||||
tags: [TagsMap.chatPage],
|
||||
requestBody: {
|
||||
content: {
|
||||
'application/json': {
|
||||
schema: StopV2ChatSchema
|
||||
}
|
||||
}
|
||||
},
|
||||
responses: {
|
||||
200: {
|
||||
description: '成功停止工作流',
|
||||
content: {
|
||||
'application/json': {
|
||||
schema: StopV2ChatResponseSchema
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
'/core/chat/presignChatFilePostUrl': {
|
||||
post: {
|
||||
summary: '获取文件上传 URL',
|
||||
|
||||
Reference in New Issue
Block a user