@base44-preview/sdk 0.8.16-pr.71.6dfec93 → 0.8.16-pr.71.a6a0503
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.
- package/dist/modules/agents.js +3 -16
- package/package.json +1 -1
package/dist/modules/agents.js
CHANGED
|
@@ -16,13 +16,7 @@ export function createAgentsModule({ axios, getSocket, appId, serverUrl, token,
|
|
|
16
16
|
return axios.post(`${baseURL}/conversations`, conversation);
|
|
17
17
|
};
|
|
18
18
|
const addMessage = async (conversation, message) => {
|
|
19
|
-
|
|
20
|
-
const socket = getSocket();
|
|
21
|
-
await socket.updateModel(room, {
|
|
22
|
-
...conversation,
|
|
23
|
-
messages: [...(conversation.messages || []), message],
|
|
24
|
-
});
|
|
25
|
-
return axios.post(`${baseURL}/conversations/${conversation.id}/messages`, { ...message, api_version: "v2" });
|
|
19
|
+
return axios.post(`${baseURL}/conversations/${conversation.id}/messages?api_version=v2`, message);
|
|
26
20
|
};
|
|
27
21
|
const subscribeToConversation = (conversationId, onUpdate) => {
|
|
28
22
|
const room = `/agent-conversations/${conversationId}`;
|
|
@@ -37,11 +31,10 @@ export function createAgentsModule({ axios, getSocket, appId, serverUrl, token,
|
|
|
37
31
|
connect: () => { },
|
|
38
32
|
update_model: async ({ data: jsonStr }) => {
|
|
39
33
|
const data = JSON.parse(jsonStr);
|
|
40
|
-
|
|
41
|
-
if (data._agent_message) {
|
|
34
|
+
if (data._message) {
|
|
42
35
|
// Wait for initial conversation to be loaded
|
|
43
36
|
await conversationPromise;
|
|
44
|
-
const message = data.
|
|
37
|
+
const message = data._message;
|
|
45
38
|
// Update local conversation state
|
|
46
39
|
if (currentConversation) {
|
|
47
40
|
const messages = currentConversation.messages || [];
|
|
@@ -56,12 +49,6 @@ export function createAgentsModule({ axios, getSocket, appId, serverUrl, token,
|
|
|
56
49
|
onUpdate === null || onUpdate === void 0 ? void 0 : onUpdate(currentConversation);
|
|
57
50
|
}
|
|
58
51
|
}
|
|
59
|
-
else {
|
|
60
|
-
// Old format: full conversation object
|
|
61
|
-
const conv = data;
|
|
62
|
-
currentConversation = conv;
|
|
63
|
-
onUpdate === null || onUpdate === void 0 ? void 0 : onUpdate(conv);
|
|
64
|
-
}
|
|
65
52
|
},
|
|
66
53
|
});
|
|
67
54
|
};
|