Skip to content

Commit ac0245a

Browse files
fix: sort tests for citations
1 parent 56caac0 commit ac0245a

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

packages/slackBotFunction/app/slack/slack_events.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -377,11 +377,13 @@ def process_slack_message(event: Dict[str, Any], event_id: str, client: WebClien
377377
# Split out citation block if present
378378
keys = ["source number", "title", "filename", "reference text", "link"]
379379
split = response_text.split("------")
380-
381-
response_text = split[0]
382-
citation_block = split[1]
383-
citations = re.split("<cit>", citation_block)[1:] or []
384-
citations = [dict(zip(keys, citation.split("|"))) for citation in citations]
380+
if len(split) == 1:
381+
citations = []
382+
else:
383+
response_text = split[0]
384+
citation_block = split[1]
385+
citations = re.split("<cit>", citation_block)[1:] or []
386+
citations = [dict(zip(keys, citation.split("|"))) for citation in citations]
385387

386388
# Post the answer (plain) to get message_ts
387389
post_params = {"channel": channel, "text": response_text}

0 commit comments

Comments
 (0)