mirror of
https://github.com/fastapiadmin/FastapiAdmin.git
synced 2026-09-22 13:05:18 +00:00
- 新增代码生成模块路由支持 - 重构 MCP 服务器API,支持增删改查接口和分页查询 - 实现 MCP 智能对话的流式响应和 WebSocket 通信 - 优化 MCP 数据模型,支持环境变量等配置项 - 改进 MCP CRUD 层,集成权限控制和统一操作方法 - 优化异常处理,提升接口错误信息准确性 - 修正依赖导入和数据校验,增强代码健壮性
33 lines
1.2 KiB
Python
33 lines
1.2 KiB
Python
# -*- coding: utf-8 -*-
|
|
|
|
from typing import Optional, Dict, Any
|
|
from pydantic import ConfigDict, Field, HttpUrl, BaseModel
|
|
|
|
from app.core.base_schema import BaseSchema
|
|
from app.common.enums import McpLLMProvider, McpType
|
|
|
|
|
|
class ChatQuerySchema(BaseModel):
|
|
"""聊天查询模型"""
|
|
message: str = Field(..., min_length=1, max_length=4000, description="聊天消息")
|
|
|
|
|
|
class McpCreateSchema(BaseModel):
|
|
"""创建 MCP 服务器参数"""
|
|
name: str = Field(..., max_length=50, description='MCP 名称')
|
|
type: McpType = Field(McpType.stdio, description='MCP 类型')
|
|
description: Optional[str] = Field(None, max_length=255, description='MCP 描述')
|
|
url: Optional[HttpUrl] = Field(None, description='远程 SSE 地址')
|
|
command: Optional[str] = Field(None, max_length=255, description='MCP 命令')
|
|
args: Optional[str] = Field(None, max_length=255, description='MCP 命令参数,多个参数用英文逗号隔开')
|
|
env: Optional[Dict[str, Any]] = Field(None, description='MCP 环境变量')
|
|
|
|
|
|
class McpUpdateSchema(McpCreateSchema):
|
|
"""更新 MCP 服务器参数"""
|
|
...
|
|
|
|
|
|
class McpOutSchema(McpCreateSchema, BaseSchema):
|
|
"""MCP 服务器详情"""
|
|
model_config = ConfigDict(from_attributes=True) |