Skip to content

Commit

Permalink
Fixes chat history
Browse files Browse the repository at this point in the history
  • Loading branch information
w4ffl35 committed Aug 15, 2024
1 parent 45b4280 commit 8e35926
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

setup(
name='runai',
version="v1.4.0",
version="v1.4.1",
author="Capsize LLC",
description="Run a socket server for AI models.",
long_description=open("README.md", "r", encoding="utf-8").read(),
Expand Down
6 changes: 6 additions & 0 deletions src/runai/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,11 @@ def update_history(self, name: str, message: str):
})

def do_query(self, user_prompt, instructions):
if len(self.history):
instructions += "\nThe conversation so far:\n"
for turn in self.history:
instructions += f"{turn['name']}: {turn['message']}\n"

self.send_message(json.dumps({
"history": self.history,
"listener": self.user_agent.to_dict() if self.user_agent else None,
Expand Down Expand Up @@ -181,6 +186,7 @@ def run(self):
self.handle_res(res)

def handle_res(self, res):
self.update_history(self.bot_agent.name, res)
print(res)

def connect(self):
Expand Down
1 change: 0 additions & 1 deletion src/runai/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -441,7 +441,6 @@ def watch_connection(self):

def query_llm(self, data: dict):
for text in self.llm_handler.query_model(data):
print(text)
self.send_message(text)
self.send_end_message()

Expand Down

0 comments on commit 8e35926

Please sign in to comment.