@builder.io/ai-utils 0.3.16 → 0.3.17

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/src/messages.js DELETED
@@ -1,16 +0,0 @@
1
- export function getContentText(message) {
2
- if (typeof message === "string") {
3
- return message;
4
- }
5
- return message
6
- .map((item) => (item.type === "text" ? item.text : ""))
7
- .join("");
8
- }
9
- export function getContentAttachments(message) {
10
- if (typeof message === "string") {
11
- return [];
12
- }
13
- return message
14
- .filter((item) => item.type === "image")
15
- .map((item) => item.source);
16
- }
package/src/settings.d.ts DELETED
@@ -1,20 +0,0 @@
1
- export interface AssistantSettings {
2
- assistantType?: string;
3
- viewId?: string;
4
- theme?: "dark" | "light";
5
- }
6
- interface IframeSettings extends Partial<AssistantSettings> {
7
- local?: boolean;
8
- /**
9
- * The URL of the assistant.
10
- */
11
- baseUrl?: string;
12
- }
13
- export declare function getAssistantUrl(opts?: IframeSettings): string;
14
- export declare function parseAssistantUrlSettings(url: string): Partial<AssistantSettings>;
15
- export interface BuilderEditorAuth {
16
- spaceId: string;
17
- userId: string;
18
- authToken: string;
19
- }
20
- export {};
package/src/settings.js DELETED
@@ -1,30 +0,0 @@
1
- const urlParamSettings = [
2
- "assistantType",
3
- "theme",
4
- "viewId",
5
- ];
6
- export function getAssistantUrl(opts = {}) {
7
- var _a;
8
- const url = new URL((_a = opts.baseUrl) !== null && _a !== void 0 ? _a : (opts.local ? "http://localhost:7242" : "https://assistant.builder.io"));
9
- urlParamSettings.forEach((key) => {
10
- const value = opts[key];
11
- if (typeof value === "string" || typeof value === "boolean") {
12
- url.searchParams.set(key, String(value));
13
- }
14
- });
15
- return url.href;
16
- }
17
- export function parseAssistantUrlSettings(url) {
18
- const parsed = new URL(url);
19
- const settings = {};
20
- urlParamSettings.forEach((key) => {
21
- const value = parsed.searchParams.get(key);
22
- if (value === "true" || value === "false") {
23
- settings[key] = value === "true";
24
- }
25
- else if (value) {
26
- settings[key] = value;
27
- }
28
- });
29
- return settings;
30
- }
File without changes