@boldvideo/bold-js 1.3.0 → 1.5.0
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/CHANGELOG.md +58 -0
- package/README.md +21 -0
- package/dist/index.cjs +3 -1
- package/dist/index.d.ts +23 -2
- package/dist/index.js +3 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,63 @@
|
|
|
1
1
|
# @boldvideo/bold-js
|
|
2
2
|
|
|
3
|
+
## 1.5.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- c86e99c: Add conversation context support to AI Search
|
|
8
|
+
|
|
9
|
+
- Added `context` parameter to `SearchOptions` for passing conversation history
|
|
10
|
+
- Added `context` field to `AIResponse` for receiving updated conversation context
|
|
11
|
+
- Added `AIContextMessage` type for type-safe context messages
|
|
12
|
+
- Updated README with multi-turn conversation example
|
|
13
|
+
|
|
14
|
+
Usage:
|
|
15
|
+
|
|
16
|
+
```typescript
|
|
17
|
+
const first = await bold.ai.search({
|
|
18
|
+
prompt: "How do designers find clients?",
|
|
19
|
+
stream: false,
|
|
20
|
+
});
|
|
21
|
+
const followUp = await bold.ai.search({
|
|
22
|
+
prompt: "What about cold outreach?",
|
|
23
|
+
context: first.context,
|
|
24
|
+
stream: false,
|
|
25
|
+
});
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
### Patch Changes
|
|
29
|
+
|
|
30
|
+
- c961807: Fix AI search SSE stream termination: wait for 'complete' event instead of closing on 'message_complete'
|
|
31
|
+
|
|
32
|
+
- Added missing event types to AIEvent union: complete, token, answer
|
|
33
|
+
- Fixed parseSSE to terminate on 'complete' or 'error' events
|
|
34
|
+
- Added optional fields to match backend spec (query, context, response_id)
|
|
35
|
+
|
|
36
|
+
## 1.4.0
|
|
37
|
+
|
|
38
|
+
### Minor Changes
|
|
39
|
+
|
|
40
|
+
- 3b65bbf: Add conversation context support to AI Search
|
|
41
|
+
|
|
42
|
+
- Added `context` parameter to `SearchOptions` for passing conversation history
|
|
43
|
+
- Added `context` field to `AIResponse` for receiving updated conversation context
|
|
44
|
+
- Added `AIContextMessage` type for type-safe context messages
|
|
45
|
+
- Updated README with multi-turn conversation example
|
|
46
|
+
|
|
47
|
+
Usage:
|
|
48
|
+
|
|
49
|
+
```typescript
|
|
50
|
+
const first = await bold.ai.search({
|
|
51
|
+
prompt: "How do designers find clients?",
|
|
52
|
+
stream: false,
|
|
53
|
+
});
|
|
54
|
+
const followUp = await bold.ai.search({
|
|
55
|
+
prompt: "What about cold outreach?",
|
|
56
|
+
context: first.context,
|
|
57
|
+
stream: false,
|
|
58
|
+
});
|
|
59
|
+
```
|
|
60
|
+
|
|
3
61
|
## 1.3.0
|
|
4
62
|
|
|
5
63
|
### Minor Changes
|
package/README.md
CHANGED
|
@@ -54,6 +54,27 @@ const playlists = await bold.playlists.list();
|
|
|
54
54
|
|
|
55
55
|
```
|
|
56
56
|
|
|
57
|
+
### AI Search with Conversation Context
|
|
58
|
+
|
|
59
|
+
Use the `context` parameter to enable multi-turn conversations:
|
|
60
|
+
|
|
61
|
+
```js
|
|
62
|
+
// First question
|
|
63
|
+
const first = await bold.ai.search({
|
|
64
|
+
prompt: "How do indie designers find clients?",
|
|
65
|
+
stream: false
|
|
66
|
+
});
|
|
67
|
+
console.log(first.content);
|
|
68
|
+
|
|
69
|
+
// Follow-up with context from previous response
|
|
70
|
+
const followUp = await bold.ai.search({
|
|
71
|
+
prompt: "What about cold outreach specifically?",
|
|
72
|
+
context: first.context,
|
|
73
|
+
stream: false
|
|
74
|
+
});
|
|
75
|
+
console.log(followUp.content);
|
|
76
|
+
```
|
|
77
|
+
|
|
57
78
|
## Related Links
|
|
58
79
|
|
|
59
80
|
- **[Bold API Documentation](https://docs.boldvideo.io/docs/api)**
|
package/dist/index.cjs
CHANGED
|
@@ -247,7 +247,7 @@ async function* parseSSE(response) {
|
|
|
247
247
|
try {
|
|
248
248
|
const event = JSON.parse(json);
|
|
249
249
|
yield event;
|
|
250
|
-
if (event.type === "
|
|
250
|
+
if (event.type === "complete" || event.type === "error") {
|
|
251
251
|
await reader.cancel();
|
|
252
252
|
return;
|
|
253
253
|
}
|
|
@@ -319,6 +319,8 @@ function createAI(config) {
|
|
|
319
319
|
body.collection_id = options.collectionId;
|
|
320
320
|
if (options.videoId)
|
|
321
321
|
body.video_id = options.videoId;
|
|
322
|
+
if (options.context)
|
|
323
|
+
body.context = options.context;
|
|
322
324
|
if (options.stream === false) {
|
|
323
325
|
body.stream = false;
|
|
324
326
|
return jsonRequest(path, body, config);
|
package/dist/index.d.ts
CHANGED
|
@@ -208,9 +208,18 @@ type AIEvent = {
|
|
|
208
208
|
} | {
|
|
209
209
|
type: "sources";
|
|
210
210
|
sources: Source[];
|
|
211
|
+
query?: string;
|
|
211
212
|
} | {
|
|
212
213
|
type: "text_delta";
|
|
213
214
|
delta: string;
|
|
215
|
+
} | {
|
|
216
|
+
type: "token";
|
|
217
|
+
content: string;
|
|
218
|
+
} | {
|
|
219
|
+
type: "answer";
|
|
220
|
+
content: string;
|
|
221
|
+
response_id?: string;
|
|
222
|
+
context?: AIContextMessage[];
|
|
214
223
|
} | {
|
|
215
224
|
type: "clarification";
|
|
216
225
|
questions: string[];
|
|
@@ -218,7 +227,10 @@ type AIEvent = {
|
|
|
218
227
|
type: "message_complete";
|
|
219
228
|
content: string;
|
|
220
229
|
sources: Source[];
|
|
221
|
-
usage
|
|
230
|
+
usage?: AIUsage;
|
|
231
|
+
context?: AIContextMessage[];
|
|
232
|
+
} | {
|
|
233
|
+
type: "complete";
|
|
222
234
|
} | {
|
|
223
235
|
type: "error";
|
|
224
236
|
code: string;
|
|
@@ -235,6 +247,7 @@ interface AIResponse {
|
|
|
235
247
|
sources: Source[];
|
|
236
248
|
usage: AIUsage;
|
|
237
249
|
model?: string;
|
|
250
|
+
context?: AIContextMessage[];
|
|
238
251
|
}
|
|
239
252
|
/**
|
|
240
253
|
* Options for bold.ai.ask() and bold.ai.coach()
|
|
@@ -245,6 +258,13 @@ interface AskOptions {
|
|
|
245
258
|
conversationId?: string;
|
|
246
259
|
collectionId?: string;
|
|
247
260
|
}
|
|
261
|
+
/**
|
|
262
|
+
* Conversation message for AI context
|
|
263
|
+
*/
|
|
264
|
+
interface AIContextMessage {
|
|
265
|
+
role: 'user' | 'assistant';
|
|
266
|
+
content: string;
|
|
267
|
+
}
|
|
248
268
|
/**
|
|
249
269
|
* Options for bold.ai.search()
|
|
250
270
|
*/
|
|
@@ -254,6 +274,7 @@ interface SearchOptions {
|
|
|
254
274
|
limit?: number;
|
|
255
275
|
collectionId?: string;
|
|
256
276
|
videoId?: string;
|
|
277
|
+
context?: AIContextMessage[];
|
|
257
278
|
}
|
|
258
279
|
/**
|
|
259
280
|
* Options for bold.ai.chat()
|
|
@@ -380,4 +401,4 @@ declare const DEFAULT_API_BASE_URL = "https://app.boldvideo.io/api/v1/";
|
|
|
380
401
|
*/
|
|
381
402
|
declare const DEFAULT_INTERNAL_API_BASE_URL = "https://app.boldvideo.io/i/v1/";
|
|
382
403
|
|
|
383
|
-
export { AIEvent, AIResponse, AIUsage, Account, AccountAI, AskOptions, AssistantConfig, ChatOptions, ClientOptions, DEFAULT_API_BASE_URL, DEFAULT_INTERNAL_API_BASE_URL, MenuItem, Playlist, Portal, PortalDisplay, PortalLayout, PortalNavigation, PortalTheme, SearchOptions, Settings, Source, ThemeColors, ThemeConfig, Video, VideoAttachment, VideoDownloadUrls, VideoMetadata, VideoSubtitles, VideoTranscript, createClient };
|
|
404
|
+
export { AIContextMessage, AIEvent, AIResponse, AIUsage, Account, AccountAI, AskOptions, AssistantConfig, ChatOptions, ClientOptions, DEFAULT_API_BASE_URL, DEFAULT_INTERNAL_API_BASE_URL, MenuItem, Playlist, Portal, PortalDisplay, PortalLayout, PortalNavigation, PortalTheme, SearchOptions, Settings, Source, ThemeColors, ThemeConfig, Video, VideoAttachment, VideoDownloadUrls, VideoMetadata, VideoSubtitles, VideoTranscript, createClient };
|
package/dist/index.js
CHANGED
|
@@ -209,7 +209,7 @@ async function* parseSSE(response) {
|
|
|
209
209
|
try {
|
|
210
210
|
const event = JSON.parse(json);
|
|
211
211
|
yield event;
|
|
212
|
-
if (event.type === "
|
|
212
|
+
if (event.type === "complete" || event.type === "error") {
|
|
213
213
|
await reader.cancel();
|
|
214
214
|
return;
|
|
215
215
|
}
|
|
@@ -281,6 +281,8 @@ function createAI(config) {
|
|
|
281
281
|
body.collection_id = options.collectionId;
|
|
282
282
|
if (options.videoId)
|
|
283
283
|
body.video_id = options.videoId;
|
|
284
|
+
if (options.context)
|
|
285
|
+
body.context = options.context;
|
|
284
286
|
if (options.stream === false) {
|
|
285
287
|
body.stream = false;
|
|
286
288
|
return jsonRequest(path, body, config);
|