pull/3/head
killian 12 months ago
parent 899c61b85b
commit a13a8b00fc

@ -0,0 +1 @@
[{"role": "user", "type": "message", "content": "hey"}, {"role": "assistant", "type": "message", "content": "Hello! How can I assist you today?"}, {"role": "user", "type": "message", "content": "help me get my laundry done"}, {"role": "assistant", "type": "message", "content": "Sure, I'll be glad to help you get through your laundry task! Let's break it down together:\n\n1. Gathering all your dirty clothes.\n2. Sorting your clothes by color and type.\n3. Washing your clothes based on sort.\n4. Drying your clothes once the washing part is complete.\n5. Folding and organizing the clothes.\n\nDoes this breakdown make sense? Would you like me to set reminders for these tasks, one by one, to guide you through the process?"}, {"role": "user", "type": "message", "content": "Yeah."}, {"role": "assistant", "type": "message", "content": "Sure, I am going to start you with your first task, which is gathering all your dirty clothes. How much time do you think you will need for this?"}, {"role": "user", "type": "message", "content": "idk you please estimate"}, {"role": "assistant", "type": "message", "content": "I suggest we allocate 15 minutes for gathering all your dirty clothes. This should provide enough time for you to check all areas where dirty laundry could be: bedrooms, bathroom, gym bag, etc.\n\nLet's schedule this. Next, I will check back with you in 15 minutes to see if the task is completed. \n\nLet's get started! Remember, all the work you're about to do is going to leave you with a closet full of clean clothes to wear. That's something to look forward to!\n\n"}, {"role": "assistant", "type": "code", "format": "python", "content": "\nimport datetime\nfrom computer import clock\n\n# Get current time\nnow = datetime.datetime.now()\n# Add 15 minutes to it for the deadline\ndeadline = now + datetime.timedelta(minutes=15)\n# Schedule a check back\nclock.schedule(deadline, \"Have you gathered all the dirty clothes?\")\n"}, {"role": "computer", "type": "console", "format": "output", "content": "---------------------------------------------------------------------------\nModuleNotFoundError Traceback (most recent call last)\nCell In[2], line 4\n 2 import datetime\n 3 print('##active_line2##')\n----> 4 from computer import clock\n 5 print('##active_line3##')\n 6 pass\n\nModuleNotFoundError: No module named 'computer'"}, {"role": "assistant", "type": "message", "content": "It seems like thecomputer module is not available in your working environment. It seems to be a hypothetical module mentioned in the prompt, but not available for use. To get around this and implement the scheduling, I could instead propose a rough structure of aschedule function for you below. This code will not run here, but can be inserted into a working Python script and execute correctly:\n\n"}, {"role": "assistant", "type": "code", "format": "python", "content": "\nimport threading\nimport time\nfrom datetime import datetime, timedelta\n\n# Function to print reminder\ndef remind(message):\n print(message)\n\n# Function to schedule a reminder\ndef schedule(deadline, message):\n # Calculate delay in seconds\n delay = (deadline - datetime.now()).total_seconds()\n # Start timer\n threading.Timer(delay, remind, args=(message,)).start()\n\nnow = datetime.now()\ndeadline = now + timedelta(minutes=15) # Sets deadline as 15 minutes from now\nschedule(deadline, \"Have you gathered all the dirty clothes?\")\n"}, {"role": "computer", "type": "console", "format": "output", "content": ""}]

@ -74,14 +74,17 @@ def main(interpreter):
pass pass
### CONVERSATION / DISC MANAGEMENT ### CONVERSATION / DISC MANAGEMENT
user_message = {"role": "user", "type": "message", "content": data} if type(data) == str: # This means it's from the frontend / user.
data = {"role": "user", "type": "message", "content": data}
messages = load_conversation() messages = load_conversation()
messages.append(user_message) messages.append(data)
save_conversation(messages) save_conversation(messages)
### RESPONDING ### RESPONDING
# This is the task for waiting for user inturruptions. # This is the task for waiting for user inturruptions.
if task:
task.cancel()
task = asyncio.create_task(websocket.receive_text()) task = asyncio.create_task(websocket.receive_text())
for chunk in interpreter.chat( for chunk in interpreter.chat(
@ -92,11 +95,13 @@ def main(interpreter):
queued_message = check_queue() queued_message = check_queue()
if queued_message: if queued_message:
data = queued_message data = queued_message
save_conversation(interpreter.messages)
break break
# Check for new user messages # Check for new user messages
if task.done(): if task.done():
data = task.result() # Get the new message data = task.result() # Get the new message
save_conversation(interpreter.messages)
break # Break the loop and start processing the new message break # Break the loop and start processing the new message
# Send out chunks # Send out chunks

@ -6,6 +6,7 @@ from main import main
from interpreter import interpreter from interpreter import interpreter
import os import os
import glob import glob
import json
### SYSTEM MESSAGE ### SYSTEM MESSAGE
@ -48,12 +49,11 @@ interpreter.custom_instructions = system_message
### TOOLS ### TOOLS
for file in glob.glob('/tools/*.py'): for file in glob.glob('interpreter/tools/*.py'):
with open(file, 'r') as f: with open(file, 'r') as f:
for chunk in interpreter.computer.run("python", f.read()): for chunk in interpreter.computer.run("python", f.read()):
print(chunk) print(chunk)
### LLM SETTINGS ### LLM SETTINGS
# Local settings # Local settings
@ -74,6 +74,11 @@ interpreter.offline = True
interpreter.id = 206 # Used to identify itself to other interpreters. This should be changed programatically so it's unique. interpreter.id = 206 # Used to identify itself to other interpreters. This should be changed programatically so it's unique.
### RESET conversations/user.json
with open('interpreter/conversations/user.json', 'w') as file:
json.dump({}, file)
### SERVE INTERPRETER AT "/" ### SERVE INTERPRETER AT "/"
main(interpreter) main(interpreter)
Loading…
Cancel
Save