mirror of
https://github.com/TheAlgorithms/Python.git
synced 2025-03-17 20:19:48 +00:00
Add files via upload
This commit is contained in:
parent
4ecdca19d6
commit
f8510d702e
@ -83,11 +83,13 @@ class Chatbot:
|
|||||||
self.conversation_history.append({"role": "user", "content": user_input})
|
self.conversation_history.append({"role": "user", "content": user_input})
|
||||||
|
|
||||||
if user_input == "/stop":
|
if user_input == "/stop":
|
||||||
|
bot_response = "conversation-terminated"
|
||||||
|
# print(f"Bot: {bot_response}")
|
||||||
self.end_chat()
|
self.end_chat()
|
||||||
return "conversation-terminated"
|
return bot_response
|
||||||
else:
|
else:
|
||||||
bot_response = self.llm_service.generate_response(self.conversation_history)
|
bot_response = self.llm_service.generate_response(self.conversation_history)
|
||||||
print(f"Bot : ", bot_response)
|
# print(f"Bot: {bot_response}")
|
||||||
self.conversation_history.append(
|
self.conversation_history.append(
|
||||||
{"role": "assistant", "content": bot_response}
|
{"role": "assistant", "content": bot_response}
|
||||||
)
|
)
|
||||||
@ -120,7 +122,6 @@ class Chatbot:
|
|||||||
try:
|
try:
|
||||||
user_input = "/stop"
|
user_input = "/stop"
|
||||||
bot_response = "conversation-terminated"
|
bot_response = "conversation-terminated"
|
||||||
print(f"Bot : ", bot_response)
|
|
||||||
self.db.insert_chat_data(self.chat_id_pk, user_input, bot_response)
|
self.db.insert_chat_data(self.chat_id_pk, user_input, bot_response)
|
||||||
self.db.insert_chat_history(current_time, is_stream)
|
self.db.insert_chat_history(current_time, is_stream)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user