Spaces:
Sleeping
Sleeping
Update pages/NeuralAgents.py
Browse files- pages/NeuralAgents.py +28 -26
pages/NeuralAgents.py
CHANGED
@@ -165,7 +165,7 @@ async def main():
|
|
165 |
fireworks_api = fire.text_input("Fireworks API key")
|
166 |
else:
|
167 |
fireworks_api = fire.container(border=True)
|
168 |
-
fireworks_api.write(st.session_state.fireworks_api)
|
169 |
|
170 |
st.session_state.forefront_api = data["APIforefront"]
|
171 |
|
@@ -173,7 +173,7 @@ async def main():
|
|
173 |
forefront_api = fore.text_input("Forefront API key")
|
174 |
else:
|
175 |
forefront_api = fore.container(border=True)
|
176 |
-
forefront_api.write(st.session_state.forefront_api)
|
177 |
|
178 |
st.session_state.anthropicAPI = data["APIanthropic"]
|
179 |
|
@@ -181,7 +181,7 @@ async def main():
|
|
181 |
anthropic_api = anthro.text_input("Anthropic API key")
|
182 |
else:
|
183 |
anthropic_api = anthro.container(border=True)
|
184 |
-
anthropic_api.write(st.session_state.anthropicAPI)
|
185 |
|
186 |
st.session_state.tokenChar = data["TokenCharacter"]
|
187 |
|
@@ -189,7 +189,7 @@ async def main():
|
|
189 |
characterToken = char.text_input("Character.ai user token")
|
190 |
else:
|
191 |
characterToken = char.container(border=True)
|
192 |
-
characterToken.write(st.session_state.tokenChar)
|
193 |
|
194 |
st.session_state.character_ID = data["char_ID"]
|
195 |
|
@@ -197,7 +197,7 @@ async def main():
|
|
197 |
character_ID = charID.text_input("Your Character ID")
|
198 |
else:
|
199 |
character_ID = charID.container(border=True)
|
200 |
-
character_ID.write(st.session_state.character_ID)
|
201 |
|
202 |
st.session_state.agentID = data["chaindeskID"]
|
203 |
|
@@ -205,7 +205,7 @@ async def main():
|
|
205 |
chaindeskAgent = chain.text_input("Chaindesk agent ID:")
|
206 |
else:
|
207 |
chaindeskAgent = chain.container(border=True)
|
208 |
-
chaindeskAgent.write(st.session_state.agentID)
|
209 |
|
210 |
st.session_state.flow = data["FlowiseID"]
|
211 |
|
@@ -213,7 +213,7 @@ async def main():
|
|
213 |
flowID = flo.text_input("Flowise flow ID:")
|
214 |
else:
|
215 |
flowID = flo.container(border=True)
|
216 |
-
flowID.write(st.session_state.flow)
|
217 |
|
218 |
if saveAPI:
|
219 |
credentials.clear()
|
@@ -232,14 +232,13 @@ async def main():
|
|
232 |
st.session_state.flow = flowID
|
233 |
credentials.append(st.session_state.flow)
|
234 |
|
235 |
-
|
236 |
if selectAgent == "Llama2":
|
237 |
|
238 |
if userInput:
|
239 |
print(f"User B: {userInput}")
|
240 |
user_input = st.chat_message("human")
|
241 |
user_input.markdown(userInput)
|
242 |
-
agent = Llama2(fireworks_api)
|
243 |
results = await agent.handleInput(userInput)
|
244 |
print(results)
|
245 |
|
@@ -253,7 +252,7 @@ async def main():
|
|
253 |
clientPorts = clientPorts1.status(label=cli_name, state="running", expanded=True)
|
254 |
clientPorts.write(conteneiro.clients)
|
255 |
try:
|
256 |
-
client = Llama2(fireworks_api)
|
257 |
await client.startClient(clientPort)
|
258 |
print(f"Connecting client on port {clientPort}...")
|
259 |
await asyncio.Future()
|
@@ -271,7 +270,7 @@ async def main():
|
|
271 |
serverPorts = serverPorts1.status(label=srv_name, state="running", expanded=True)
|
272 |
serverPorts.write(conteneiro.servers)
|
273 |
try:
|
274 |
-
server = Llama2(fireworks_api)
|
275 |
await server.start_server(websocketPort)
|
276 |
print(f"Starting WebSocket server on port {websocketPort}...")
|
277 |
await asyncio.Future()
|
@@ -377,7 +376,7 @@ async def main():
|
|
377 |
print(f"User B: {userInput}")
|
378 |
user_input = st.chat_message("human")
|
379 |
user_input.markdown(userInput)
|
380 |
-
agent = ForefrontAI(forefront_api)
|
381 |
results = await agent.handleInput(userInput)
|
382 |
print(results)
|
383 |
|
@@ -391,7 +390,7 @@ async def main():
|
|
391 |
clientPorts = clientPorts1.status(label=cli_name, state="running", expanded=True)
|
392 |
clientPorts.write(conteneiro.clients)
|
393 |
try:
|
394 |
-
client = ForefrontAI(forefront_api)
|
395 |
await client.startClient(clientPort)
|
396 |
print(f"Connecting client on port {clientPort}...")
|
397 |
await asyncio.Future()
|
@@ -409,7 +408,7 @@ async def main():
|
|
409 |
serverPorts = serverPorts1.status(label=srv_name, state="running", expanded=True)
|
410 |
serverPorts.write(conteneiro.servers)
|
411 |
try:
|
412 |
-
server = ForefrontAI(forefront_api)
|
413 |
await server.start_server(websocketPort)
|
414 |
print(f"Starting WebSocket server on port {websocketPort}...")
|
415 |
await asyncio.Future()
|
@@ -423,7 +422,7 @@ async def main():
|
|
423 |
print(f"User B: {userInput}")
|
424 |
user_input = st.chat_message("human")
|
425 |
user_input.markdown(userInput)
|
426 |
-
agent = Claude3(
|
427 |
results = await agent.handleInput(userInput)
|
428 |
print(results)
|
429 |
|
@@ -437,7 +436,7 @@ async def main():
|
|
437 |
clientPorts = clientPorts1.status(label=cli_name, state="running", expanded=True)
|
438 |
clientPorts.write(conteneiro.clients)
|
439 |
try:
|
440 |
-
client = Claude3(
|
441 |
await client.startClient(clientPort)
|
442 |
print(f"Connecting client on port {clientPort}...")
|
443 |
await asyncio.Future()
|
@@ -455,7 +454,7 @@ async def main():
|
|
455 |
serverPorts = serverPorts1.status(label=srv_name, state="running", expanded=True)
|
456 |
serverPorts.write(conteneiro.servers)
|
457 |
try:
|
458 |
-
server = Claude3(
|
459 |
await server.start_server(websocketPort)
|
460 |
print(f"Starting WebSocket server on port {websocketPort}...")
|
461 |
await asyncio.Future()
|
@@ -465,11 +464,14 @@ async def main():
|
|
465 |
|
466 |
if selectAgent == "Character.ai":
|
467 |
|
|
|
|
|
|
|
468 |
if userInput:
|
469 |
print(f"User B: {userInput}")
|
470 |
user_input = st.chat_message("human")
|
471 |
user_input.markdown(userInput)
|
472 |
-
agent = CharacterAI(
|
473 |
results = await agent.handleInput(userInput)
|
474 |
print(results)
|
475 |
|
@@ -483,7 +485,7 @@ async def main():
|
|
483 |
clientPorts = clientPorts1.status(label=cli_name, state="running", expanded=True)
|
484 |
clientPorts.write(conteneiro.clients)
|
485 |
try:
|
486 |
-
client = CharacterAI(
|
487 |
await client.startClient(clientPort)
|
488 |
print(f"Connecting client on port {clientPort}...")
|
489 |
await asyncio.Future()
|
@@ -501,7 +503,7 @@ async def main():
|
|
501 |
serverPorts = serverPorts1.status(label=srv_name, state="running", expanded=True)
|
502 |
serverPorts.write(conteneiro.servers)
|
503 |
try:
|
504 |
-
server = CharacterAI(
|
505 |
await server.start_server(websocketPort)
|
506 |
print(f"Starting WebSocket server on port {websocketPort}...")
|
507 |
await asyncio.Future()
|
@@ -515,7 +517,7 @@ async def main():
|
|
515 |
print(f"User B: {userInput}")
|
516 |
user_input = st.chat_message("human")
|
517 |
user_input.markdown(userInput)
|
518 |
-
agent = Chaindesk(
|
519 |
results = await agent.handleInput(userInput)
|
520 |
print(results)
|
521 |
|
@@ -529,7 +531,7 @@ async def main():
|
|
529 |
clientPorts = clientPorts1.status(label=cli_name, state="running", expanded=True)
|
530 |
clientPorts.write(conteneiro.clients)
|
531 |
try:
|
532 |
-
client = Chaindesk(
|
533 |
await client.startClient(clientPort)
|
534 |
print(f"Connecting client on port {clientPort}...")
|
535 |
await asyncio.Future()
|
@@ -547,7 +549,7 @@ async def main():
|
|
547 |
serverPorts = serverPorts1.status(label=srv_name, state="running", expanded=True)
|
548 |
serverPorts.write(conteneiro.servers)
|
549 |
try:
|
550 |
-
server = Chaindesk(
|
551 |
await server.start_server(websocketPort)
|
552 |
print(f"Starting WebSocket server on port {websocketPort}...")
|
553 |
await asyncio.Future()
|
@@ -561,7 +563,7 @@ async def main():
|
|
561 |
print(f"User B: {userInput}")
|
562 |
user_input = st.chat_message("human")
|
563 |
user_input.markdown(userInput)
|
564 |
-
agent = Flowise(
|
565 |
results = await agent.handleInput(userInput)
|
566 |
print(results)
|
567 |
|
@@ -575,7 +577,7 @@ async def main():
|
|
575 |
clientPorts = clientPorts1.status(label=cli_name, state="running", expanded=True)
|
576 |
clientPorts.write(conteneiro.clients)
|
577 |
try:
|
578 |
-
client = Flowise(
|
579 |
await client.startClient(clientPort)
|
580 |
print(f"Connecting client on port {clientPort}...")
|
581 |
await asyncio.Future()
|
@@ -593,7 +595,7 @@ async def main():
|
|
593 |
serverPorts = serverPorts1.status(label=srv_name, state="running", expanded=True)
|
594 |
serverPorts.write(conteneiro.servers)
|
595 |
try:
|
596 |
-
server = Flowise(
|
597 |
await server.start_server(websocketPort)
|
598 |
print(f"Starting WebSocket server on port {websocketPort}...")
|
599 |
await asyncio.Future()
|
|
|
165 |
fireworks_api = fire.text_input("Fireworks API key")
|
166 |
else:
|
167 |
fireworks_api = fire.container(border=True)
|
168 |
+
fireworks_api.write(str(st.session_state.fireworks_api))
|
169 |
|
170 |
st.session_state.forefront_api = data["APIforefront"]
|
171 |
|
|
|
173 |
forefront_api = fore.text_input("Forefront API key")
|
174 |
else:
|
175 |
forefront_api = fore.container(border=True)
|
176 |
+
forefront_api.write(str(st.session_state.forefront_api))
|
177 |
|
178 |
st.session_state.anthropicAPI = data["APIanthropic"]
|
179 |
|
|
|
181 |
anthropic_api = anthro.text_input("Anthropic API key")
|
182 |
else:
|
183 |
anthropic_api = anthro.container(border=True)
|
184 |
+
anthropic_api.write(str(st.session_state.anthropicAPI))
|
185 |
|
186 |
st.session_state.tokenChar = data["TokenCharacter"]
|
187 |
|
|
|
189 |
characterToken = char.text_input("Character.ai user token")
|
190 |
else:
|
191 |
characterToken = char.container(border=True)
|
192 |
+
characterToken.write(str(st.session_state.tokenChar))
|
193 |
|
194 |
st.session_state.character_ID = data["char_ID"]
|
195 |
|
|
|
197 |
character_ID = charID.text_input("Your Character ID")
|
198 |
else:
|
199 |
character_ID = charID.container(border=True)
|
200 |
+
character_ID.write(str(st.session_state.character_ID))
|
201 |
|
202 |
st.session_state.agentID = data["chaindeskID"]
|
203 |
|
|
|
205 |
chaindeskAgent = chain.text_input("Chaindesk agent ID:")
|
206 |
else:
|
207 |
chaindeskAgent = chain.container(border=True)
|
208 |
+
chaindeskAgent.write(str(st.session_state.agentID))
|
209 |
|
210 |
st.session_state.flow = data["FlowiseID"]
|
211 |
|
|
|
213 |
flowID = flo.text_input("Flowise flow ID:")
|
214 |
else:
|
215 |
flowID = flo.container(border=True)
|
216 |
+
flowID.write(str(st.session_state.flow))
|
217 |
|
218 |
if saveAPI:
|
219 |
credentials.clear()
|
|
|
232 |
st.session_state.flow = flowID
|
233 |
credentials.append(st.session_state.flow)
|
234 |
|
|
|
235 |
if selectAgent == "Llama2":
|
236 |
|
237 |
if userInput:
|
238 |
print(f"User B: {userInput}")
|
239 |
user_input = st.chat_message("human")
|
240 |
user_input.markdown(userInput)
|
241 |
+
agent = Llama2(str(st.session_state.fireworks_api))
|
242 |
results = await agent.handleInput(userInput)
|
243 |
print(results)
|
244 |
|
|
|
252 |
clientPorts = clientPorts1.status(label=cli_name, state="running", expanded=True)
|
253 |
clientPorts.write(conteneiro.clients)
|
254 |
try:
|
255 |
+
client = Llama2(str(st.session_state.fireworks_api))
|
256 |
await client.startClient(clientPort)
|
257 |
print(f"Connecting client on port {clientPort}...")
|
258 |
await asyncio.Future()
|
|
|
270 |
serverPorts = serverPorts1.status(label=srv_name, state="running", expanded=True)
|
271 |
serverPorts.write(conteneiro.servers)
|
272 |
try:
|
273 |
+
server = Llama2(str(st.session_state.fireworks_api))
|
274 |
await server.start_server(websocketPort)
|
275 |
print(f"Starting WebSocket server on port {websocketPort}...")
|
276 |
await asyncio.Future()
|
|
|
376 |
print(f"User B: {userInput}")
|
377 |
user_input = st.chat_message("human")
|
378 |
user_input.markdown(userInput)
|
379 |
+
agent = ForefrontAI(str(st.session_state.forefront_api))
|
380 |
results = await agent.handleInput(userInput)
|
381 |
print(results)
|
382 |
|
|
|
390 |
clientPorts = clientPorts1.status(label=cli_name, state="running", expanded=True)
|
391 |
clientPorts.write(conteneiro.clients)
|
392 |
try:
|
393 |
+
client = ForefrontAI(str(st.session_state.forefront_api))
|
394 |
await client.startClient(clientPort)
|
395 |
print(f"Connecting client on port {clientPort}...")
|
396 |
await asyncio.Future()
|
|
|
408 |
serverPorts = serverPorts1.status(label=srv_name, state="running", expanded=True)
|
409 |
serverPorts.write(conteneiro.servers)
|
410 |
try:
|
411 |
+
server = ForefrontAI(str(st.session_state.forefront_api))
|
412 |
await server.start_server(websocketPort)
|
413 |
print(f"Starting WebSocket server on port {websocketPort}...")
|
414 |
await asyncio.Future()
|
|
|
422 |
print(f"User B: {userInput}")
|
423 |
user_input = st.chat_message("human")
|
424 |
user_input.markdown(userInput)
|
425 |
+
agent = Claude3(str(st.session_state.anthropicAPI))
|
426 |
results = await agent.handleInput(userInput)
|
427 |
print(results)
|
428 |
|
|
|
436 |
clientPorts = clientPorts1.status(label=cli_name, state="running", expanded=True)
|
437 |
clientPorts.write(conteneiro.clients)
|
438 |
try:
|
439 |
+
client = Claude3(str(st.session_state.anthropicAPI))
|
440 |
await client.startClient(clientPort)
|
441 |
print(f"Connecting client on port {clientPort}...")
|
442 |
await asyncio.Future()
|
|
|
454 |
serverPorts = serverPorts1.status(label=srv_name, state="running", expanded=True)
|
455 |
serverPorts.write(conteneiro.servers)
|
456 |
try:
|
457 |
+
server = Claude3(str(st.session_state.anthropicAPI))
|
458 |
await server.start_server(websocketPort)
|
459 |
print(f"Starting WebSocket server on port {websocketPort}...")
|
460 |
await asyncio.Future()
|
|
|
464 |
|
465 |
if selectAgent == "Character.ai":
|
466 |
|
467 |
+
usrToken = str(st.session_state.tokenChar)
|
468 |
+
charID = str(st.session_state.character_ID)
|
469 |
+
|
470 |
if userInput:
|
471 |
print(f"User B: {userInput}")
|
472 |
user_input = st.chat_message("human")
|
473 |
user_input.markdown(userInput)
|
474 |
+
agent = CharacterAI(usrToken, charID)
|
475 |
results = await agent.handleInput(userInput)
|
476 |
print(results)
|
477 |
|
|
|
485 |
clientPorts = clientPorts1.status(label=cli_name, state="running", expanded=True)
|
486 |
clientPorts.write(conteneiro.clients)
|
487 |
try:
|
488 |
+
client = CharacterAI(usrToken, charID)
|
489 |
await client.startClient(clientPort)
|
490 |
print(f"Connecting client on port {clientPort}...")
|
491 |
await asyncio.Future()
|
|
|
503 |
serverPorts = serverPorts1.status(label=srv_name, state="running", expanded=True)
|
504 |
serverPorts.write(conteneiro.servers)
|
505 |
try:
|
506 |
+
server = CharacterAI(usrToken, charID)
|
507 |
await server.start_server(websocketPort)
|
508 |
print(f"Starting WebSocket server on port {websocketPort}...")
|
509 |
await asyncio.Future()
|
|
|
517 |
print(f"User B: {userInput}")
|
518 |
user_input = st.chat_message("human")
|
519 |
user_input.markdown(userInput)
|
520 |
+
agent = Chaindesk(str(st.session_state.agentID))
|
521 |
results = await agent.handleInput(userInput)
|
522 |
print(results)
|
523 |
|
|
|
531 |
clientPorts = clientPorts1.status(label=cli_name, state="running", expanded=True)
|
532 |
clientPorts.write(conteneiro.clients)
|
533 |
try:
|
534 |
+
client = Chaindesk(str(st.session_state.agentID))
|
535 |
await client.startClient(clientPort)
|
536 |
print(f"Connecting client on port {clientPort}...")
|
537 |
await asyncio.Future()
|
|
|
549 |
serverPorts = serverPorts1.status(label=srv_name, state="running", expanded=True)
|
550 |
serverPorts.write(conteneiro.servers)
|
551 |
try:
|
552 |
+
server = Chaindesk(str(st.session_state.agentID))
|
553 |
await server.start_server(websocketPort)
|
554 |
print(f"Starting WebSocket server on port {websocketPort}...")
|
555 |
await asyncio.Future()
|
|
|
563 |
print(f"User B: {userInput}")
|
564 |
user_input = st.chat_message("human")
|
565 |
user_input.markdown(userInput)
|
566 |
+
agent = Flowise(str(st.session_state.flow))
|
567 |
results = await agent.handleInput(userInput)
|
568 |
print(results)
|
569 |
|
|
|
577 |
clientPorts = clientPorts1.status(label=cli_name, state="running", expanded=True)
|
578 |
clientPorts.write(conteneiro.clients)
|
579 |
try:
|
580 |
+
client = Flowise(str(st.session_state.flow))
|
581 |
await client.startClient(clientPort)
|
582 |
print(f"Connecting client on port {clientPort}...")
|
583 |
await asyncio.Future()
|
|
|
595 |
serverPorts = serverPorts1.status(label=srv_name, state="running", expanded=True)
|
596 |
serverPorts.write(conteneiro.servers)
|
597 |
try:
|
598 |
+
server = Flowise(str(st.session_state.flow))
|
599 |
await server.start_server(websocketPort)
|
600 |
print(f"Starting WebSocket server on port {websocketPort}...")
|
601 |
await asyncio.Future()
|