Skip to content

Commit

Permalink
fix: don't stream ended conversations
Browse files Browse the repository at this point in the history
  • Loading branch information
Erez Sharim authored and asaf committed Jul 5, 2024
1 parent 7372151 commit fdcaddb
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
6 changes: 6 additions & 0 deletions app/routers/conversation.py
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,12 @@ def _add_messages(ai_content: str):
status_code=status.HTTP_404_NOT_FOUND, detail="conversation not found"
)

if ar.status == ConversationStatuses.completed:
raise HTTPException(
status_code=status.HTTP_412_PRECONDITION_FAILED,
detail="conversation has ended, please start a new one",
)

if (
admin_or_scope.is_admin is not True
and ar.assignee != admin_or_scope.current_user_email
Expand Down
2 changes: 1 addition & 1 deletion app/slack/event_message.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ def answer(client: WebClient, event, logger, say, context):
logger.info("conversation %s created from slack", conversation.id)
elif conversation.status == ConversationStatuses.completed:
say(
text="This conversation is ended, please start a new one.",
text="This conversation has ended, please start a new one.",
thread_ts=thread_ts,
)
return
Expand Down

0 comments on commit fdcaddb

Please sign in to comment.