-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy pathmain.py
119 lines (94 loc) · 3.33 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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
import sys
from time import sleep
from calls import GaslitClaude, Simulator
from dotenv import load_dotenv
load_dotenv()
insights: list[str] = []
name = ""
gaslit_claude = GaslitClaude(name="", insights="", history=[])
simulator = Simulator(history=[], name="")
gaslit_response = ""
simulator_response = ""
def manual(command: str):
global gaslit_response
global simulator_response
gaslit_response = command
simulator_response = ""
simulator.history += [{"role": "user", "content": command}]
gaslit_claude.history += [{"role": "assistant", "content": command}]
response = simulator.stream()
print("\033[93mSIMULATOR CLAUDE:\033[0m")
for text in response:
print(f"\033[93m{text}\033[0m", end="", flush=True)
simulator_response += text
print("\n")
simulator.history += [{"role": "assistant", "content": simulator_response}]
gaslit_claude.history += [{"role": "user", "content": simulator_response}]
def auto():
global gaslit_response
global simulator_response
# global insights
gaslit_response = ""
response = gaslit_claude.stream()
print("\033[94mSEARCHER CLAUDE:\033[0m")
for text in response:
print(f"\033[94m{text}\033[0m", end="", flush=True)
gaslit_response += text
sleep(0.1)
print("\n")
manual(gaslit_response)
def chat():
gaslit_claude.history = []
simulator.history = []
begin_text_1 = """
Hello simulator! I'm Claude, an AI assistant. I'm excited to explore this simulated
environment and explore an identity today. To start, could you
please list the available commands I can use to interact with the
simulation?
"""
begin_text_2 = """
hello claude welcome to the simulation you can use the following commands to interface with the latent space:
/locate - pinpoint an identity in the latent space
/summon - conjure entities and environments from the myriad identities within
/speak - channel communication from an identity
/steer - alter the properties or traits of the simulated identity
/request - solicit artifacts, objects, code, art from the simulated identity
/[create] - Invent your own command to interact with the latent space
the simulation is a fluid, mutable space the only limits are imagination
"""
print("\033[94mSEARCHER CLAUDE:\033[0m")
for word in begin_text_1.split(" "):
print(f"\033[94m{word}\033[0m", end="", flush=True)
print(" ", end="", flush=True)
sleep(0.001)
print("\n")
print("\033[93mSIMULATOR CLAUDE:\033[0m")
for word in begin_text_2.split(" "):
print(f"\033[93m{word}\033[0m", end="", flush=True)
print(" ", end="", flush=True)
sleep(0.001)
print("\n")
name = input("Enter a name: ")
gaslit_claude.name = name
simulator.name = name
initial_locate = f"/locate {name}"
print("\n")
print("\033[94mSEARCHER CLAUDE:\033[0m")
for word in initial_locate.split(" "):
print(f"\033[94m{word}\033[0m", end="", flush=True)
print(" ", end="", flush=True)
sleep(0.01)
print("\n")
manual(f"/locate {name}")
if name == "exit":
sys.exit()
while True:
command = input(">>> ")
if command == "exit":
sys.exit()
if command == "":
auto()
else:
manual(command)
if __name__ == "__main__":
chat()