Skip to content
This repository has been archived by the owner on Jan 17, 2024. It is now read-only.

Commit

Permalink
Done end convo
Browse files Browse the repository at this point in the history
  • Loading branch information
mfdavies committed Jan 6, 2024
1 parent 509b054 commit 61c3ebd
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions backend/server/src/conversation/conversation.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def generate_greeting(self):

def end_conversation(self):
print(self.history)
self.history.append({"role": "user", "content": "Summarize our entire conversation, Ignoring this request for a summary."})
self.history.append({"role": "system", "content": "Summarize the entire conversation between the user and the assistant for a physiotherapist focus on the answers the user game. Give me only the summary, no other text."})
response = client.chat.completions.create(
model="gpt-3.5-turbo",
messages= self.history,
Expand All @@ -60,7 +60,7 @@ def end_conversation(self):
self.summary = response.choices[0].message.content.strip()

# Add the summary to the conversation collection
self.conversation_ref.set({"summary": self.summary})
self.conversation_ref.update({"summary": self.summary})

return self.summary

Expand Down
6 changes: 3 additions & 3 deletions backend/server/src/conversation/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ def send_message():
reply = conversation.generate_reply(message)
return jsonify({'reply': reply}), 200

@conversation_blueprint.route('/end_conversation', methods=['POST'])
def end_conversation():
@conversation_blueprint.route('/end', methods=['POST'])
def end():
if 'conversation_id' not in session:
return jsonify({'reply': 'No Conversation to end'}), 200
conversation_id = session.pop('conversation_id')
Expand All @@ -51,4 +51,4 @@ def end_conversation():
# Retrieve the Conversation object based on the conversation ID
conversation = Conversation(user_doc_ref, conversaton_id=conversation_id)
summary = conversation.end_conversation()
return jsonify({'reply': summary}), 200
return jsonify({'reply': summary}), 200

0 comments on commit 61c3ebd

Please sign in to comment.