summaryrefslogtreecommitdiff
path: root/chat.py
diff options
context:
space:
mode:
authorSchark <jordan@schark.online>2023-12-04 13:27:00 -0800
committerSchark <jordan@schark.online>2023-12-04 13:27:00 -0800
commitc5d082654f20961e1982bbc203c5a2b19d993af5 (patch)
tree0c43f85d09375aca9b06d829f3ffbb210c874f23 /chat.py
parent45cab0853fb45ba4edabcb8b04d64671d195e523 (diff)
downloadcli-gpt-c5d082654f20961e1982bbc203c5a2b19d993af5.tar.gz
cli-gpt-c5d082654f20961e1982bbc203c5a2b19d993af5.zip
Adding some styling
Diffstat (limited to '')
-rw-r--r--chat.py12
1 files changed, 7 insertions, 5 deletions
diff --git a/chat.py b/chat.py
index be2d77d..1221d8e 100644
--- a/chat.py
+++ b/chat.py
@@ -1,8 +1,10 @@
import queue
import sys
+import os
import threading
import time
+import curses
from openai import OpenAI
from help import HelpCommands, start_chat
@@ -38,13 +40,13 @@ def main():
helper = HelpCommands(model)
styler = StyleLog()
- messages = start_chat(model)
+ messages = start_chat(model, styler)
while True:
- # TODO: Format output nicer :)
- user_input = input("\nInput: ")
- status, messages, model = helper.command(user_input, messages, model)
+ user_input = styler.prompt("user", "")
+
+ status, messages, model = helper.command(user_input, messages, model, styler)
if status == 1:
break
elif status == 2:
@@ -69,7 +71,7 @@ def main():
ai_response = api_call_queue.get()
messages.append({"role": "assistant", "content": ai_response})
- print(f"\nAI: {ai_response}\n")
+ styler.prompt("assistant", f"{ai_response}\n")
# TODO: Add some form of token check, as to not overflow