@builder.io/ai-utils
Advanced tools
Comparing version 0.0.3 to 0.0.4
@@ -12,7 +12,2 @@ import type { BuilderElement, Component } from "@builder.io/sdk"; | ||
/** | ||
* Tools that the assistant can use to interact with the builder app, | ||
* such as "createModel". | ||
*/ | ||
tools?: ToolName[]; | ||
/** | ||
* The unique LOCAL identifier of the thread to submit the user message to. | ||
@@ -70,2 +65,1 @@ * This is used to identify the thread with our own id (openai assistant id is different) | ||
} | ||
export type ToolName = "createModel" | "updateModel"; |
@@ -5,3 +5,3 @@ import type { BuilderElement, Component } from "@builder.io/sdk"; | ||
export type BuilderAssistantEventHandler = (ev: BuilderAssistantEvent) => void; | ||
export type BuilderAssistantEvent = AppCloseEvent | AppMessagesClickEvent | AppMessagesGenerationEvent | AppPromptFocusEvent | AppPromptTextEvent | AppReadyEvent | AppSettingsResetEvent | AppSettingsSetEvent | AppThreadNewEvent | BuiderEditorStateEvent | ContentCreateEvent | ContentUpdateEvent | ContentCompleteEvent | ModelCreateEvent | ModelUpdateEvent | ResultEvent | ThreadCreatedEvent | ThreadMessageDeltaEvent | ThreadMessageCompletedEvent | ThreadMessageFeedbackEvent | ThreadRunRequiresActionEvent | ThreadRunStepCreatedEvent | ThreadRunStepDeltaEvent; | ||
export type BuilderAssistantEvent = AppCloseEvent | AppMessagesClickEvent | AppMessagesGenerationEvent | AppPromptFocusEvent | AppPromptTextEvent | AppReadyEvent | AppSettingsResetEvent | AppSettingsSetEvent | AppThreadNewEvent | BuiderEditorStateEvent | ContentCreateEvent | ContentUpdateEvent | ContentReplaceEvent | ContentCompleteEvent | ModelCreateEvent | ModelUpdateEvent | ResultEvent | ThreadCreatedEvent | ThreadMessageDeltaEvent | ThreadMessageCompletedEvent | ThreadMessageFeedbackEvent | ThreadRunRequiresActionEvent | ThreadRunStepCreatedEvent | ThreadRunStepDeltaEvent; | ||
export interface AppCloseEvent { | ||
@@ -79,2 +79,9 @@ type: "assistant.app.close"; | ||
} | ||
export interface ContentReplace { | ||
element: BuilderElement; | ||
} | ||
export interface ContentReplaceEvent { | ||
type: "assistant.content.replace"; | ||
data: ContentReplace; | ||
} | ||
export type ContentUpdatePatch = ContentPropsUpdatePatch | ContentStyleUpdatePatch | ContentTextUpdatePatch; | ||
@@ -81,0 +88,0 @@ export interface ContentPropsUpdatePatch { |
@@ -35,3 +35,10 @@ export async function fetchJsonl(input, init, onData) { | ||
try { | ||
onData(JSON.parse(line)); | ||
line = line.trim(); | ||
if (line.startsWith("{") && line.endsWith("}")) { | ||
onData(JSON.parse(line)); | ||
} | ||
else { | ||
reject(`Invalid JSONL line: ${line}`); | ||
return; | ||
} | ||
} | ||
@@ -38,0 +45,0 @@ catch (e) { |
@@ -14,4 +14,5 @@ import type { Message } from "./messages"; | ||
title?: string; | ||
assistantType?: string; | ||
created: number; | ||
messages: Message[]; | ||
} |
{ | ||
"name": "@builder.io/ai-utils", | ||
"version": "0.0.3", | ||
"version": "0.0.4", | ||
"description": "Builder.io AI utils", | ||
@@ -5,0 +5,0 @@ "type": "module", |
15408
509