From 0fb11b06910a294d6f962e246cc6620409024e28 Mon Sep 17 00:00:00 2001 From: Hayden Johnson Date: Tue, 1 Oct 2024 11:50:35 -0700 Subject: [PATCH] Add initial framework for commands --- assistant.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/assistant.py b/assistant.py index d194ed6..e71c9d8 100755 --- a/assistant.py +++ b/assistant.py @@ -17,6 +17,17 @@ temp = 0.2 pattern = r'```[a-z]*\n[\s\S]*?\n```' line_pattern = r'`[a-z]*[\s\S]*?`' +def parse_commands(text): + # See if user wrote any commands here + tokens = text.split(' ') + match tokens[0]: + case '/save': + print('saving') + case '/clear': + print('clearing context') + case '/exit': + print('exiting') + def highlight_code(language_name, code): # Check if the language is specified in the first line lexer_name = language_name @@ -95,6 +106,8 @@ history = [ {"role": "system", "content": "You are a helpful, smart, kind, and efficient AI assistant. You always fulfill the user's requests accurately and concisely."}, ] +conversation = "" + def chat(message, stream=True): history.append({"role": "user", "content": message}) completion = client.chat(