@butlerbot/sdk 0.0.6-alpha.3 → 0.0.6-alpha.5

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/config.js CHANGED
@@ -11,10 +11,10 @@ exports.CONFIG = {
11
11
  },
12
12
  history: {
13
13
  chat: {
14
- v1: { base: "/api/history/chat" },
14
+ v1: { base: "/api/convo/chat" },
15
15
  },
16
16
  chats: {
17
- v1: { base: "/convo/get/history" }
17
+ v1: { base: "/api/convo/get/history" }
18
18
  }
19
19
  }
20
20
  }
@@ -144,8 +144,11 @@ class Conversation {
144
144
  /** Sends a message into the conversation */
145
145
  send(message, cb, options) {
146
146
  return __awaiter(this, void 0, void 0, function* () {
147
- const url = this.formatURL(this.endpoints.conversation, Object.assign(Object.assign({ message }, this.options), options // overwrite convos for this call
148
- ));
147
+ const payload = Object.assign(Object.assign({ message }, this.options), options // overwrite convos for this call
148
+ );
149
+ if (this.convoId)
150
+ payload.chatId = this.convoId;
151
+ const url = this.formatURL(this.endpoints.conversation, payload);
149
152
  const sse = new eventsource_1.EventSource(url);
150
153
  sse.addEventListener("message", (event) => {
151
154
  const data = JSON.parse(event.data);
@@ -173,12 +173,16 @@ export type MessagePayload = {
173
173
  message: string;
174
174
  /** The UUID of this message */
175
175
  messageId: string;
176
+ /** Whether this message chunk is the final one */
177
+ completed: boolean;
176
178
  };
177
179
  export type ReasoningPayload = {
178
180
  /** The reasoning content */
179
181
  reasoning: string;
180
182
  /** The UUID of this reasoning */
181
183
  reasoningId: string;
184
+ /** Whether this reasoning chunk is the final one */
185
+ completed: boolean;
182
186
  };
183
187
  export type FilePayload = {
184
188
  /** The file URL */
@@ -221,19 +225,14 @@ export type BaseResponseMetadata = {
221
225
  };
222
226
  export type MessageEvent = {
223
227
  type: "message";
224
- payload: MessagePayload & {
225
- messageId: string;
226
- completed: boolean;
227
- };
228
+ payload: MessagePayload;
228
229
  metadata: BaseResponseMetadata & {
229
230
  display?: DisplayEntity;
230
231
  };
231
232
  };
232
233
  export type ReasoningEvent = {
233
234
  type: "reasoning";
234
- payload: ReasoningPayload & {
235
- completed: boolean;
236
- };
235
+ payload: ReasoningPayload;
237
236
  metadata: BaseResponseMetadata;
238
237
  };
239
238
  export type FileEvent = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@butlerbot/sdk",
3
- "version": "0.0.6-alpha.3",
3
+ "version": "0.0.6-alpha.5",
4
4
  "description": "The official ButlerBot SDK",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",