mirror of
https://github.com/labring/FastGPT.git
synced 2026-05-07 01:02:55 +08:00
V4.14.9 dev (#6555)
* feat: encapsulate logger (#6535) * feat: encapsulate logger * update engines --------- Co-authored-by: archer <545436317@qq.com> * next config * dev shell * Agent sandbox (#6532) * docs: switch to docs layout and apply black theme (#6533) * feat: add Gemini 3.1 models - Add gemini-3.1-pro-preview (released February 19, 2026) - Add gemini-3.1-flash-lite-preview (released March 3, 2026) Both models support: - 1M context window - 64k max response - Vision - Tool choice * docs: switch to docs layout and apply black theme - Change layout from notebook to docs - Update logo to icon + text format - Apply fumadocs black theme - Simplify global.css (keep only navbar and TOC styles) - Fix icon components to properly accept className props - Add mobile text overflow handling - Update Node engine requirement to >=20.x * doc * doc * lock * fix: ts * doc * doc --------- Co-authored-by: archer <archer@archerdeMac-mini.local> Co-authored-by: archer <545436317@qq.com> * Doc (#6493) * cloud doc * doc refactor * doc move * seo * remove doc * yml * doc * fix: tsconfig * fix: tsconfig * sandbox version (#6497) * sandbox version * add sandbox log * update lock * fix * fix: sandbox * doc * add console * i18n * sandbxo in agent * feat: agent sandbox * lock * feat: sandbox ui * sandbox check exists * env tempalte * doc * lock * sandbox in chat window * sandbox entry * fix: test * rename var * sandbox config tip * update sandbox lifecircle * update prompt * rename provider test * sandbox logger * yml --------- Co-authored-by: Archer <archer@fastgpt.io> Co-authored-by: archer <archer@archerdeMac-mini.local> * perf: sandbox error tip * Add sandbox limit and fix some issue (#6550) * sandbox in plan * fix: some issue * fix: test * editor default path * fix: comment * perf: sandbox worksapce * doc * perf: del sandbox * sandbox build * fix: test * fix: pr comment --------- Co-authored-by: Ryo <whoeverimf5@gmail.com> Co-authored-by: Archer <archer@fastgpt.io> Co-authored-by: archer <archer@archerdeMac-mini.local>
This commit is contained in:
@@ -1,8 +1,11 @@
|
||||
import type { OpenAPIPath } from '../../type';
|
||||
import { TagsMap } from '../../tag';
|
||||
import { GetLLMRequestRecordParamsSchema, LLMRequestRecordSchema } from './api';
|
||||
import { SandboxPath } from './sandbox';
|
||||
|
||||
export const AIPath: OpenAPIPath = {
|
||||
...SandboxPath,
|
||||
|
||||
'/core/ai/record/getRecord': {
|
||||
get: {
|
||||
summary: '获取 LLM 请求追踪记录',
|
||||
|
||||
@@ -0,0 +1,80 @@
|
||||
import { OutLinkChatAuthSchema } from '../../../../support/permission/chat';
|
||||
import { z } from 'zod';
|
||||
|
||||
/**
|
||||
* 文件操作 - 统一请求体
|
||||
*/
|
||||
export const SandboxFileOperationBodySchema = z.discriminatedUnion('action', [
|
||||
z.object({
|
||||
action: z.literal('list'),
|
||||
appId: z.string(),
|
||||
chatId: z.string(),
|
||||
path: z.string().default('.').describe('目录路径'),
|
||||
outLinkAuthData: OutLinkChatAuthSchema.optional().describe('外链鉴权数据')
|
||||
}),
|
||||
z.object({
|
||||
action: z.literal('read'),
|
||||
appId: z.string(),
|
||||
chatId: z.string(),
|
||||
path: z.string().describe('文件路径'),
|
||||
outLinkAuthData: OutLinkChatAuthSchema.optional().describe('外链鉴权数据')
|
||||
}),
|
||||
z.object({
|
||||
action: z.literal('write'),
|
||||
appId: z.string(),
|
||||
chatId: z.string(),
|
||||
path: z.string().describe('文件路径'),
|
||||
content: z.string().describe('文件内容'),
|
||||
outLinkAuthData: OutLinkChatAuthSchema.optional().describe('外链鉴权数据')
|
||||
})
|
||||
]);
|
||||
|
||||
export type SandboxFileOperationBody = z.infer<typeof SandboxFileOperationBodySchema>;
|
||||
|
||||
/**
|
||||
* 文件项
|
||||
*/
|
||||
export const SandboxFileItemSchema = z.object({
|
||||
name: z.string().describe('文件名'),
|
||||
path: z.string().describe('完整路径'),
|
||||
type: z.enum(['file', 'directory']).describe('文件类型'),
|
||||
size: z.number().optional().describe('文件大小(字节数)')
|
||||
});
|
||||
|
||||
export type SandboxFileItem = z.infer<typeof SandboxFileItemSchema>;
|
||||
|
||||
/**
|
||||
* 文件操作 - 响应体
|
||||
*/
|
||||
export const SandboxFileOperationResponseSchema = z.union([
|
||||
z.object({
|
||||
action: z.literal('list'),
|
||||
files: z.array(SandboxFileItemSchema)
|
||||
}),
|
||||
z.object({
|
||||
action: z.literal('read'),
|
||||
content: z.string().describe('文件内容')
|
||||
}),
|
||||
z.object({
|
||||
action: z.literal('write'),
|
||||
success: z.boolean()
|
||||
})
|
||||
]);
|
||||
|
||||
export type SandboxFileOperationResponse = z.infer<typeof SandboxFileOperationResponseSchema>;
|
||||
|
||||
/**
|
||||
* 检查沙盒是否存在
|
||||
*/
|
||||
export const SandboxCheckExistBodySchema = z.object({
|
||||
appId: z.string(),
|
||||
chatId: z.string(),
|
||||
outLinkAuthData: OutLinkChatAuthSchema.optional().describe('外链鉴权数据')
|
||||
});
|
||||
|
||||
export const SandboxCheckExistResponseSchema = z.object({
|
||||
exists: z.boolean().describe('沙盒是否存在')
|
||||
});
|
||||
|
||||
export type SandboxCheckExistBody = z.infer<typeof SandboxCheckExistBodySchema>;
|
||||
export type SandboxCheckExistResponse = z.infer<typeof SandboxCheckExistResponseSchema>;
|
||||
@@ -0,0 +1,90 @@
|
||||
import type { OpenAPIPath } from '../../../type';
|
||||
import { TagsMap } from '../../../tag';
|
||||
import {
|
||||
SandboxFileOperationBodySchema,
|
||||
SandboxFileOperationResponseSchema,
|
||||
SandboxCheckExistBodySchema,
|
||||
SandboxCheckExistResponseSchema
|
||||
} from './api';
|
||||
|
||||
export const SandboxPath: OpenAPIPath = {
|
||||
'/core/ai/sandbox/file': {
|
||||
post: {
|
||||
summary: '沙盒文件操作',
|
||||
description: '统一文件操作接口,支持列出目录(list)、读取文件(read)、写入文件(write)',
|
||||
tags: [TagsMap.sandbox],
|
||||
requestBody: {
|
||||
content: {
|
||||
'application/json': {
|
||||
schema: SandboxFileOperationBodySchema
|
||||
}
|
||||
}
|
||||
},
|
||||
responses: {
|
||||
200: {
|
||||
description: '操作成功',
|
||||
content: {
|
||||
'application/json': {
|
||||
schema: SandboxFileOperationResponseSchema
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
'/core/ai/sandbox/download': {
|
||||
post: {
|
||||
summary: '下载沙盒文件或目录',
|
||||
description: '将指定路径的文件或目录打包为 zip 并下载',
|
||||
tags: [TagsMap.sandbox],
|
||||
requestBody: {
|
||||
content: {
|
||||
'application/json': {
|
||||
schema: SandboxCheckExistBodySchema.extend({
|
||||
path: SandboxFileOperationBodySchema.options[0].shape.path
|
||||
})
|
||||
}
|
||||
}
|
||||
},
|
||||
responses: {
|
||||
200: {
|
||||
description: '返回 zip 文件流',
|
||||
content: {
|
||||
'application/octet-stream': {
|
||||
schema: {
|
||||
type: 'string',
|
||||
format: 'binary'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
'/core/ai/sandbox/checkExist': {
|
||||
post: {
|
||||
summary: '检查沙盒是否存在',
|
||||
description: '根据 appId 和 chatId 检查对应的沙盒实例是否存在',
|
||||
tags: [TagsMap.sandbox],
|
||||
requestBody: {
|
||||
content: {
|
||||
'application/json': {
|
||||
schema: SandboxCheckExistBodySchema
|
||||
}
|
||||
}
|
||||
},
|
||||
responses: {
|
||||
200: {
|
||||
description: '返回沙盒是否存在',
|
||||
content: {
|
||||
'application/json': {
|
||||
schema: SandboxCheckExistResponseSchema
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user