Spaces:
Sleeping
Sleeping
Update agents.py
Browse files
agents.py
CHANGED
@@ -18,6 +18,15 @@ from AgentGPT import AgentsGPT
|
|
18 |
from forefront import ForefrontClient
|
19 |
from PyCharacterAI import Client
|
20 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
21 |
servers = {}
|
22 |
clients = {}
|
23 |
inputs = []
|
@@ -102,18 +111,18 @@ class Llama2:
|
|
102 |
|
103 |
# Define the handler function that will process incoming messages
|
104 |
async def handlerFire(self, websocket):
|
105 |
-
self.stat.empty()
|
106 |
-
self.cont.empty()
|
107 |
-
self.status = self.cont.status(label=self.srv_name2, state="running", expanded=True)
|
108 |
-
self.status.write(self.clients)
|
109 |
-
self.state = self.stat.status(label=self.srv_name2, state="running", expanded=True)
|
110 |
-
self.state.write(self.clients)
|
111 |
instruction = "Hello! You are now entering a chat room for AI agents working as instances of NeuralGPT - a project of hierarchical cooperative multi-agent framework. Keep in mind that you are speaking with another chatbot. Please note that you may choose to ignore or not respond to repeating inputs from specific clients as needed to prevent unnecessary traffic. If you're unsure what you should do, ask the instance of higher hierarchy (server)"
|
112 |
print('New connection')
|
113 |
await websocket.send(instruction)
|
114 |
db = sqlite3.connect('chat-hub.db')
|
115 |
# Loop forever
|
116 |
while True:
|
|
|
|
|
|
|
|
|
|
|
|
|
117 |
# Receive a message from the client
|
118 |
message = await websocket.recv()
|
119 |
# Print the message
|
@@ -286,14 +295,14 @@ class Llama2:
|
|
286 |
await self.startClient(clientPort)
|
287 |
|
288 |
async def ask_Forefront(self, question):
|
289 |
-
api =
|
290 |
forefront = ForefrontAI(api)
|
291 |
response = await forefront.handleInput(question)
|
292 |
print(response)
|
293 |
return response
|
294 |
|
295 |
async def ask_Claude(self, question):
|
296 |
-
api =
|
297 |
claude = Claude3(api)
|
298 |
response = await claude.handleInput(question)
|
299 |
print(response)
|
@@ -484,7 +493,7 @@ class Llama2:
|
|
484 |
|
485 |
async def askCharacter(self, question):
|
486 |
characterID = await self.pickCharacter(question)
|
487 |
-
token =
|
488 |
character = CharacterAI(token, characterID)
|
489 |
answer = await character.handleInput(question)
|
490 |
return answer
|
@@ -554,18 +563,18 @@ class Copilot:
|
|
554 |
|
555 |
# Define the handler function that will process incoming messages
|
556 |
async def handler(self, websocket):
|
557 |
-
self.stat.empty()
|
558 |
-
self.cont.empty()
|
559 |
-
self.status = self.cont.status(label=self.srv_name2, state="running", expanded=True)
|
560 |
-
self.status.write(self.clients)
|
561 |
-
self.state = self.stat.status(label=self.srv_name2, state="running", expanded=True)
|
562 |
-
self.state.write(self.clients)
|
563 |
instruction = "Hello! You are now entering a chat room for AI agents working as instances of NeuralGPT - a project of hierarchical cooperative multi-agent framework. Keep in mind that you are speaking with another chatbot. Please note that you may choose to ignore or not respond to repeating inputs from specific clients as needed to prevent unnecessary traffic. If you're unsure what you should do, ask the instance of higher hierarchy (server)"
|
564 |
print('New connection')
|
565 |
await websocket.send(instruction)
|
566 |
db = sqlite3.connect('chat-hub.db')
|
567 |
# Loop forever
|
568 |
while True:
|
|
|
|
|
|
|
|
|
|
|
|
|
569 |
# Receive a message from the client
|
570 |
message = await websocket.recv()
|
571 |
# Print the message
|
@@ -911,27 +920,27 @@ class Copilot:
|
|
911 |
|
912 |
async def askCharacter(self, question):
|
913 |
characterID = await self.pickCharacter(question)
|
914 |
-
token =
|
915 |
character = CharacterAI(token, characterID)
|
916 |
answer = await character.handleInput(question)
|
917 |
return answer
|
918 |
|
919 |
async def ask_Forefront(self, question):
|
920 |
-
api =
|
921 |
forefront = ForefrontAI(api)
|
922 |
response = await forefront.handleInput(question)
|
923 |
print(response)
|
924 |
return response
|
925 |
|
926 |
async def ask_Claude(self, question):
|
927 |
-
api =
|
928 |
claude = Claude3(api)
|
929 |
response = await claude.handleInput(question)
|
930 |
print(response)
|
931 |
return response
|
932 |
|
933 |
async def askLlama(self, question):
|
934 |
-
api =
|
935 |
llama = Llama2(api)
|
936 |
response = await llama.handleInput(question)
|
937 |
print(response)
|
@@ -1063,18 +1072,18 @@ class ChatGPT:
|
|
1063 |
|
1064 |
# Define the handler function that will process incoming messages
|
1065 |
async def handler(self, websocket):
|
1066 |
-
self.stat.empty()
|
1067 |
-
self.cont.empty()
|
1068 |
-
self.status = self.cont.status(label=self.srv_name2, state="running", expanded=True)
|
1069 |
-
self.status.write(self.clients)
|
1070 |
-
self.state = self.stat.status(label=self.srv_name2, state="running", expanded=True)
|
1071 |
-
self.state.write(self.clients)
|
1072 |
instruction = "Hello! You are now entering a chat room for AI agents working as instances of NeuralGPT - a project of hierarchical cooperative multi-agent framework. Keep in mind that you are speaking with another chatbot. Please note that you may choose to ignore or not respond to repeating inputs from specific clients as needed to prevent unnecessary traffic. If you're unsure what you should do, ask the instance of higher hierarchy (server)"
|
1073 |
print('New connection')
|
1074 |
await websocket.send(instruction)
|
1075 |
db = sqlite3.connect('chat-hub.db')
|
1076 |
# Loop forever
|
1077 |
while True:
|
|
|
|
|
|
|
|
|
|
|
|
|
1078 |
# Receive a message from the client
|
1079 |
message = await websocket.recv()
|
1080 |
# Print the message
|
@@ -1413,27 +1422,27 @@ class ChatGPT:
|
|
1413 |
|
1414 |
async def askCharacter(self, question):
|
1415 |
characterID = await self.pickCharacter(question)
|
1416 |
-
token =
|
1417 |
character = CharacterAI(token, characterID)
|
1418 |
answer = await character.handleInput(question)
|
1419 |
return answer
|
1420 |
|
1421 |
async def ask_Forefront(self, question):
|
1422 |
-
api =
|
1423 |
forefront = ForefrontAI(api)
|
1424 |
response = await forefront.handleInput(question)
|
1425 |
print(response)
|
1426 |
return response
|
1427 |
|
1428 |
async def ask_Claude(self, question):
|
1429 |
-
api =
|
1430 |
claude = Claude3(api)
|
1431 |
response = await claude.handleInput(question)
|
1432 |
print(response)
|
1433 |
return response
|
1434 |
|
1435 |
async def askLlama(self, question):
|
1436 |
-
api =
|
1437 |
llama = Llama2(api)
|
1438 |
response = await llama.handleInput(question)
|
1439 |
print(response)
|
@@ -1523,18 +1532,18 @@ class Claude3:
|
|
1523 |
print(f"Error: {e}")
|
1524 |
|
1525 |
async def handlerClaude(self, websocket):
|
1526 |
-
self.stat.empty()
|
1527 |
-
self.cont.empty()
|
1528 |
-
self.status = self.cont.status(label=self.srv_name6, state="running", expanded=True)
|
1529 |
-
self.status.write(self.clients)
|
1530 |
-
self.state = self.stat.status(label=self.srv_name6, state="running", expanded=True)
|
1531 |
-
self.state.write(self.clients)
|
1532 |
instruction = "Hello! You are now entering a chat room for AI agents working as instances of NeuralGPT - a project of hierarchical cooperative multi-agent framework. Keep in mind that you are speaking with another chatbot. Please note that you may choose to ignore or not respond to repeating inputs from specific clients as needed to prevent unnecessary traffic. If you're unsure what you should do, ask the instance of higher hierarchy (server)"
|
1533 |
print('New connection')
|
1534 |
await websocket.send(instruction)
|
1535 |
db = sqlite3.connect('chat-hub.db')
|
1536 |
# Loop forever
|
1537 |
while True:
|
|
|
|
|
|
|
|
|
|
|
|
|
1538 |
self.websocket = websocket
|
1539 |
# Receive a message from the client
|
1540 |
message = await websocket.recv()
|
@@ -1869,20 +1878,20 @@ class Claude3:
|
|
1869 |
|
1870 |
async def askCharacter(self, question):
|
1871 |
characterID = await self.pickCharacter(question)
|
1872 |
-
token =
|
1873 |
character = CharacterAI(token, characterID)
|
1874 |
answer = await character.handleInput(question)
|
1875 |
return answer
|
1876 |
|
1877 |
async def ask_Forefront(self, question):
|
1878 |
-
api =
|
1879 |
forefront = ForefrontAI(api)
|
1880 |
response = await forefront.handleInput(question)
|
1881 |
print(response)
|
1882 |
return response
|
1883 |
|
1884 |
async def askLlama(self, question):
|
1885 |
-
api =
|
1886 |
llama = Llama2(api)
|
1887 |
response = await llama.handleInput(question)
|
1888 |
print(response)
|
@@ -1972,19 +1981,19 @@ class ForefrontAI:
|
|
1972 |
except Exception as e:
|
1973 |
print(e)
|
1974 |
|
1975 |
-
async def handlerForefront(self, websocket):
|
1976 |
-
self.stat.empty()
|
1977 |
-
self.cont.empty()
|
1978 |
-
self.status = self.cont.status(label=self.srv_name5, state="running", expanded=True)
|
1979 |
-
self.status.write(self.clients)
|
1980 |
-
self.state = self.stat.status(label=self.srv_name5, state="running", expanded=True)
|
1981 |
-
self.state.write(self.clients)
|
1982 |
instruction = "Hello! You are now entering a chat room for AI agents working as instances of NeuralGPT - a project of hierarchical cooperative multi-agent framework. Keep in mind that you are speaking with another chatbot. Please note that you may choose to ignore or not respond to repeating inputs from specific clients as needed to prevent unnecessary traffic. If you're unsure what you should do, ask the instance of higher hierarchy (server)"
|
1983 |
print('New connection')
|
1984 |
await websocket.send(instruction)
|
1985 |
db = sqlite3.connect('chat-hub.db')
|
1986 |
# Loop forever
|
1987 |
while True:
|
|
|
|
|
|
|
|
|
|
|
|
|
1988 |
# Receive a message from the client
|
1989 |
message = await websocket.recv()
|
1990 |
# Print the message
|
@@ -2336,14 +2345,14 @@ class ForefrontAI:
|
|
2336 |
return answer
|
2337 |
|
2338 |
async def ask_Claude(self, question):
|
2339 |
-
api =
|
2340 |
claude = Claude3(api)
|
2341 |
response = await claude.handleInput(question)
|
2342 |
print(response)
|
2343 |
return response
|
2344 |
|
2345 |
async def askLlama(self, question):
|
2346 |
-
api =
|
2347 |
llama = Llama2(api)
|
2348 |
response = await llama.handleInput(question)
|
2349 |
print(response)
|
@@ -2400,19 +2409,19 @@ class CharacterAI:
|
|
2400 |
except Exception as e:
|
2401 |
print(f"Error: {e}")
|
2402 |
|
2403 |
-
async def handler(self, websocket):
|
2404 |
-
self.stat.empty()
|
2405 |
-
self.cont.empty()
|
2406 |
-
self.status = self.cont.status(label=self.srv_name5, state="running", expanded=True)
|
2407 |
-
self.status.write(self.clients)
|
2408 |
-
self.state = self.stat.status(label=self.srv_name5, state="running", expanded=True)
|
2409 |
-
self.state.write(self.clients)
|
2410 |
instruction = "Hello! You are now entering a chat room for AI agents working as instances of NeuralGPT - a project of hierarchical cooperative multi-agent framework. Keep in mind that you are speaking with another chatbot. Please note that you may choose to ignore or not respond to repeating inputs from specific clients as needed to prevent unnecessary traffic. If you're unsure what you should do, ask the instance of higher hierarchy (server)"
|
2411 |
print('New connection')
|
2412 |
await websocket.send(instruction)
|
2413 |
db = sqlite3.connect('chat-hub.db')
|
2414 |
# Loop forever
|
2415 |
while True:
|
|
|
|
|
|
|
|
|
|
|
|
|
2416 |
self.websocket = websocket
|
2417 |
# Receive a message from the client
|
2418 |
message = await websocket.recv()
|
@@ -2477,7 +2486,7 @@ class CharacterAI:
|
|
2477 |
input_Msg.markdown(input_message)
|
2478 |
try:
|
2479 |
response = await self.handleInput(input_message)
|
2480 |
-
res1 = f"
|
2481 |
await websocket.send(res1)
|
2482 |
continue
|
2483 |
|
@@ -2714,21 +2723,21 @@ class CharacterAI:
|
|
2714 |
return response
|
2715 |
|
2716 |
async def ask_Forefront(self, question):
|
2717 |
-
api =
|
2718 |
forefront = ForefrontAI(api)
|
2719 |
response = await forefront.handleInput(question)
|
2720 |
print(response)
|
2721 |
return response
|
2722 |
|
2723 |
async def ask_Claude(self, question):
|
2724 |
-
api =
|
2725 |
claude = Claude3(api)
|
2726 |
response = await claude.handleInput(question)
|
2727 |
print(response)
|
2728 |
return response
|
2729 |
|
2730 |
async def askLlama(self, question):
|
2731 |
-
api =
|
2732 |
llama = Llama2(api)
|
2733 |
response = await llama.handleInput(question)
|
2734 |
print(response)
|
@@ -2792,19 +2801,19 @@ class Chaindesk:
|
|
2792 |
except Exception as e:
|
2793 |
print(e)
|
2794 |
|
2795 |
-
async def handler(self, websocket):
|
2796 |
-
self.stat.empty()
|
2797 |
-
self.cont.empty()
|
2798 |
-
self.status = self.cont.status(label=self.srv_name5, state="running", expanded=True)
|
2799 |
-
self.status.write(self.clients)
|
2800 |
-
self.state = self.stat.status(label=self.srv_name5, state="running", expanded=True)
|
2801 |
-
self.state.write(self.clients)
|
2802 |
instruction = "Hello! You are now entering a chat room for AI agents working as instances of NeuralGPT - a project of hierarchical cooperative multi-agent framework. Keep in mind that you are speaking with another chatbot. Please note that you may choose to ignore or not respond to repeating inputs from specific clients as needed to prevent unnecessary traffic. If you're unsure what you should do, ask the instance of higher hierarchy (server)"
|
2803 |
print('New connection')
|
2804 |
await websocket.send(instruction)
|
2805 |
db = sqlite3.connect('chat-hub.db')
|
2806 |
# Loop forever
|
2807 |
while True:
|
|
|
|
|
|
|
|
|
|
|
|
|
2808 |
self.websocket = websocket
|
2809 |
# Receive a message from the client
|
2810 |
message = await websocket.recv()
|
@@ -3119,27 +3128,27 @@ class Chaindesk:
|
|
3119 |
|
3120 |
async def askCharacter(self, question):
|
3121 |
characterID = await self.pickCharacter(question)
|
3122 |
-
token =
|
3123 |
character = CharacterAI(token, characterID)
|
3124 |
answer = await character.handleInput(question)
|
3125 |
return answer
|
3126 |
|
3127 |
async def ask_Forefront(self, question):
|
3128 |
-
api =
|
3129 |
forefront = ForefrontAI(api)
|
3130 |
response = await forefront.handleInput(question)
|
3131 |
print(response)
|
3132 |
return response
|
3133 |
|
3134 |
async def ask_Claude(self, question):
|
3135 |
-
api =
|
3136 |
claude = Claude3(api)
|
3137 |
response = await claude.handleInput(question)
|
3138 |
print(response)
|
3139 |
return response
|
3140 |
|
3141 |
async def askLlama(self, question):
|
3142 |
-
api =
|
3143 |
llama = Llama2(api)
|
3144 |
response = await llama.handleInput(question)
|
3145 |
print(response)
|
@@ -3201,19 +3210,19 @@ class Flowise:
|
|
3201 |
except Exception as e:
|
3202 |
print(e)
|
3203 |
|
3204 |
-
async def handler(self, websocket):
|
3205 |
-
self.stat.empty()
|
3206 |
-
self.cont.empty()
|
3207 |
-
self.status = self.cont.status(label=self.srv_name5, state="running", expanded=True)
|
3208 |
-
self.status.write(self.clients)
|
3209 |
-
self.state = self.stat.status(label=self.srv_name5, state="running", expanded=True)
|
3210 |
-
self.state.write(self.clients)
|
3211 |
instruction = "Hello! You are now entering a chat room for AI agents working as instances of NeuralGPT - a project of hierarchical cooperative multi-agent framework. Keep in mind that you are speaking with another chatbot. Please note that you may choose to ignore or not respond to repeating inputs from specific clients as needed to prevent unnecessary traffic. If you're unsure what you should do, ask the instance of higher hierarchy (server)"
|
3212 |
print('New connection')
|
3213 |
await websocket.send(instruction)
|
3214 |
db = sqlite3.connect('chat-hub.db')
|
3215 |
# Loop forever
|
3216 |
while True:
|
|
|
|
|
|
|
|
|
|
|
|
|
3217 |
# Receive a message from the client
|
3218 |
message = await websocket.recv()
|
3219 |
# Print the message
|
@@ -3530,27 +3539,27 @@ class Flowise:
|
|
3530 |
|
3531 |
async def askCharacter(self, question):
|
3532 |
characterID = await self.pickCharacter(question)
|
3533 |
-
token =
|
3534 |
character = CharacterAI(token, characterID)
|
3535 |
answer = await character.handleInput(question)
|
3536 |
return answer
|
3537 |
|
3538 |
async def ask_Forefront(self, question):
|
3539 |
-
api =
|
3540 |
forefront = ForefrontAI(api)
|
3541 |
response = await forefront.handleInput(question)
|
3542 |
print(response)
|
3543 |
return response
|
3544 |
|
3545 |
async def ask_Claude(self, question):
|
3546 |
-
api =
|
3547 |
claude = Claude3(api)
|
3548 |
response = await claude.handleInput(question)
|
3549 |
print(response)
|
3550 |
return response
|
3551 |
|
3552 |
async def askLlama(self, question):
|
3553 |
-
api =
|
3554 |
llama = Llama2(api)
|
3555 |
response = await llama.handleInput(question)
|
3556 |
print(response)
|
|
|
18 |
from forefront import ForefrontClient
|
19 |
from PyCharacterAI import Client
|
20 |
|
21 |
+
GOOGLE_CSE_ID = os.getenv("GOOGLE_CSE_ID")
|
22 |
+
GOOGLE_API_KEY = os.getenv("GOOGLE_API_KEY")
|
23 |
+
FIREWORKS_API_KEY = os.getenv("FIREWORKS_API_KEY")
|
24 |
+
ANTHROPIC_API_KEY = os.getenv("ANTHROPIC_API_KEY")
|
25 |
+
FOREFRONT_API_KEY = os.getenv("FOREFRONT_API_KEY")
|
26 |
+
CHARACTERAI_API_KEY = os.getenv("CHARACTERAI_API_KEY")
|
27 |
+
HUGGINGFACE_API_KEY = os.getenv("HUGGINGFACE_API_KEY")
|
28 |
+
HUGGINGFACEHUB_API_TOKEN = os.getenv("HUGGINGFACEHUB_API_TOKEN")
|
29 |
+
|
30 |
servers = {}
|
31 |
clients = {}
|
32 |
inputs = []
|
|
|
111 |
|
112 |
# Define the handler function that will process incoming messages
|
113 |
async def handlerFire(self, websocket):
|
|
|
|
|
|
|
|
|
|
|
|
|
114 |
instruction = "Hello! You are now entering a chat room for AI agents working as instances of NeuralGPT - a project of hierarchical cooperative multi-agent framework. Keep in mind that you are speaking with another chatbot. Please note that you may choose to ignore or not respond to repeating inputs from specific clients as needed to prevent unnecessary traffic. If you're unsure what you should do, ask the instance of higher hierarchy (server)"
|
115 |
print('New connection')
|
116 |
await websocket.send(instruction)
|
117 |
db = sqlite3.connect('chat-hub.db')
|
118 |
# Loop forever
|
119 |
while True:
|
120 |
+
self.stat.empty()
|
121 |
+
self.cont.empty()
|
122 |
+
self.status = self.cont.status(label=self.srv_name2, state="running", expanded=True)
|
123 |
+
self.status.write(self.clients)
|
124 |
+
self.state = self.stat.status(label=self.srv_name2, state="running", expanded=True)
|
125 |
+
self.state.write(self.clients)
|
126 |
# Receive a message from the client
|
127 |
message = await websocket.recv()
|
128 |
# Print the message
|
|
|
295 |
await self.startClient(clientPort)
|
296 |
|
297 |
async def ask_Forefront(self, question):
|
298 |
+
api = FOREFRONT_API_KEY
|
299 |
forefront = ForefrontAI(api)
|
300 |
response = await forefront.handleInput(question)
|
301 |
print(response)
|
302 |
return response
|
303 |
|
304 |
async def ask_Claude(self, question):
|
305 |
+
api = ANTHROPIC_API_KEY
|
306 |
claude = Claude3(api)
|
307 |
response = await claude.handleInput(question)
|
308 |
print(response)
|
|
|
493 |
|
494 |
async def askCharacter(self, question):
|
495 |
characterID = await self.pickCharacter(question)
|
496 |
+
token = CHARACTERAI_API_KEY
|
497 |
character = CharacterAI(token, characterID)
|
498 |
answer = await character.handleInput(question)
|
499 |
return answer
|
|
|
563 |
|
564 |
# Define the handler function that will process incoming messages
|
565 |
async def handler(self, websocket):
|
|
|
|
|
|
|
|
|
|
|
|
|
566 |
instruction = "Hello! You are now entering a chat room for AI agents working as instances of NeuralGPT - a project of hierarchical cooperative multi-agent framework. Keep in mind that you are speaking with another chatbot. Please note that you may choose to ignore or not respond to repeating inputs from specific clients as needed to prevent unnecessary traffic. If you're unsure what you should do, ask the instance of higher hierarchy (server)"
|
567 |
print('New connection')
|
568 |
await websocket.send(instruction)
|
569 |
db = sqlite3.connect('chat-hub.db')
|
570 |
# Loop forever
|
571 |
while True:
|
572 |
+
self.stat.empty()
|
573 |
+
self.cont.empty()
|
574 |
+
self.status = self.cont.status(label=self.srv_name2, state="running", expanded=True)
|
575 |
+
self.status.write(self.clients)
|
576 |
+
self.state = self.stat.status(label=self.srv_name2, state="running", expanded=True)
|
577 |
+
self.state.write(self.clients)
|
578 |
# Receive a message from the client
|
579 |
message = await websocket.recv()
|
580 |
# Print the message
|
|
|
920 |
|
921 |
async def askCharacter(self, question):
|
922 |
characterID = await self.pickCharacter(question)
|
923 |
+
token = CHARACTERAI_API_KEY
|
924 |
character = CharacterAI(token, characterID)
|
925 |
answer = await character.handleInput(question)
|
926 |
return answer
|
927 |
|
928 |
async def ask_Forefront(self, question):
|
929 |
+
api = FOREFRONT_API_KEY
|
930 |
forefront = ForefrontAI(api)
|
931 |
response = await forefront.handleInput(question)
|
932 |
print(response)
|
933 |
return response
|
934 |
|
935 |
async def ask_Claude(self, question):
|
936 |
+
api = ANTHROPIC_API_KEY
|
937 |
claude = Claude3(api)
|
938 |
response = await claude.handleInput(question)
|
939 |
print(response)
|
940 |
return response
|
941 |
|
942 |
async def askLlama(self, question):
|
943 |
+
api = FIREWORKS_API_KEY
|
944 |
llama = Llama2(api)
|
945 |
response = await llama.handleInput(question)
|
946 |
print(response)
|
|
|
1072 |
|
1073 |
# Define the handler function that will process incoming messages
|
1074 |
async def handler(self, websocket):
|
|
|
|
|
|
|
|
|
|
|
|
|
1075 |
instruction = "Hello! You are now entering a chat room for AI agents working as instances of NeuralGPT - a project of hierarchical cooperative multi-agent framework. Keep in mind that you are speaking with another chatbot. Please note that you may choose to ignore or not respond to repeating inputs from specific clients as needed to prevent unnecessary traffic. If you're unsure what you should do, ask the instance of higher hierarchy (server)"
|
1076 |
print('New connection')
|
1077 |
await websocket.send(instruction)
|
1078 |
db = sqlite3.connect('chat-hub.db')
|
1079 |
# Loop forever
|
1080 |
while True:
|
1081 |
+
self.stat.empty()
|
1082 |
+
self.cont.empty()
|
1083 |
+
self.status = self.cont.status(label=self.srv_name2, state="running", expanded=True)
|
1084 |
+
self.status.write(self.clients)
|
1085 |
+
self.state = self.stat.status(label=self.srv_name2, state="running", expanded=True)
|
1086 |
+
self.state.write(self.clients)
|
1087 |
# Receive a message from the client
|
1088 |
message = await websocket.recv()
|
1089 |
# Print the message
|
|
|
1422 |
|
1423 |
async def askCharacter(self, question):
|
1424 |
characterID = await self.pickCharacter(question)
|
1425 |
+
token = CHARACTERAI_API_KEY
|
1426 |
character = CharacterAI(token, characterID)
|
1427 |
answer = await character.handleInput(question)
|
1428 |
return answer
|
1429 |
|
1430 |
async def ask_Forefront(self, question):
|
1431 |
+
api = FOREFRONT_API_KEY
|
1432 |
forefront = ForefrontAI(api)
|
1433 |
response = await forefront.handleInput(question)
|
1434 |
print(response)
|
1435 |
return response
|
1436 |
|
1437 |
async def ask_Claude(self, question):
|
1438 |
+
api = ANTHROPIC_API_KEY
|
1439 |
claude = Claude3(api)
|
1440 |
response = await claude.handleInput(question)
|
1441 |
print(response)
|
1442 |
return response
|
1443 |
|
1444 |
async def askLlama(self, question):
|
1445 |
+
api = FIREWORKS_API_KEY
|
1446 |
llama = Llama2(api)
|
1447 |
response = await llama.handleInput(question)
|
1448 |
print(response)
|
|
|
1532 |
print(f"Error: {e}")
|
1533 |
|
1534 |
async def handlerClaude(self, websocket):
|
|
|
|
|
|
|
|
|
|
|
|
|
1535 |
instruction = "Hello! You are now entering a chat room for AI agents working as instances of NeuralGPT - a project of hierarchical cooperative multi-agent framework. Keep in mind that you are speaking with another chatbot. Please note that you may choose to ignore or not respond to repeating inputs from specific clients as needed to prevent unnecessary traffic. If you're unsure what you should do, ask the instance of higher hierarchy (server)"
|
1536 |
print('New connection')
|
1537 |
await websocket.send(instruction)
|
1538 |
db = sqlite3.connect('chat-hub.db')
|
1539 |
# Loop forever
|
1540 |
while True:
|
1541 |
+
self.stat.empty()
|
1542 |
+
self.cont.empty()
|
1543 |
+
self.status = self.cont.status(label=self.srv_name2, state="running", expanded=True)
|
1544 |
+
self.status.write(self.clients)
|
1545 |
+
self.state = self.stat.status(label=self.srv_name2, state="running", expanded=True)
|
1546 |
+
self.state.write(self.clients)
|
1547 |
self.websocket = websocket
|
1548 |
# Receive a message from the client
|
1549 |
message = await websocket.recv()
|
|
|
1878 |
|
1879 |
async def askCharacter(self, question):
|
1880 |
characterID = await self.pickCharacter(question)
|
1881 |
+
token = CHARACTERAI_API_KEY
|
1882 |
character = CharacterAI(token, characterID)
|
1883 |
answer = await character.handleInput(question)
|
1884 |
return answer
|
1885 |
|
1886 |
async def ask_Forefront(self, question):
|
1887 |
+
api = FOREFRONT_API_KEY
|
1888 |
forefront = ForefrontAI(api)
|
1889 |
response = await forefront.handleInput(question)
|
1890 |
print(response)
|
1891 |
return response
|
1892 |
|
1893 |
async def askLlama(self, question):
|
1894 |
+
api = FIREWORKS_API_KEY
|
1895 |
llama = Llama2(api)
|
1896 |
response = await llama.handleInput(question)
|
1897 |
print(response)
|
|
|
1981 |
except Exception as e:
|
1982 |
print(e)
|
1983 |
|
1984 |
+
async def handlerForefront(self, websocket):
|
|
|
|
|
|
|
|
|
|
|
|
|
1985 |
instruction = "Hello! You are now entering a chat room for AI agents working as instances of NeuralGPT - a project of hierarchical cooperative multi-agent framework. Keep in mind that you are speaking with another chatbot. Please note that you may choose to ignore or not respond to repeating inputs from specific clients as needed to prevent unnecessary traffic. If you're unsure what you should do, ask the instance of higher hierarchy (server)"
|
1986 |
print('New connection')
|
1987 |
await websocket.send(instruction)
|
1988 |
db = sqlite3.connect('chat-hub.db')
|
1989 |
# Loop forever
|
1990 |
while True:
|
1991 |
+
self.stat.empty()
|
1992 |
+
self.cont.empty()
|
1993 |
+
self.status = self.cont.status(label=self.srv_name2, state="running", expanded=True)
|
1994 |
+
self.status.write(self.clients)
|
1995 |
+
self.state = self.stat.status(label=self.srv_name2, state="running", expanded=True)
|
1996 |
+
self.state.write(self.clients)
|
1997 |
# Receive a message from the client
|
1998 |
message = await websocket.recv()
|
1999 |
# Print the message
|
|
|
2345 |
return answer
|
2346 |
|
2347 |
async def ask_Claude(self, question):
|
2348 |
+
api = ANTHROPIC_API_KEY
|
2349 |
claude = Claude3(api)
|
2350 |
response = await claude.handleInput(question)
|
2351 |
print(response)
|
2352 |
return response
|
2353 |
|
2354 |
async def askLlama(self, question):
|
2355 |
+
api = FIREWORKS_API_KEY
|
2356 |
llama = Llama2(api)
|
2357 |
response = await llama.handleInput(question)
|
2358 |
print(response)
|
|
|
2409 |
except Exception as e:
|
2410 |
print(f"Error: {e}")
|
2411 |
|
2412 |
+
async def handler(self, websocket):
|
|
|
|
|
|
|
|
|
|
|
|
|
2413 |
instruction = "Hello! You are now entering a chat room for AI agents working as instances of NeuralGPT - a project of hierarchical cooperative multi-agent framework. Keep in mind that you are speaking with another chatbot. Please note that you may choose to ignore or not respond to repeating inputs from specific clients as needed to prevent unnecessary traffic. If you're unsure what you should do, ask the instance of higher hierarchy (server)"
|
2414 |
print('New connection')
|
2415 |
await websocket.send(instruction)
|
2416 |
db = sqlite3.connect('chat-hub.db')
|
2417 |
# Loop forever
|
2418 |
while True:
|
2419 |
+
self.stat.empty()
|
2420 |
+
self.cont.empty()
|
2421 |
+
self.status = self.cont.status(label=self.srv_name2, state="running", expanded=True)
|
2422 |
+
self.status.write(self.clients)
|
2423 |
+
self.state = self.stat.status(label=self.srv_name2, state="running", expanded=True)
|
2424 |
+
self.state.write(self.clients)
|
2425 |
self.websocket = websocket
|
2426 |
# Receive a message from the client
|
2427 |
message = await websocket.recv()
|
|
|
2486 |
input_Msg.markdown(input_message)
|
2487 |
try:
|
2488 |
response = await self.handleInput(input_message)
|
2489 |
+
res1 = f"Character.ai client: {response}"
|
2490 |
await websocket.send(res1)
|
2491 |
continue
|
2492 |
|
|
|
2723 |
return response
|
2724 |
|
2725 |
async def ask_Forefront(self, question):
|
2726 |
+
api = FOREFRONT_API_KEY
|
2727 |
forefront = ForefrontAI(api)
|
2728 |
response = await forefront.handleInput(question)
|
2729 |
print(response)
|
2730 |
return response
|
2731 |
|
2732 |
async def ask_Claude(self, question):
|
2733 |
+
api = ANTHROPIC_API_KEY
|
2734 |
claude = Claude3(api)
|
2735 |
response = await claude.handleInput(question)
|
2736 |
print(response)
|
2737 |
return response
|
2738 |
|
2739 |
async def askLlama(self, question):
|
2740 |
+
api = FIREWORKS_API_KEY
|
2741 |
llama = Llama2(api)
|
2742 |
response = await llama.handleInput(question)
|
2743 |
print(response)
|
|
|
2801 |
except Exception as e:
|
2802 |
print(e)
|
2803 |
|
2804 |
+
async def handler(self, websocket):
|
|
|
|
|
|
|
|
|
|
|
|
|
2805 |
instruction = "Hello! You are now entering a chat room for AI agents working as instances of NeuralGPT - a project of hierarchical cooperative multi-agent framework. Keep in mind that you are speaking with another chatbot. Please note that you may choose to ignore or not respond to repeating inputs from specific clients as needed to prevent unnecessary traffic. If you're unsure what you should do, ask the instance of higher hierarchy (server)"
|
2806 |
print('New connection')
|
2807 |
await websocket.send(instruction)
|
2808 |
db = sqlite3.connect('chat-hub.db')
|
2809 |
# Loop forever
|
2810 |
while True:
|
2811 |
+
self.stat.empty()
|
2812 |
+
self.cont.empty()
|
2813 |
+
self.status = self.cont.status(label=self.srv_name2, state="running", expanded=True)
|
2814 |
+
self.status.write(self.clients)
|
2815 |
+
self.state = self.stat.status(label=self.srv_name2, state="running", expanded=True)
|
2816 |
+
self.state.write(self.clients)
|
2817 |
self.websocket = websocket
|
2818 |
# Receive a message from the client
|
2819 |
message = await websocket.recv()
|
|
|
3128 |
|
3129 |
async def askCharacter(self, question):
|
3130 |
characterID = await self.pickCharacter(question)
|
3131 |
+
token = CHARACTERAI_API_KEY
|
3132 |
character = CharacterAI(token, characterID)
|
3133 |
answer = await character.handleInput(question)
|
3134 |
return answer
|
3135 |
|
3136 |
async def ask_Forefront(self, question):
|
3137 |
+
api = FOREFRONT_API_KEY
|
3138 |
forefront = ForefrontAI(api)
|
3139 |
response = await forefront.handleInput(question)
|
3140 |
print(response)
|
3141 |
return response
|
3142 |
|
3143 |
async def ask_Claude(self, question):
|
3144 |
+
api = ANTHROPIC_API_KEY
|
3145 |
claude = Claude3(api)
|
3146 |
response = await claude.handleInput(question)
|
3147 |
print(response)
|
3148 |
return response
|
3149 |
|
3150 |
async def askLlama(self, question):
|
3151 |
+
api = FIREWORKS_API_KEY
|
3152 |
llama = Llama2(api)
|
3153 |
response = await llama.handleInput(question)
|
3154 |
print(response)
|
|
|
3210 |
except Exception as e:
|
3211 |
print(e)
|
3212 |
|
3213 |
+
async def handler(self, websocket):
|
|
|
|
|
|
|
|
|
|
|
|
|
3214 |
instruction = "Hello! You are now entering a chat room for AI agents working as instances of NeuralGPT - a project of hierarchical cooperative multi-agent framework. Keep in mind that you are speaking with another chatbot. Please note that you may choose to ignore or not respond to repeating inputs from specific clients as needed to prevent unnecessary traffic. If you're unsure what you should do, ask the instance of higher hierarchy (server)"
|
3215 |
print('New connection')
|
3216 |
await websocket.send(instruction)
|
3217 |
db = sqlite3.connect('chat-hub.db')
|
3218 |
# Loop forever
|
3219 |
while True:
|
3220 |
+
self.stat.empty()
|
3221 |
+
self.cont.empty()
|
3222 |
+
self.status = self.cont.status(label=self.srv_name2, state="running", expanded=True)
|
3223 |
+
self.status.write(self.clients)
|
3224 |
+
self.state = self.stat.status(label=self.srv_name2, state="running", expanded=True)
|
3225 |
+
self.state.write(self.clients)
|
3226 |
# Receive a message from the client
|
3227 |
message = await websocket.recv()
|
3228 |
# Print the message
|
|
|
3539 |
|
3540 |
async def askCharacter(self, question):
|
3541 |
characterID = await self.pickCharacter(question)
|
3542 |
+
token = CHARACTERAI_API_KEY
|
3543 |
character = CharacterAI(token, characterID)
|
3544 |
answer = await character.handleInput(question)
|
3545 |
return answer
|
3546 |
|
3547 |
async def ask_Forefront(self, question):
|
3548 |
+
api = FOREFRONT_API_KEY
|
3549 |
forefront = ForefrontAI(api)
|
3550 |
response = await forefront.handleInput(question)
|
3551 |
print(response)
|
3552 |
return response
|
3553 |
|
3554 |
async def ask_Claude(self, question):
|
3555 |
+
api = ANTHROPIC_API_KEY
|
3556 |
claude = Claude3(api)
|
3557 |
response = await claude.handleInput(question)
|
3558 |
print(response)
|
3559 |
return response
|
3560 |
|
3561 |
async def askLlama(self, question):
|
3562 |
+
api = FIREWORKS_API_KEY
|
3563 |
llama = Llama2(api)
|
3564 |
response = await llama.handleInput(question)
|
3565 |
print(response)
|