feat:新增投顾agent和nl2sqlagent

This commit is contained in:
2026-09-13 16:19:24 +08:00
parent c80c6acac0
commit 163192bf55
122 changed files with 7488 additions and 362 deletions
+26
View File
@@ -0,0 +1,26 @@
"""NL2SQL 进程内运行时配置。"""
from __future__ import annotations
from pydantic import BaseModel, ConfigDict, Field
class Nl2SqlRuntimeConfig(BaseModel):
"""可由管理员动态调整的非敏感查询参数。"""
model_config = ConfigDict(extra="forbid", validate_assignment=True)
cache_ttl: int = Field(default=300, ge=30, le=86400)
retrieval_top_k: int = Field(default=5, ge=1, le=50)
retrieval_threshold: float = Field(default=0.0, ge=0.0, le=1.0)
max_rows: int = Field(default=1000, ge=1, le=100000)
max_join_depth: int = Field(default=3, ge=0, le=10)
def update(self, **values: object) -> dict:
"""校验并更新配置,返回当前完整配置。"""
updated = self.model_copy(update=values)
for key, value in updated.model_dump().items():
setattr(self, key, value)
return self.model_dump()
runtime_config = Nl2SqlRuntimeConfig()