mirror of
https://github.com/fastapiadmin/FastapiAdmin.git
synced 2026-09-22 05:02:57 +00:00
refactor: 重构查询参数处理逻辑,统一搜索参数处理
- 移除各模块查询schema中的自定义model_validator,统一通过search_to_dict处理搜索参数 - 为需要的字段添加json_schema_extra标记查询操作类型 - 重构base_crud的条件解析逻辑,支持直接处理普通字符串、数字类型参数 - 重构base_schema中的公共查询参数校验逻辑,简化时间范围和创建更新人参数处理 - 修复菜单查询的异步懒加载问题,添加多级预加载 - 调整日志打印配置,关闭uvicorn.access重复日志 - 修复前端路由跳转路径错误 - 调整弹窗宽度适配内容 - 修复测试环境限流器未注册问题 - 清理无用的导入和废弃函数
This commit is contained in:
@@ -38,7 +38,7 @@ async def get_session_detail_controller(
|
||||
async def get_session_list_controller(
|
||||
auth: Annotated[AuthSchema, Security(AuthPermission(["module_ai:chat:query"]))],
|
||||
page: Annotated[PaginationQueryParam, Depends()],
|
||||
search: Annotated[ChatSessionQueryParam, Query(description="查询参数")],
|
||||
search: Annotated[ChatSessionQueryParam, Query()],
|
||||
) -> JSONResponse:
|
||||
service = ChatService(auth)
|
||||
result_dict = await service.page(
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
from typing import Any
|
||||
|
||||
from pydantic import BaseModel, ConfigDict, Field, field_validator, model_validator
|
||||
from pydantic import BaseModel, ConfigDict, Field, field_validator
|
||||
|
||||
from app.common.enums import QueueEnum
|
||||
from app.core.base_schema import BaseQueryParam, TenantByQueryParam, UserByQueryParam
|
||||
|
||||
|
||||
@@ -57,13 +56,9 @@ class ChatSessionMessageSchema(BaseModel):
|
||||
class ChatSessionQueryParam(BaseQueryParam, UserByQueryParam, TenantByQueryParam):
|
||||
"""会话查询参数"""
|
||||
|
||||
title: str | tuple[str, str] | None = Field(None, description="会话标题")
|
||||
title: str | None = Field(None, description="会话标题")
|
||||
|
||||
|
||||
@model_validator(mode="after")
|
||||
def validate_query_params(self) -> "ChatSessionQueryParam":
|
||||
if isinstance(self.title, str):
|
||||
self.title = (QueueEnum.like.value, self.title)
|
||||
return self
|
||||
|
||||
|
||||
class AiChatRequestSchema(BaseModel):
|
||||
|
||||
Reference in New Issue
Block a user