Skip to content

Commit

Permalink
Set result of the status to null not stage
Browse files Browse the repository at this point in the history
  • Loading branch information
kaancayli committed Jul 8, 2024
1 parent 6fd83ce commit 5080343
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 24 deletions.
40 changes: 20 additions & 20 deletions app/pipeline/chat/course_chat_pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -416,26 +416,26 @@ def lecture_content_retrieval(prompt: str) -> str:

self.callback.done("Response created", final_result=out)

try:
self.callback.skip("Skipping suggestion generation.")
# if out:
# suggestion_dto = InteractionSuggestionPipelineExecutionDTO()
# suggestion_dto.chat_history = dto.chat_history
# suggestion_dto.last_message = out
# suggestions = self.suggestion_pipeline(suggestion_dto)
# self.callback.done(final_result=None, suggestions=suggestions)
# else:
# # This should never happen but whatever
# self.callback.skip(
# "Skipping suggestion generation as no output was generated."
# )
except Exception as e:
logger.error(
"An error occurred while running the course chat interaction suggestion pipeline",
exc_info=e,
)
traceback.print_exc()
self.callback.error("Generating interaction suggestions failed.")
# try:
# self.callback.skip("Skipping suggestion generation.")
# if out:
# suggestion_dto = InteractionSuggestionPipelineExecutionDTO()
# suggestion_dto.chat_history = dto.chat_history
# suggestion_dto.last_message = out
# suggestions = self.suggestion_pipeline(suggestion_dto)
# self.callback.done(final_result=None, suggestions=suggestions)
# else:
# # This should never happen but whatever
# self.callback.skip(
# "Skipping suggestion generation as no output was generated."
# )
# except Exception as e:
# logger.error(
# "An error occurred while running the course chat interaction suggestion pipeline",
# exc_info=e,
# )
# traceback.print_exc()
# self.callback.error("Generating interaction suggestions failed.")
except Exception as e:
logger.error(
"An error occurred while running the course chat pipeline", exc_info=e
Expand Down
10 changes: 6 additions & 4 deletions app/web/status/status_update.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ def done(
)
# Reset the result after sending a final response
self.status.result = None
self.status.suggestions = None

def error(self, message: str, exception=None):
"""
Expand All @@ -129,8 +130,9 @@ def error(self, message: str, exception=None):
"""
self.stage.state = StageStateEnum.ERROR
self.stage.message = message
self.stage.result = None
self.stage.suggestions = None

self.status.result = None
self.status.suggestions = None
# Set all subsequent stages to SKIPPED if an error occurs
rest_of_index = (
self.current_stage_index + 1
Expand Down Expand Up @@ -159,8 +161,8 @@ def skip(self, message: Optional[str] = None, start_next_stage: bool = True):
"""
self.stage.state = StageStateEnum.SKIPPED
self.stage.message = message
self.stage.result = None
self.stage.suggestions = None
self.status.result = None
self.status.suggestions = None
next_stage = self.get_next_stage()
if next_stage is not None:
self.stage = next_stage
Expand Down

0 comments on commit 5080343

Please sign in to comment.