INNER CODE UNIT · Python
post_triage_comment
skyportal/skyportal · services/assistant/app.py:515
def post_triage_comment(session, author_id, notify, context_type, context_id, answer):
"""Post the full triage as a bot comment on the source, visible to the query's
group(s). Only for source-scoped query runs, whose notify carries
``comment_groups``; interactive chats (no comment_groups) never post.
"""
if not isinstance(notify, dict):
return
group_ids = notify.get("comment_groups") or []
text = (answer or "").strip()
if not (group_ids and context_type == "source" and context_id and text):
return
author = session.scalar(sa.select(User).where(User.id == author_id))
groups = [group for group in author.accessible_groups if group.id in group_ids]
if not groups:
return
session.add(
Comment(
text=text,