mirror of
https://github.com/maglore9900/max_headroom.git
synced 2025-06-06 03:25:34 +00:00
timer notification updated
This commit is contained in:
parent
d195d63580
commit
e12c3aa36c
10
README.md
10
README.md
@ -4,7 +4,15 @@ this is a personal project to create a voice directed digital assistant based on
|
|||||||
|
|
||||||
written in python, using langchain, langgraph, etc.
|
written in python, using langchain, langgraph, etc.
|
||||||
|
|
||||||
it currently will respond as an LLM like usual, but can also control spotify
|
written to work on Windows. Agent and logic will run on linux but tools are currently windows only.
|
||||||
|
|
||||||
|
it currently will respond as an LLM like usual, but also has the following capabilities:
|
||||||
|
|
||||||
|
- can also control spotify
|
||||||
|
- can open applications on windows
|
||||||
|
- can change the focused window
|
||||||
|
- set timer
|
||||||
|
- coming soon: journalling in markdown with save target for obsidian
|
||||||
|
|
||||||
this is a fun work in progress. if you want to use it and or develop for it be my guest. would love to have more tools designed.
|
this is a fun work in progress. if you want to use it and or develop for it be my guest. would love to have more tools designed.
|
||||||
|
|
||||||
|
@ -152,9 +152,14 @@ class Agent:
|
|||||||
print(f"state: {state}")
|
print(f"state: {state}")
|
||||||
tool_action = state['agent_out'][0]
|
tool_action = state['agent_out'][0]
|
||||||
command = (lambda x: x.get('command') or x.get('self'))(tool_action.tool_input)
|
command = (lambda x: x.get('command') or x.get('self'))(tool_action.tool_input)
|
||||||
if not command:
|
try:
|
||||||
raise ValueError("No valid command found in tool_input")
|
if not command:
|
||||||
subprocess.run(["python", "modules/timer.py", command])
|
raise ValueError("No valid command found in tool_input")
|
||||||
|
subprocess.run(["python", "timer.py", command])
|
||||||
|
# process = subprocess.Popen(["python", "modules/timer.py", command], stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True)
|
||||||
|
except Exception as e:
|
||||||
|
print(f"An error occurred with timer: {e}")
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(f"An error occurred: {e}")
|
print(f"An error occurred: {e}")
|
||||||
|
|
||||||
|
@ -44,6 +44,8 @@ class Journal:
|
|||||||
Ensure that the tone remains neutral, and avoid using 'I' or 'my' in the notes.
|
Ensure that the tone remains neutral, and avoid using 'I' or 'my' in the notes.
|
||||||
|
|
||||||
The format MUST be in markdown
|
The format MUST be in markdown
|
||||||
|
|
||||||
|
Only use the information provided by the query. If you dont have information for a section dont try to make it up.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
self.chat_template = ChatPromptTemplate.from_messages(
|
self.chat_template = ChatPromptTemplate.from_messages(
|
||||||
@ -62,6 +64,7 @@ class Journal:
|
|||||||
def journal(self, text):
|
def journal(self, text):
|
||||||
message = self.chat_template.format_messages(text=text)
|
message = self.chat_template.format_messages(text=text)
|
||||||
response = self.journal_llm.invoke(message)
|
response = self.journal_llm.invoke(message)
|
||||||
return response
|
print(response)
|
||||||
|
# return response
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,18 +1,38 @@
|
|||||||
import time
|
import time
|
||||||
import argparse
|
import argparse
|
||||||
import agent
|
# import agent
|
||||||
|
|
||||||
spk = agent.Agent().spk
|
# spk = agent.Agent().spk
|
||||||
|
|
||||||
def timer(seconds):
|
# def timer(seconds):
|
||||||
print(f"Timer started for {seconds} seconds.")
|
# print(f"Timer started for {seconds} seconds.")
|
||||||
time.sleep(seconds)
|
# time.sleep(seconds)
|
||||||
print("Time's up!")
|
# print("Time's up!")
|
||||||
spk.glitch_stream_output("Time's up!")
|
# spk.glitch_stream_output("Time's up!")
|
||||||
|
|
||||||
|
# if __name__ == "__main__":
|
||||||
|
# parser = argparse.ArgumentParser(description="Simple Timer Script")
|
||||||
|
# parser.add_argument("seconds", type=int, help="Number of seconds to set the timer for")
|
||||||
|
# args = parser.parse_args()
|
||||||
|
|
||||||
|
# timer(args.seconds)
|
||||||
|
|
||||||
|
|
||||||
|
# import time
|
||||||
|
from plyer import notification
|
||||||
|
|
||||||
|
def start_timer(seconds):
|
||||||
|
print(f"Timer started for {seconds} seconds...")
|
||||||
|
time.sleep(seconds) # Sleep for the desired time
|
||||||
|
notification.notify(
|
||||||
|
title="Timer Finished",
|
||||||
|
message="Your time is up!",
|
||||||
|
timeout=5 # Notification will disappear after 10 seconds
|
||||||
|
)
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
parser = argparse.ArgumentParser(description="Simple Timer Script")
|
parser = argparse.ArgumentParser(description="Simple Timer Script")
|
||||||
parser.add_argument("seconds", type=int, help="Number of seconds to set the timer for")
|
parser.add_argument("seconds", type=int, help="Number of seconds to set the timer for")
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
|
|
||||||
timer(args.seconds)
|
start_timer(args.seconds)
|
26
modules/timer_test.py
Normal file
26
modules/timer_test.py
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
# import time
|
||||||
|
# from win10toast import ToastNotifier
|
||||||
|
|
||||||
|
# def start_timer(seconds):
|
||||||
|
# print(f"Timer started for {seconds} seconds...")
|
||||||
|
# time.sleep(seconds)
|
||||||
|
# toaster = ToastNotifier()
|
||||||
|
# toaster.show_toast("Timer Finished", "Your time is up!", duration=10)
|
||||||
|
|
||||||
|
# # Example: Set a timer for 60 seconds
|
||||||
|
# start_timer(5)
|
||||||
|
|
||||||
|
import time
|
||||||
|
from plyer import notification
|
||||||
|
|
||||||
|
def start_timer(seconds):
|
||||||
|
print(f"Timer started for {seconds} seconds...")
|
||||||
|
time.sleep(seconds) # Sleep for the desired time
|
||||||
|
notification.notify(
|
||||||
|
title="Timer Finished",
|
||||||
|
message="Your time is up!",
|
||||||
|
timeout=10 # Notification will disappear after 10 seconds
|
||||||
|
)
|
||||||
|
|
||||||
|
# Example: Set a timer for 60 seconds
|
||||||
|
start_timer(5)
|
@ -13,4 +13,5 @@ pypdf
|
|||||||
langsmith
|
langsmith
|
||||||
unstructured
|
unstructured
|
||||||
python-docx
|
python-docx
|
||||||
python-vlc
|
python-vlc
|
||||||
|
plyer
|
Loading…
x
Reference in New Issue
Block a user