mirror of
https://github.com/fastapiadmin/FastapiAdmin.git
synced 2026-09-26 06:19:04 +00:00
refactor(validator): 优化日期验证器并修复序列化问题 refactor(controller): 移除未使用的导入和接口 refactor(service): 优化类型提示和错误处理 fix(model): 修复JobLogModel字段定义 style(param): 移除未使用的导入和优化时间处理逻辑 fix(service): 修复服务器监控信息返回格式 fix(auth): 增强登录验证和错误处理 fix(dict): 修复字典数据状态更新逻辑 refactor(job): 优化任务服务和日志查询逻辑
34 lines
1.1 KiB
Python
34 lines
1.1 KiB
Python
# -*- coding: utf-8 -*-
|
|
|
|
from typing import Optional, List
|
|
from fastapi import Query
|
|
from pydantic import Field
|
|
|
|
from app.core.base_schema import BaseSchema
|
|
from app.common.enums import McpLLMProvider
|
|
|
|
|
|
class McpQueryParam:
|
|
"""MCP 服务器查询参数"""
|
|
|
|
def __init__(
|
|
self,
|
|
name: Optional[str] = Query(None, description="MCP 名称"),
|
|
type: Optional[int] = Query(None, description="MCP 类型"),
|
|
) -> None:
|
|
|
|
# 模糊查询字段
|
|
self.name = ("like", name) if name else None
|
|
|
|
# 精确查询字段
|
|
self.type = type
|
|
|
|
|
|
class McpChatParam(BaseSchema):
|
|
"""MCP 聊天参数"""
|
|
pk: List[int] = Field(..., description='MCP ID 列表')
|
|
provider: McpLLMProvider = Field(McpLLMProvider.openai, description='LLM 供应商')
|
|
model: str = Field(..., description='LLM 名称')
|
|
key: str = Field(..., description='LLM API Key')
|
|
base_url: Optional[str] = Field(None, description='自定义 LLM API 地址,必须兼容 openai 供应商')
|
|
prompt: str = Field(..., description='用户提示词') |