feat: M4 seed — upload & publish 20 rule sets, fix config/schema column names

- Fix _export_settings for pydantic v2 compatibility (model_fields)
- Fix delete_time→deleted_at, update_time→updated_at in RuleServiceImpl
- Add OssClient.EnsureBucket method
- Replace contract_lease/sale/tech rules.yaml from new-rules
- Seed script: batch upload 20 rule YAMLs to OSS + write DB + publish
- Config: fix OSS import chain
This commit is contained in:
wren
2026-04-28 12:13:46 +08:00
parent 246c0e5ded
commit 2d108c8381
11 changed files with 9208 additions and 2819 deletions
+16 -6
View File
@@ -19,15 +19,25 @@ from ._settings import app, jwt, db, redis, oss, llm, vlm, ocr, leaudit as _leau
def _export_settings(instance: object, prefix: str = "") -> dict[str, object]:
"""将 Settings 实例的所有字段和 @property 导出为模块级变量。"""
result: dict[str, object] = {}
# pydantic v2 model_fields
model_fields = getattr(instance, "model_fields", None)
if isinstance(model_fields, dict):
for key in model_fields:
if key.startswith("_"):
continue
result[key] = getattr(instance, key)
# @property 和普通属性
for key in dir(type(instance)):
if key.startswith("_"):
if key.startswith("_") or key in result:
continue
value = getattr(instance, key, None)
if callable(value) and not isinstance(value, property):
attr = getattr(type(instance), key, None)
if attr is None:
continue
if isinstance(value, property):
value = value.__get__(instance)
result[key] = value
if isinstance(attr, property):
result[key] = attr.__get__(instance)
return result