Skip to content

Commit

Permalink
server: add default session name using user's first message
Browse files Browse the repository at this point in the history
  • Loading branch information
kahkeng committed Jul 27, 2023
1 parent 9bd8989 commit 8efd89a
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion server.py
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,11 @@ def message_received(client_state, send_response, message):
if history is None:
# generate uuid, commit to database immediately so user's chat list can fetch this
session_id = uuid.uuid4()
chat_session = ChatSession(id=session_id, user_id=client_state.user_id)
chat_session = ChatSession(
id=session_id,
user_id=client_state.user_id,
name=payload,
)
db_session.add(chat_session)
db_session.commit()

Expand Down

0 comments on commit 8efd89a

Please sign in to comment.