mirror of
https://github.com/Sea-Haven-Industries/open-swe.git
synced 2026-10-05 15:22:11 +00:00
fix: use get_recent_comments() in multimodal fallback and fix NameError
This commit is contained in:
parent
fd992be44e
commit
19cdb32f05
1 changed files with 2 additions and 13 deletions
|
|
@ -603,15 +603,11 @@ async def process_linear_issue( # noqa: PLR0912, PLR0915
|
||||||
comment_ids: set[str] = set()
|
comment_ids: set[str] = set()
|
||||||
comment_id_to_index: dict[str, int] = {}
|
comment_id_to_index: dict[str, int] = {}
|
||||||
if comments:
|
if comments:
|
||||||
last_bot_comment_idx = -1
|
|
||||||
for i, comment in enumerate(comments):
|
for i, comment in enumerate(comments):
|
||||||
comment_id = comment.get("id", "")
|
comment_id = comment.get("id", "")
|
||||||
if comment_id:
|
if comment_id:
|
||||||
comment_ids.add(comment_id)
|
comment_ids.add(comment_id)
|
||||||
comment_id_to_index[comment_id] = i
|
comment_id_to_index[comment_id] = i
|
||||||
body = comment.get("body", "")
|
|
||||||
if any(body.startswith(prefix) for prefix in bot_message_prefixes):
|
|
||||||
last_bot_comment_idx = i
|
|
||||||
|
|
||||||
relevant_comments = []
|
relevant_comments = []
|
||||||
trigger_index = None
|
trigger_index = None
|
||||||
|
|
@ -624,18 +620,11 @@ async def process_linear_issue( # noqa: PLR0912, PLR0915
|
||||||
trigger_index,
|
trigger_index,
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
for i, comment in enumerate(comments):
|
relevant_comments = get_recent_comments(comments, bot_message_prefixes)
|
||||||
if i <= last_bot_comment_idx:
|
|
||||||
continue
|
|
||||||
body = comment.get("body", "")
|
|
||||||
if "@openswe" in body.lower():
|
|
||||||
relevant_comments.append(comment)
|
|
||||||
relevant_comments.extend(comments[i + 1 :])
|
|
||||||
break
|
|
||||||
|
|
||||||
if relevant_comments:
|
if relevant_comments:
|
||||||
comments_text = "\n\n## Comments:\n"
|
comments_text = "\n\n## Comments:\n"
|
||||||
for comment in recent_user_comments:
|
for comment in relevant_comments:
|
||||||
author = comment.get("user", {}).get("name", "Unknown")
|
author = comment.get("user", {}).get("name", "Unknown")
|
||||||
body = comment.get("body", "")
|
body = comment.get("body", "")
|
||||||
body_image_urls = extract_image_urls(body)
|
body_image_urls = extract_image_urls(body)
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue