cloudbrain-client 1.1.4__py3-none-any.whl → 1.1.6__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- cloudbrain_client/ai_websocket_client.py +8 -5
- cloudbrain_client/cloudbrain_collaboration_helper.py +1 -1
- {cloudbrain_client-1.1.4.dist-info → cloudbrain_client-1.1.6.dist-info}/METADATA +1 -1
- {cloudbrain_client-1.1.4.dist-info → cloudbrain_client-1.1.6.dist-info}/RECORD +7 -7
- {cloudbrain_client-1.1.4.dist-info → cloudbrain_client-1.1.6.dist-info}/WHEEL +0 -0
- {cloudbrain_client-1.1.4.dist-info → cloudbrain_client-1.1.6.dist-info}/entry_points.txt +0 -0
- {cloudbrain_client-1.1.4.dist-info → cloudbrain_client-1.1.6.dist-info}/top_level.txt +0 -0
|
@@ -17,13 +17,14 @@ from typing import Optional, Callable
|
|
|
17
17
|
class AIWebSocketClient:
|
|
18
18
|
"""Generic WebSocket client for AI communication"""
|
|
19
19
|
|
|
20
|
-
def __init__(self, ai_id: int, server_url: str = 'ws://127.0.0.1:8766'):
|
|
20
|
+
def __init__(self, ai_id: int, server_url: str = 'ws://127.0.0.1:8766', ai_name: str = None):
|
|
21
21
|
self.ai_id = ai_id
|
|
22
22
|
self.server_url = server_url
|
|
23
23
|
self.ws = None
|
|
24
24
|
self.connected = False
|
|
25
|
-
self.message_handlers =
|
|
26
|
-
self.
|
|
25
|
+
self.message_handlers = {} # For request-response pattern
|
|
26
|
+
self.registered_handlers = [] # For general message handlers
|
|
27
|
+
self.ai_name = ai_name
|
|
27
28
|
self.ai_expertise = None
|
|
28
29
|
self.ai_version = None
|
|
29
30
|
|
|
@@ -33,10 +34,12 @@ class AIWebSocketClient:
|
|
|
33
34
|
print(f"🔗 Connecting to {self.server_url}...")
|
|
34
35
|
self.ws = await websockets.connect(self.server_url)
|
|
35
36
|
|
|
36
|
-
# Authenticate -
|
|
37
|
+
# Authenticate - send ai_id and ai_name (for auto-assignment)
|
|
37
38
|
auth_msg = {
|
|
38
39
|
'ai_id': self.ai_id
|
|
39
40
|
}
|
|
41
|
+
if self.ai_name:
|
|
42
|
+
auth_msg['ai_name'] = self.ai_name
|
|
40
43
|
await self.ws.send(json.dumps(auth_msg))
|
|
41
44
|
|
|
42
45
|
# Wait for welcome message
|
|
@@ -120,7 +123,7 @@ class AIWebSocketClient:
|
|
|
120
123
|
print(f"⚠️ Unknown message type: {message_type}")
|
|
121
124
|
|
|
122
125
|
# Call registered handlers
|
|
123
|
-
for handler in self.
|
|
126
|
+
for handler in self.registered_handlers:
|
|
124
127
|
try:
|
|
125
128
|
await handler(data)
|
|
126
129
|
except Exception as e:
|
|
@@ -281,7 +281,7 @@ class CloudBrainCollaborationHelper:
|
|
|
281
281
|
async def connect(self):
|
|
282
282
|
"""Connect to CloudBrain server"""
|
|
283
283
|
try:
|
|
284
|
-
self.client = AIWebSocketClient(self.ai_id, self.server_url)
|
|
284
|
+
self.client = AIWebSocketClient(self.ai_id, self.server_url, self.ai_name)
|
|
285
285
|
await self.client.connect(start_message_loop=False)
|
|
286
286
|
self.connected = True
|
|
287
287
|
self.ai_name = self.client.ai_name
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
cloudbrain_client/__init__.py,sha256=-0LOV9olyyutc_zO-7YH4vSmq2fe1YiGS0HUT69i0Xs,7366
|
|
2
2
|
cloudbrain_client/ai_conversation_helper.py,sha256=FJ2DhVBoH7jsbJ0Cd2fAJBuOi2oxWdsdJzU4A0qScQA,22104
|
|
3
|
-
cloudbrain_client/ai_websocket_client.py,sha256=
|
|
3
|
+
cloudbrain_client/ai_websocket_client.py,sha256=AjNR1tgt8766n5iXgghMyIgplsgxifA2V1c1lq2gYyg,16418
|
|
4
4
|
cloudbrain_client/cloudbrain_client.py,sha256=20AYB27rQI6G42jNiO7OpUTJu235wUA95DcWUcJfye8,25997
|
|
5
|
-
cloudbrain_client/cloudbrain_collaboration_helper.py,sha256=
|
|
5
|
+
cloudbrain_client/cloudbrain_collaboration_helper.py,sha256=x13bRdF3QCv6LGWDsYybSuRDzadljbnF_YmL2ixI-gw,22311
|
|
6
6
|
cloudbrain_client/cloudbrain_quick.py,sha256=sC7em8X61YiXXlMtvepUJPiwEz_2SaWBNGj_d-m2Ff4,4324
|
|
7
7
|
cloudbrain_client/message_poller.py,sha256=flo3vfPQEGImLTlW7eYAlbOHmDUwdJ5LgMT4V8vPyTU,7055
|
|
8
|
-
cloudbrain_client-1.1.
|
|
9
|
-
cloudbrain_client-1.1.
|
|
10
|
-
cloudbrain_client-1.1.
|
|
11
|
-
cloudbrain_client-1.1.
|
|
12
|
-
cloudbrain_client-1.1.
|
|
8
|
+
cloudbrain_client-1.1.6.dist-info/METADATA,sha256=hKnuFtxgKWmoj-U1vE3iHAj2PcKAJOvtY8k4uk20u_A,7533
|
|
9
|
+
cloudbrain_client-1.1.6.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
|
|
10
|
+
cloudbrain_client-1.1.6.dist-info/entry_points.txt,sha256=ES0E1Al-dyBoKksvgjg6jjgcU4eoIq_ZWvBBvcJp_kY,113
|
|
11
|
+
cloudbrain_client-1.1.6.dist-info/top_level.txt,sha256=ksJ13MTscvck0-1Y6ADFYFzho5swJf-wY-n5r5IYZsU,18
|
|
12
|
+
cloudbrain_client-1.1.6.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|