-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
41 lines (34 loc) · 1.03 KB
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
from modules import agent
import asyncio
import environ
import os
env = environ.Env()
environ.Env.read_env()
loop = asyncio.new_event_loop()
asyncio.set_event_loop(loop)
if os.name == "nt":
op = "windows"
elif os.name == "posix":
# Further check to differentiate between Linux and macOS
if 'linux' in os.uname().sysname.lower():
print("linux")
op = "linux"
elif 'darwin' in os.uname().sysname.lower():
op = "macos"
else:
exit("Unknown operating system.")
else:
exit("Unknown operating system.")
graph = agent.Agent(env,op)
while True:
text = graph.spk.listen(int(env("TIME_LISTEN")))
# if text:
# print(f"User: {text}")
if text and "hey" in text.lower() and env("CHARACTER").lower() in text.lower():
if "exit" in text.lower():
break
print("agent invoked")
response = loop.run_until_complete(graph.invoke_agent(text))
if response:
graph.spk.glitch_stream_output(response)
# graph.spk.stream(response)