From bccddcf6bc1c53e5725bac1c648dc28dda9025e9 Mon Sep 17 00:00:00 2001 From: Fractalego Date: Sun, 30 Apr 2023 15:15:04 +0100 Subject: [PATCH 1/3] Web interface now displays choices as well --- wafl/interface/queue_interface.py | 2 -- wafl/scheduler/web_loop.py | 15 ++++++++++++--- wafl/variables.py | 2 +- 3 files changed, 13 insertions(+), 6 deletions(-) diff --git a/wafl/interface/queue_interface.py b/wafl/interface/queue_interface.py index 5368497a..44d0e33f 100644 --- a/wafl/interface/queue_interface.py +++ b/wafl/interface/queue_interface.py @@ -17,7 +17,6 @@ def output(self, text: str, silent: bool = False): return utterance = text - print(f"Output: {utterance}") self.output_queue.append({"text": utterance, "silent": False}) self._utterances.append((time.time(), f"bot: {text}")) self.bot_has_spoken(True) @@ -27,7 +26,6 @@ async def input(self) -> str: await asyncio.sleep(0.1) text = self.input_queue.pop(0) - print(f"Input: {text}") self._utterances.append((time.time(), f"user: {text}")) return text diff --git a/wafl/scheduler/web_loop.py b/wafl/scheduler/web_loop.py index 359ec708..f71a8373 100644 --- a/wafl/scheduler/web_loop.py +++ b/wafl/scheduler/web_loop.py @@ -29,7 +29,7 @@ async def run(self): async def handle_input(): text = request.form["query"] self._interface.input_queue.append(text) - conversation = "
".join(self._interface.get_utterances_list()) + "
" + conversation = await self._get_conversation() conversation += ( '' ) @@ -37,8 +37,7 @@ async def handle_input(): @app.route("/load_messages", methods=["GET"]) async def load_messages(): - conversation = "
".join(self._interface.get_utterances_list()) - return conversation + return await self._get_conversation() @app.route("/output") async def handle_output(): @@ -57,3 +56,13 @@ def run_app(): thread = threading.Thread(target=run_app) thread.start() + + async def _get_conversation(self): + dialogue = self._interface.get_utterances_list_with_timestamp() + choices = self._interface.get_choices_and_timestamp() + facts = self._interface.get_facts_and_timestamp() + dialogue_items = dialogue + choices + facts + dialogue_items = sorted(dialogue_items, key=lambda x: x[0]) + dialogue_items = [item[1] for item in dialogue_items] + conversation = "
".join(dialogue_items) + "
" + return conversation diff --git a/wafl/variables.py b/wafl/variables.py index 7b4e8b81..f528e35c 100644 --- a/wafl/variables.py +++ b/wafl/variables.py @@ -1,4 +1,4 @@ def get_variables(): return { - "version": "0.0.43", + "version": "0.0.44", } From 94ad82c0ae3f35ee3f47833da0c3ac1077b69475 Mon Sep 17 00:00:00 2001 From: Fractalego Date: Sun, 30 Apr 2023 15:54:09 +0100 Subject: [PATCH 2/3] updated config logs creation --- wafl/config.py | 3 ++- wafl/variables.py | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/wafl/config.py b/wafl/config.py index c2f0210e..b2c31253 100644 --- a/wafl/config.py +++ b/wafl/config.py @@ -32,7 +32,8 @@ def create_initial_files(): with open("start_llm.sh", "w") as file: file.write(_docker_start.read()) - os.mkdir("logs/") + if not os.path.exists("logs/"): + os.mkdir("logs/") print("Done.") diff --git a/wafl/variables.py b/wafl/variables.py index f528e35c..fff10c09 100644 --- a/wafl/variables.py +++ b/wafl/variables.py @@ -1,4 +1,4 @@ def get_variables(): return { - "version": "0.0.44", + "version": "0.0.45", } From 37d52bfb0f1738ad7cae4c0c06dd7066fa2c653b Mon Sep 17 00:00:00 2001 From: Fractalego Date: Sun, 30 Apr 2023 15:57:50 +0100 Subject: [PATCH 3/3] Added docs badge --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 4ff9d876..62659319 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,5 @@ -# WAFL 0.0.45 [![Tests](https://github.com/fractalego/wafl/actions/workflows/development-tests1.yml/badge.svg)](https://github.com/fractalego/wafl/actions/workflows/development-tests1.yml) +# WAFL 0.0.45 [![Tests](https://github.com/fractalego/wafl/actions/workflows/development-tests1.yml/badge.svg)](https://github.com/fractalego/wafl/actions/workflows/development-tests1.yml)[![Docs](https://readthedocs.org/projects/wafl/badge/?version=latest)](https://wafl.readthedocs.io/en/latest/) + Introduction ============