Apply suggestions from code review

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This commit is contained in:
盐粒 Yanli 2026-03-25 19:45:36 +08:00 committed by GitHub
parent bc82676d93
commit e819a9a5f7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 9 additions and 5 deletions

View File

@ -523,7 +523,8 @@ class AdvancedChatAppGenerator(MessageBasedAppGenerator):
with Session(bind=db.engine, expire_on_commit=False) as session:
workflow = _refresh_model(session=session, model=workflow)
message = _refresh_model(session=session, model=message)
assert message is not None
if message is None:
raise RuntimeError("Failed to refresh Message; _refresh_model returned None.")
# workflow_ = session.get(Workflow, workflow.id)
# assert workflow_ is not None
# workflow = workflow_

View File

@ -166,8 +166,8 @@ class ChatAppGenerator(MessageBasedAppGenerator):
# init generate records
(conversation, message) = self._init_generate_records(application_generate_entity, conversation)
assert conversation is not None
assert message is not None
if conversation is None or message is None:
raise RuntimeError("_init_generate_records() returned None for conversation or message")
generated_conversation_id = str(conversation.id)
generated_message_id = str(message.id)

View File

@ -149,8 +149,11 @@ class CompletionAppGenerator(MessageBasedAppGenerator):
# init generate records
(conversation, message) = self._init_generate_records(application_generate_entity)
assert conversation is not None
assert message is not None
if conversation is None or message is None:
raise RuntimeError(
"_init_generate_records() returned None for conversation or message, "
"which is required to proceed with generation."
)
# init queue manager
queue_manager = MessageBasedAppQueueManager(