Skip to content

Commit

Permalink
fix: model answers가 있을 때만 DB에 쌓이도록 함
Browse files Browse the repository at this point in the history
  • Loading branch information
clogic29 committed Jan 18, 2025
1 parent ac15dbd commit f23271a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
1 change: 0 additions & 1 deletion apps/answer/schemas.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,3 @@ class UserAnswerSchema(Schema):
id: int
question: str
model_answers: list[ModelAnswerSchema]

5 changes: 3 additions & 2 deletions apps/chat/endpoints.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,9 @@ def event_stream():
active_responses[model] = False
yield f"data: {json.dumps({'type': 'error', 'model': model, 'error': str(e)}, ensure_ascii=False)}\n\n"

answer = UserAnswer(question=message_data.message)
answer.save()
if text.keys():
answer = UserAnswer(question=message_data.message)
answer.save()
model_answers = []
for model_id in text.keys():
model_answers.append(ModelAnswer(model_id=model_id, answer=text[model_id], user_answer=answer))
Expand Down

0 comments on commit f23271a

Please sign in to comment.