feat: add feishu question preview services

This commit is contained in:
2026-06-07 22:16:36 +08:00
parent be7fbab0a0
commit bd9b2e872e
7 changed files with 288 additions and 0 deletions

View File

@@ -0,0 +1,21 @@
from __future__ import annotations
from django.contrib.auth import get_user_model
from django.core.management.base import BaseCommand, CommandError
from review_agent.feishu_questions.service import answer_question
class Command(BaseCommand):
help = "Simulate a reserved Feishu question against local workflow data."
def add_arguments(self, parser):
parser.add_argument("--username", required=True, help="System username used as asker.")
parser.add_argument("question", help="Question text, for example: 查最新法规核查")
def handle(self, *args, **options):
user = get_user_model().objects.filter(username=options["username"]).first()
if not user:
raise CommandError(f"用户不存在:{options['username']}")
result = answer_question(user, options["question"])
self.stdout.write(result.get("answer_summary") or "无可返回摘要。")