feat: add feishu question preview services
This commit is contained in:
21
review_agent/management/commands/feishu_question_simulate.py
Normal file
21
review_agent/management/commands/feishu_question_simulate.py
Normal 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 "无可返回摘要。")
|
||||
Reference in New Issue
Block a user