Skip to content

Commit

Permalink
Merge pull request #55 from fractalego/development
Browse files Browse the repository at this point in the history
Development
  • Loading branch information
fractalego authored Apr 30, 2023
2 parents 47c01a3 + 811a7a4 commit 00561c5
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 8 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -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
============

Expand Down
3 changes: 2 additions & 1 deletion wafl/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.")

Expand Down
2 changes: 0 additions & 2 deletions wafl/interface/queue_interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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

Expand Down
15 changes: 12 additions & 3 deletions wafl/scheduler/web_loop.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,16 +29,15 @@ async def run(self):
async def handle_input():
text = request.form["query"]
self._interface.input_queue.append(text)
conversation = "</br>".join(self._interface.get_utterances_list()) + "</br>"
conversation = await self._get_conversation()
conversation += (
'<script>document.getElementById("query").value = "";</script>'
)
return conversation

@app.route("/load_messages", methods=["GET"])
async def load_messages():
conversation = "</br>".join(self._interface.get_utterances_list())
return conversation
return await self._get_conversation()

@app.route("/output")
async def handle_output():
Expand All @@ -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 = "</br>".join(dialogue_items) + "</br>"
return conversation
2 changes: 1 addition & 1 deletion wafl/variables.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
def get_variables():
return {
"version": "0.0.43",
"version": "0.0.45",
}

0 comments on commit 00561c5

Please sign in to comment.