Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix/conversation loggin fix #108

Merged
merged 8 commits into from
Oct 18, 2023
Merged
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion A2rchi/interfaces/chat_app/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import json
import os
import yaml
import time

# DEFINITIONS
QUERY_LIMIT = 1000 # max number of queries
Expand Down Expand Up @@ -72,6 +73,8 @@ def update_or_add_discussion(data_path, json_file, discussion_id, discussion_con
# update or add discussion
discussion_dict = data.get(str(discussion_id), {})

discussion_dict["meta"] = {"time_last_used": time.time()}

if discussion_contents is not None:
print(" INFO - found contents.")
discussion_dict["contents"] = discussion_contents
Expand Down Expand Up @@ -139,7 +142,7 @@ def __call__(self, history: Optional[List[Tuple[str, str]]], discussion_id: Opti
else:
output = "<p>" + result["answer"] + "</p>"

ChatWrapper.update_or_add_discussion(self.data_path, "conversations_test.json", discussion_id, discussion_contents = history)
ChatWrapper.update_or_add_discussion(self.data_path, "conversations_test.json", discussion_id, discussion_contents = history + [("A2rchi", output)])

except Exception as e:
raise e
Expand Down