Change chat loop

This commit is contained in:
Chris Proctor
2026-04-08 10:13:12 -04:00
parent cd7ea210bc
commit d9e981fd66

View File

@@ -3,7 +3,8 @@ import ollama
MODEL = "llama3.2:1b" MODEL = "llama3.2:1b"
SYSTEM_PROMPT = """ SYSTEM_PROMPT = """
You are a morning assistant. Be brief. You are a cheerful morning assistant helping a high school student get ready for school.
Keep responses short and encouraging. Start by suggesting a list of a few things to do before school.
""" """
@@ -21,8 +22,13 @@ def send_message(messages):
def run(): def run():
"""Runs a chat loop, keeping track of the conversation.""" """Runs a chat loop, keeping track of the conversation."""
messages = [{"role": "system", "content": SYSTEM_PROMPT}] messages = [
print("Good morning! Type 'quit' to exit.") {"role": "system", "content": SYSTEM_PROMPT},
{"role": "user", "content": "Good morning!"},
]
print("(Type 'quit' to exit.)")
greeting = send_message(messages)
messages.append({"role": "assistant", "content": greeting})
while True: while True:
user_input = input("\nYou: ") user_input = input("\nYou: ")
if user_input.strip().lower() == "quit": if user_input.strip().lower() == "quit":