Files
group_xinghuo_jinrong/scripts/sync/sync_template_vectors.py
T
zhanghongyu_0626 70aa861983 feat(advisor-agent): Introduce advisor agent functionalities with compliance, KYC, and script templates
- Added new modules for advisor compliance, KYC sessions, and script templates, enhancing the advisor agent's capabilities.
- Implemented a comprehensive API structure under the `/api/advisor-agent` prefix, ensuring clear organization and access to new features.
- Established database models and repositories for compliance rules and KYC sessions, facilitating robust data management.
- Integrated exception handling and response models to improve error management and user feedback.
- Updated settings to include new configurations for compliance and KYC features, ensuring flexibility and adaptability.

This update significantly expands the advisor agent's functionality, providing essential tools for compliance and customer interaction while maintaining a structured API design.
2026-09-12 16:33:07 +08:00

37 lines
1.3 KiB
Python

"""Rebuild Milvus vectors for approved script templates."""
from __future__ import annotations
import argparse
import sys
from pathlib import Path
ROOT = Path(__file__).resolve().parents[2]
sys.path.insert(0, str(ROOT))
from app.repository.script_template_repository import ScriptTemplateRepository
from app.service.script_template_vector_service import ScriptScriptTemplateVectorService
def main() -> None:
parser = argparse.ArgumentParser(description="Sync approved script templates to Milvus.")
parser.add_argument("--dry-run", action="store_true", help="Only count approved active templates.")
parser.add_argument("--created-by", default=None, help="Optional created_by filter for development checks.")
args = parser.parse_args()
repository = ScriptTemplateRepository()
if args.dry_run:
total = len(repository.list_vector_candidates(created_by=args.created_by))
print(f"Template vector sync dry run: total={total}")
return
result = ScriptScriptTemplateVectorService(repository=repository).sync_approved_templates(created_by=args.created_by)
print(
"Template vector sync: "
f"total={result.total}, upserted={result.upserted}, skipped={result.skipped}"
)
if __name__ == "__main__":
main()