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 ============ 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/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..fff10c09 100644 --- a/wafl/variables.py +++ b/wafl/variables.py @@ -1,4 +1,4 @@ def get_variables(): return { - "version": "0.0.43", + "version": "0.0.45", }