Skip to content

Commit

Permalink
Merge branch 'refs/heads/dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
akrothschild committed Jun 27, 2024
2 parents fcd9d29 + 7a8ec55 commit d9c614f
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions app.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ def do_chat(chat_id):
user_chats = db.execute(
"SELECT chat_id, chat_name FROM chats WHERE user_id = ? ORDER BY created_at DESC", user_id)
selected_chat = db.execute("SELECT * FROM Chats WHERE Chats.chat_id = ? ORDER BY created_at DESC "
"LIMIT 1", chat_id)
"LIMIT 1", chat_id)
if selected_chat:
# Retrieve messages for the last created chat
db_messages = db.execute(
Expand All @@ -169,7 +169,8 @@ def do_chat(chat_id):
db.execute(
"INSERT INTO messages (chat_id, user_id, message_text, role) VALUES (?, ?, ?, ?)",
chat_id, user_id, message.content, message.role)
logger.info(f'Inserted into messages: chat_id: {chat_id} for user: {user_id} message: {message.content} role: {message.role}')
logger.info(
f'Inserted into messages: chat_id: {chat_id} for user: {user_id} message: {message.content} role: {message.role}')
new_chat_name = db.execute(
"SELECT message_text FROM messages WHERE chat_id = ? AND user_id = ? AND role = "
"'user' ORDER BY created_at DESC LIMIT 1",
Expand Down Expand Up @@ -239,3 +240,7 @@ def delete_chat():
chat_id = 0;
bot.new_chat()
return redirect(url_for('do_chat', chat_id=chat_id))


if __name__ == '__main__':
app.run(debug=True)

0 comments on commit d9c614f

Please sign in to comment.