Add initial framework for commands

This commit is contained in:
Hayden Johnson 2024-10-01 11:50:35 -07:00
parent f6ec5cde2e
commit 0fb11b0691

View file

@ -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(