feat: 添加公司AI管理平台基础架构 添加了完整的FastAPI后端项目结构,包括: - 环境配置文件(.env.example)和项目说明文档(README.md、AGENTS.md) - Dockerfile用于容器化部署 - 核心基础设施:配置管理、数据库连接、调度器、安全认证 - 模块化设计:AI代理、审批流程、审计日志、业务台账等功能模块 - 支持多数据库连接(主库和遗留系统只读库) - AI适配器支持OpenClaw、Hermes、OpenAI兼容接口 - 飞书集成、报表生成、风险监控等企业级功能 - 完整的依赖管理和测试指南 ```
55 lines
1.4 KiB
Python
55 lines
1.4 KiB
Python
from typing import Any
|
|
|
|
from pydantic import BaseModel, Field
|
|
|
|
|
|
class ReadonlyQueryRequest(BaseModel):
|
|
"""Readonly SQL query request for the legacy MySQL connection."""
|
|
|
|
sql: str = Field(..., description="Readonly SELECT statement.")
|
|
params: dict[str, Any] = Field(default_factory=dict)
|
|
limit: int = Field(default=100, ge=1, le=500)
|
|
|
|
|
|
class QueryResult(BaseModel):
|
|
"""Tabular query result returned as JSON rows."""
|
|
|
|
columns: list[str]
|
|
rows: list[dict[str, Any]]
|
|
row_count: int
|
|
|
|
|
|
class LegacyProjectRecord(BaseModel):
|
|
"""Raw project row from the legacy project system."""
|
|
|
|
data: dict[str, Any]
|
|
|
|
|
|
class LegacyProjectSyncRequest(BaseModel):
|
|
"""Request body for syncing legacy projects into the internal ledger."""
|
|
|
|
source_query: str | None = Field(
|
|
default=None,
|
|
description="Optional SELECT query for project sync.",
|
|
)
|
|
field_map: dict[str, str] = Field(
|
|
default_factory=dict,
|
|
description=(
|
|
"Map internal project fields to legacy row fields, "
|
|
"e.g. {'name': 'project_name'}."
|
|
),
|
|
)
|
|
limit: int = Field(default=100, ge=1, le=500)
|
|
dry_run: bool = True
|
|
actor: str = "api"
|
|
|
|
|
|
class LegacyProjectSyncResult(BaseModel):
|
|
"""Summary of a legacy project sync operation."""
|
|
|
|
dry_run: bool
|
|
created: int
|
|
updated: int
|
|
skipped: int
|
|
items: list[dict[str, Any]]
|