@singlebase/elements 0.3.0 → 0.6.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/README.md +2 -0
- package/dist/{display-8HEcKYR4.js → authui-display-CKfGK5va.js} +519 -502
- package/dist/authui-display-CKfGK5va.js.map +1 -0
- package/dist/{display-CLDNNZQy.cjs → authui-display-aWNht0cW.cjs} +38 -58
- package/dist/authui-display-aWNht0cW.cjs.map +1 -0
- package/dist/authui.cjs +1 -1
- package/dist/authui.d.ts +9 -9
- package/dist/authui.js +2 -2
- package/dist/chat-C-gsskho.cjs +3258 -0
- package/dist/chat-C-gsskho.cjs.map +1 -0
- package/dist/chat-CEh6RygY.js +5746 -0
- package/dist/chat-CEh6RygY.js.map +1 -0
- package/dist/chat-messages.d.ts +115 -0
- package/dist/chat.cjs +2 -0
- package/dist/chat.cjs.map +1 -0
- package/dist/chat.d.ts +11 -0
- package/dist/chat.js +15 -0
- package/dist/chat.js.map +1 -0
- package/dist/elements/{account-screen.d.ts → authui-account.d.ts} +1 -1
- package/dist/elements/{base.d.ts → authui-base.d.ts} +2 -0
- package/dist/elements/{buttons.d.ts → authui-buttons.d.ts} +2 -2
- package/dist/elements/{display.d.ts → authui-display.d.ts} +2 -2
- package/dist/elements/{form-base.d.ts → authui-form-base.d.ts} +1 -1
- package/dist/elements/{guard.d.ts → authui-guard.d.ts} +1 -1
- package/dist/elements/{auth-screen.d.ts → authui.d.ts} +8 -4
- package/dist/elements/chat.d.ts +455 -0
- package/dist/elements/uploader.d.ts +14 -0
- package/dist/files-DDJWPzZW.js +215 -0
- package/dist/files-DDJWPzZW.js.map +1 -0
- package/dist/files-DyxcjZsx.cjs +75 -0
- package/dist/files-DyxcjZsx.cjs.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +3 -2
- package/dist/index.js +34 -21
- package/dist/index.js.map +1 -1
- package/dist/singlebase-elements.min.js +8044 -2120
- package/dist/singlebase-elements.min.js.map +1 -1
- package/dist/styles/branding.d.ts +5 -0
- package/dist/styles/chat.d.ts +6 -0
- package/dist/styles/tokens.d.ts +3 -1
- package/dist/{uploader-eFYKpk8b.cjs → uploader-660JIgIN.cjs} +55 -114
- package/dist/uploader-660JIgIN.cjs.map +1 -0
- package/dist/{uploader-D-Da1trc.js → uploader-vfczkX51.js} +376 -507
- package/dist/uploader-vfczkX51.js.map +1 -0
- package/dist/uploader.cjs +1 -1
- package/dist/uploader.js +5 -4
- package/dist/uploader.js.map +1 -1
- package/dist/utils/branding.d.ts +8 -0
- package/dist/utils/markdown.d.ts +165 -0
- package/dist/utils/svg.d.ts +10 -0
- package/package.json +13 -5
- package/dist/display-8HEcKYR4.js.map +0 -1
- package/dist/display-CLDNNZQy.cjs.map +0 -1
- package/dist/uploader-D-Da1trc.js.map +0 -1
- package/dist/uploader-eFYKpk8b.cjs.map +0 -1
|
@@ -0,0 +1,455 @@
|
|
|
1
|
+
import { LitElement, type PropertyValues, type TemplateResult } from "lit";
|
|
2
|
+
import { type SinglebaseChatMessages } from "../chat-messages.js";
|
|
3
|
+
import { type Block, type ChatFormat } from "../utils/markdown.js";
|
|
4
|
+
export type ChatMode = "chat" | "rag";
|
|
5
|
+
export type ChatEmbed = "page" | "inline" | "launcher";
|
|
6
|
+
export type ChatGlow = "subtle" | "vivid" | "off";
|
|
7
|
+
export type ChatExportFormat = "md" | "txt" | "json" | "copy";
|
|
8
|
+
/** `auto` docks when there's room; `none` removes the list and its toggle. */
|
|
9
|
+
export type ChatSidebar = "auto" | "open" | "closed" | "none";
|
|
10
|
+
/** What the chat needs from a client: `llm.call`, and nothing else. */
|
|
11
|
+
export type ChatClient = {
|
|
12
|
+
llm: {
|
|
13
|
+
call<T = unknown>(method: string, payload?: unknown, options?: {
|
|
14
|
+
signal?: AbortSignal;
|
|
15
|
+
}): Promise<T>;
|
|
16
|
+
};
|
|
17
|
+
};
|
|
18
|
+
/** A row of `llm.list_chats`. */
|
|
19
|
+
export interface ChatSummary {
|
|
20
|
+
_id: string;
|
|
21
|
+
title: string | null;
|
|
22
|
+
bookmarked?: boolean;
|
|
23
|
+
message_count?: number;
|
|
24
|
+
_created_at?: string;
|
|
25
|
+
_modified_at?: string;
|
|
26
|
+
}
|
|
27
|
+
/** A text file attached to one message, sent to the model as retrieval. */
|
|
28
|
+
export interface ChatAttachment {
|
|
29
|
+
name: string;
|
|
30
|
+
size: number;
|
|
31
|
+
content: string;
|
|
32
|
+
}
|
|
33
|
+
export interface ChatMessage {
|
|
34
|
+
/** Local identity, stable across renders. */
|
|
35
|
+
key: string;
|
|
36
|
+
/** The server's message id, once known. Bookmark and delete need it. */
|
|
37
|
+
id: string | null;
|
|
38
|
+
role: "user" | "assistant";
|
|
39
|
+
/** The text. For replies, the FOLLOWUPS tail is already split off. */
|
|
40
|
+
content: string;
|
|
41
|
+
at: number;
|
|
42
|
+
bookmarked: boolean;
|
|
43
|
+
/** Retrieved documents the reply used, as the server recorded them. */
|
|
44
|
+
sources: Record<string, unknown>[];
|
|
45
|
+
followups: string[];
|
|
46
|
+
phase: "pending" | "streaming" | "done" | "error";
|
|
47
|
+
error?: string;
|
|
48
|
+
stopped?: boolean;
|
|
49
|
+
feedback?: "up" | "down";
|
|
50
|
+
attachments?: ChatAttachment[];
|
|
51
|
+
execTime?: number;
|
|
52
|
+
model?: string;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Draws a fenced block the host knows about, e.g. ```order {"id":"A-1"}```.
|
|
56
|
+
* Return a Lit template, a DOM node or text; return null to fall back to code.
|
|
57
|
+
*/
|
|
58
|
+
export type ChatBlockRenderer = (source: string, context: {
|
|
59
|
+
lang: string;
|
|
60
|
+
message: ChatMessage;
|
|
61
|
+
}) => unknown;
|
|
62
|
+
/**
|
|
63
|
+
* Runs before each message is sent. Return the payload (changed or not), a new
|
|
64
|
+
* payload, or `false` to cancel. Anything else stops the send.
|
|
65
|
+
*/
|
|
66
|
+
export type ChatBeforeSend = (payload: Record<string, unknown>, context: {
|
|
67
|
+
chatId: string | null;
|
|
68
|
+
isNew: boolean;
|
|
69
|
+
message: ChatMessage;
|
|
70
|
+
}) => Record<string, unknown> | false | Promise<Record<string, unknown> | false>;
|
|
71
|
+
/** Runs after a reply is parsed. Return the blocks to draw. */
|
|
72
|
+
export type ChatAfterParse = (blocks: Block[], context: {
|
|
73
|
+
message: ChatMessage;
|
|
74
|
+
format: ChatFormat;
|
|
75
|
+
}) => Block[];
|
|
76
|
+
export interface ChatPrompt {
|
|
77
|
+
label?: string;
|
|
78
|
+
text: string;
|
|
79
|
+
}
|
|
80
|
+
/** Every setting in one object, keyed by property name. */
|
|
81
|
+
export interface ChatConfig {
|
|
82
|
+
/** The client to chat with. Defaults to the page's SinglebaseClient(). */
|
|
83
|
+
client: ChatClient | null;
|
|
84
|
+
/** Opens this saved chat. */
|
|
85
|
+
chatId: string;
|
|
86
|
+
embed: ChatEmbed;
|
|
87
|
+
mode: ChatMode;
|
|
88
|
+
format: ChatFormat;
|
|
89
|
+
renderers: Record<string, ChatBlockRenderer>;
|
|
90
|
+
beforeSend: ChatBeforeSend | null;
|
|
91
|
+
afterParse: ChatAfterParse | null;
|
|
92
|
+
glow: ChatGlow;
|
|
93
|
+
position: "right" | "left";
|
|
94
|
+
sidebar: ChatSidebar;
|
|
95
|
+
showTitle: boolean;
|
|
96
|
+
assistantName: string;
|
|
97
|
+
logoUrl: string;
|
|
98
|
+
heading: string;
|
|
99
|
+
description: string;
|
|
100
|
+
eyebrow: string;
|
|
101
|
+
prompts: string | (string | ChatPrompt)[];
|
|
102
|
+
bubbleText: string;
|
|
103
|
+
greetingBubble: boolean;
|
|
104
|
+
unreadBadge: boolean;
|
|
105
|
+
allowUpload: boolean;
|
|
106
|
+
allowExport: boolean;
|
|
107
|
+
allowRaw: boolean;
|
|
108
|
+
allowCopy: boolean;
|
|
109
|
+
allowRegenerate: boolean;
|
|
110
|
+
allowBookmark: boolean;
|
|
111
|
+
allowDelete: boolean;
|
|
112
|
+
allowRename: boolean;
|
|
113
|
+
allowFeedback: boolean;
|
|
114
|
+
showTime: boolean;
|
|
115
|
+
showComposer: boolean;
|
|
116
|
+
footnote: string;
|
|
117
|
+
brandingText: string;
|
|
118
|
+
brandingUrl: string;
|
|
119
|
+
branding: boolean;
|
|
120
|
+
followups: boolean;
|
|
121
|
+
showFollowups: boolean;
|
|
122
|
+
showSources: boolean;
|
|
123
|
+
showNewChat: boolean;
|
|
124
|
+
showBookmarked: boolean;
|
|
125
|
+
allowSearch: boolean;
|
|
126
|
+
autoTitle: boolean;
|
|
127
|
+
model: string;
|
|
128
|
+
params: Record<string, unknown>;
|
|
129
|
+
systemMessage: string;
|
|
130
|
+
retrieval: Record<string, unknown>[];
|
|
131
|
+
metadata: Record<string, unknown>;
|
|
132
|
+
messages: Partial<SinglebaseChatMessages>;
|
|
133
|
+
theme: "light" | "dark";
|
|
134
|
+
radius: "sharp" | "default" | "round";
|
|
135
|
+
}
|
|
136
|
+
/** A readable view of whatever shape the server recorded for a source. */
|
|
137
|
+
export declare function describeSource(source: Record<string, unknown>, n: number): {
|
|
138
|
+
n: number;
|
|
139
|
+
title: string;
|
|
140
|
+
path: string;
|
|
141
|
+
collection: string;
|
|
142
|
+
updated: string;
|
|
143
|
+
text: string;
|
|
144
|
+
score: number | null;
|
|
145
|
+
};
|
|
146
|
+
/**
|
|
147
|
+
* An AI chat workspace backed by the `llm.*` service.
|
|
148
|
+
*
|
|
149
|
+
* <singlebase-chat></singlebase-chat>
|
|
150
|
+
* <singlebase-chat embed="inline" mode="rag" retrieval='[{"type":"kdb","namespace":"docs"}]'></singlebase-chat>
|
|
151
|
+
* <singlebase-chat embed="launcher" greeting-bubble unread-badge></singlebase-chat>
|
|
152
|
+
*
|
|
153
|
+
* Conversations live on the server, scoped to the signed-in user: the list
|
|
154
|
+
* comes from `llm.list_chats`, a thread from `llm.get_chat`, and each turn is
|
|
155
|
+
* one `llm.chat`. Titles and follow-up questions never add turns to the
|
|
156
|
+
* conversation — titles come from `llm.generate`, follow-ups from the reply.
|
|
157
|
+
*/
|
|
158
|
+
export declare class SinglebaseChat extends LitElement {
|
|
159
|
+
static styles: import("lit").CSSResult[];
|
|
160
|
+
/** An explicit client. Omit it and the page's SinglebaseClient() is used. */
|
|
161
|
+
accessor client: ChatClient | null;
|
|
162
|
+
accessor messages: Partial<SinglebaseChatMessages>;
|
|
163
|
+
accessor theme: "light" | "dark" | undefined;
|
|
164
|
+
/** Corner preset for this element: `sharp`, `default` or `round`. */
|
|
165
|
+
accessor radius: "sharp" | "default" | "round" | undefined;
|
|
166
|
+
/** `chat` free-form, `rag` grounded with citations, `rich` charts and tables. */
|
|
167
|
+
accessor mode: ChatMode;
|
|
168
|
+
/**
|
|
169
|
+
* How much of a reply is formatted: `raw` (the text as written), `plain`
|
|
170
|
+
* (light formatting), `advanced` (+ tables, CSV, JSON and SVG) or `rich`
|
|
171
|
+
* (+ callouts, charts, images and `renderers`). Copy and export always use
|
|
172
|
+
* the original text.
|
|
173
|
+
*/
|
|
174
|
+
accessor format: ChatFormat;
|
|
175
|
+
/** Your own fenced blocks, by language. Drawn at the `rich` level. */
|
|
176
|
+
accessor renderers: Record<string, ChatBlockRenderer>;
|
|
177
|
+
/**
|
|
178
|
+
* Preflight for every message: gets the `llm.chat` payload, returns it
|
|
179
|
+
* (changed or not), or `false` to cancel. May be async.
|
|
180
|
+
*/
|
|
181
|
+
accessor beforeSend: ChatBeforeSend | null;
|
|
182
|
+
/** Rewrites a reply's parsed blocks before they're drawn. Returns the blocks. */
|
|
183
|
+
accessor afterParse: ChatAfterParse | null;
|
|
184
|
+
accessor glow: ChatGlow;
|
|
185
|
+
/** Ask the model for follow-up questions with each reply. */
|
|
186
|
+
accessor followups: boolean;
|
|
187
|
+
/** The "Cited sources" cards and the "Searched n sources" row under answers. */
|
|
188
|
+
accessor showSources: boolean;
|
|
189
|
+
/** The New chat button. */
|
|
190
|
+
accessor showNewChat: boolean;
|
|
191
|
+
/** The pinned "Bookmarked" group in the chat list. */
|
|
192
|
+
accessor showBookmarked: boolean;
|
|
193
|
+
/** Show the follow-up questions under the latest reply. */
|
|
194
|
+
accessor showFollowups: boolean;
|
|
195
|
+
/** The search box in the chat list. */
|
|
196
|
+
accessor allowSearch: boolean;
|
|
197
|
+
/** Replace the provisional title with a model-written one after the first reply. */
|
|
198
|
+
accessor autoTitle: boolean;
|
|
199
|
+
/** Model for new turns; empty uses the chat's, then the project default. */
|
|
200
|
+
accessor model: string;
|
|
201
|
+
accessor params: Record<string, unknown>;
|
|
202
|
+
/** Extra instructions, sent when a chat is created. */
|
|
203
|
+
accessor systemMessage: string;
|
|
204
|
+
/** Retrieval sources sent with every turn: `[{"type":"kdb","namespace":"docs"}]`. */
|
|
205
|
+
accessor retrieval: Record<string, unknown>[];
|
|
206
|
+
/** Stored on each user message. Never sent to the model. */
|
|
207
|
+
accessor metadata: Record<string, unknown>;
|
|
208
|
+
accessor embed: ChatEmbed;
|
|
209
|
+
/** Launcher side. */
|
|
210
|
+
accessor position: "right" | "left";
|
|
211
|
+
/**
|
|
212
|
+
* The chat list: `auto` docks it when there's room, `open` / `closed` set
|
|
213
|
+
* how it starts, `none` removes it and its toggle entirely.
|
|
214
|
+
*/
|
|
215
|
+
accessor sidebar: ChatSidebar;
|
|
216
|
+
accessor showTitle: boolean;
|
|
217
|
+
/** Opens this chat on load. */
|
|
218
|
+
accessor chatIdAttr: string;
|
|
219
|
+
/** Used in placeholders, exports and labels. Never shown above messages. */
|
|
220
|
+
accessor assistantName: string;
|
|
221
|
+
accessor logoUrl: string;
|
|
222
|
+
accessor heading: string;
|
|
223
|
+
accessor description: string;
|
|
224
|
+
/** The small label above the heading. Unset uses the mode's; `""` hides it. */
|
|
225
|
+
accessor eyebrow: string | undefined;
|
|
226
|
+
/**
|
|
227
|
+
* Suggested prompts: `|`-separated in markup, an array in JavaScript.
|
|
228
|
+
* `"none"` or `[]` shows no suggestions.
|
|
229
|
+
*/
|
|
230
|
+
accessor prompts: string | (string | ChatPrompt)[];
|
|
231
|
+
accessor bubbleText: string;
|
|
232
|
+
accessor greetingBubble: boolean;
|
|
233
|
+
accessor unreadBadge: boolean;
|
|
234
|
+
accessor allowUpload: boolean;
|
|
235
|
+
accessor allowExport: boolean;
|
|
236
|
+
/** Copy buttons on messages. */
|
|
237
|
+
accessor allowCopy: boolean;
|
|
238
|
+
/** Regenerate on the latest reply. */
|
|
239
|
+
accessor allowRegenerate: boolean;
|
|
240
|
+
/** Bookmark buttons for chats and messages. */
|
|
241
|
+
accessor allowBookmark: boolean;
|
|
242
|
+
/** Delete buttons for chats and messages. */
|
|
243
|
+
accessor allowDelete: boolean;
|
|
244
|
+
/** Renaming a chat from its title or the chat list. */
|
|
245
|
+
accessor allowRename: boolean;
|
|
246
|
+
/** The helpful / not helpful buttons on replies. */
|
|
247
|
+
accessor allowFeedback: boolean;
|
|
248
|
+
/**
|
|
249
|
+
* The message box. Off, the chat only shows the conversation — pair it with
|
|
250
|
+
* `chat-id` to display a saved chat read-only.
|
|
251
|
+
*/
|
|
252
|
+
accessor showComposer: boolean;
|
|
253
|
+
/** Message times in the toolbars. */
|
|
254
|
+
accessor showTime: boolean;
|
|
255
|
+
/**
|
|
256
|
+
* The line under the composer. Unset uses the default ("{name} can make
|
|
257
|
+
* mistakes…"); an empty string hides it.
|
|
258
|
+
*/
|
|
259
|
+
accessor footnote: string | undefined;
|
|
260
|
+
/** A per-reply toggle between the formatted answer and the text as written. */
|
|
261
|
+
accessor allowRaw: boolean;
|
|
262
|
+
/** The "Chat by Singlebase" credit. A plain link — it makes no request. */
|
|
263
|
+
accessor branding: boolean;
|
|
264
|
+
/** The credit's text. Empty uses the element's default ("… by Singlebase"). */
|
|
265
|
+
accessor brandingText: string;
|
|
266
|
+
/** Where the credit links to. Only http(s); anything else uses singlebase.cloud. */
|
|
267
|
+
accessor brandingUrl: string;
|
|
268
|
+
private accessor chatList;
|
|
269
|
+
private accessor listState;
|
|
270
|
+
private accessor activeId;
|
|
271
|
+
private accessor chatTitle;
|
|
272
|
+
private accessor bookmarked;
|
|
273
|
+
private accessor msgs;
|
|
274
|
+
private accessor loadingThread;
|
|
275
|
+
private accessor threadError;
|
|
276
|
+
private accessor busy;
|
|
277
|
+
private accessor draft;
|
|
278
|
+
private accessor files;
|
|
279
|
+
private accessor search;
|
|
280
|
+
private accessor sidebarOpen;
|
|
281
|
+
private accessor width;
|
|
282
|
+
private accessor panel;
|
|
283
|
+
private accessor menuOpen;
|
|
284
|
+
private accessor editingKey;
|
|
285
|
+
private accessor editDraft;
|
|
286
|
+
private accessor editingTitle;
|
|
287
|
+
private accessor renamingId;
|
|
288
|
+
private accessor toast;
|
|
289
|
+
private accessor copiedKey;
|
|
290
|
+
private accessor retrievalOpen;
|
|
291
|
+
private accessor rawKeys;
|
|
292
|
+
private accessor hasSidebarContent;
|
|
293
|
+
private accessor sorts;
|
|
294
|
+
private accessor arrivedKey;
|
|
295
|
+
private accessor dragging;
|
|
296
|
+
private accessor showJump;
|
|
297
|
+
private accessor offline;
|
|
298
|
+
private accessor isOpen;
|
|
299
|
+
private accessor expanded;
|
|
300
|
+
private accessor bubble;
|
|
301
|
+
private accessor seen;
|
|
302
|
+
private accessor mobile;
|
|
303
|
+
private run;
|
|
304
|
+
private abort;
|
|
305
|
+
private revealTimer;
|
|
306
|
+
private timers;
|
|
307
|
+
private toastTimer;
|
|
308
|
+
private stick;
|
|
309
|
+
private renamed;
|
|
310
|
+
private observer;
|
|
311
|
+
private observed;
|
|
312
|
+
private media;
|
|
313
|
+
private focusNext;
|
|
314
|
+
private bubbleScheduled;
|
|
315
|
+
private pendingChatId;
|
|
316
|
+
get msg(): SinglebaseChatMessages;
|
|
317
|
+
/** An explicit `.client`, else the page default. */
|
|
318
|
+
get resolvedClient(): ChatClient | null;
|
|
319
|
+
/** The open conversation's id, or null for a new chat. */
|
|
320
|
+
get chatId(): string | null;
|
|
321
|
+
/** The open conversation's messages. */
|
|
322
|
+
get thread(): readonly ChatMessage[];
|
|
323
|
+
/** `format`, falling back to the default for anything unknown. */
|
|
324
|
+
private get formatLevel();
|
|
325
|
+
/** The loaded chat list. */
|
|
326
|
+
get chats(): readonly ChatSummary[];
|
|
327
|
+
/**
|
|
328
|
+
* Every setting in one object, keyed by property name:
|
|
329
|
+
*
|
|
330
|
+
* chat.config = { client, mode: "rag", format: "rich", retrieval: [...], chatId: "…" };
|
|
331
|
+
*
|
|
332
|
+
* Unknown keys are ignored. `chatId` opens that chat; reading `config`
|
|
333
|
+
* returns the current settings with `chatId` as the open chat.
|
|
334
|
+
*/
|
|
335
|
+
set config(value: Partial<ChatConfig>);
|
|
336
|
+
/**
|
|
337
|
+
* Changes settings on the fly. Only the keys you pass change; the chat keeps
|
|
338
|
+
* its conversation and re-renders in place. Returns the element, so calls chain.
|
|
339
|
+
*
|
|
340
|
+
* chat.configure({ format: "rich" }).configure({ theme: "dark" });
|
|
341
|
+
*/
|
|
342
|
+
configure(options: Partial<ChatConfig>): this;
|
|
343
|
+
get config(): Partial<ChatConfig>;
|
|
344
|
+
connectedCallback(): void;
|
|
345
|
+
disconnectedCallback(): void;
|
|
346
|
+
willUpdate(changed: PropertyValues<this>): void;
|
|
347
|
+
firstUpdated(): void;
|
|
348
|
+
updated(): void;
|
|
349
|
+
private onNetwork;
|
|
350
|
+
private onMedia;
|
|
351
|
+
private later;
|
|
352
|
+
private emit;
|
|
353
|
+
private get docked();
|
|
354
|
+
private get panelDocked();
|
|
355
|
+
/** Starts a new, empty conversation. */
|
|
356
|
+
newChat(): void;
|
|
357
|
+
/** Opens a saved conversation. */
|
|
358
|
+
openChat(id: string): Promise<void>;
|
|
359
|
+
/** Sends a message; with no argument, sends the composer's text. */
|
|
360
|
+
send(text?: string): Promise<void>;
|
|
361
|
+
/** Stops waiting for, or revealing, the current reply. */
|
|
362
|
+
stop(): void;
|
|
363
|
+
/** Downloads the open conversation, or copies it as Markdown. */
|
|
364
|
+
exportChat(format?: ChatExportFormat): void;
|
|
365
|
+
/** Inline and launcher: fill the window. */
|
|
366
|
+
expand(): void;
|
|
367
|
+
collapse(): void;
|
|
368
|
+
/** Launcher: open the panel. */
|
|
369
|
+
open(): void;
|
|
370
|
+
/** Launcher: close the panel. */
|
|
371
|
+
close(): void;
|
|
372
|
+
private userMessage;
|
|
373
|
+
private systemPrompt;
|
|
374
|
+
private payloadFor;
|
|
375
|
+
private runTurn;
|
|
376
|
+
private failTurn;
|
|
377
|
+
/**
|
|
378
|
+
* The service answers in one piece; this reveals it progressively so it
|
|
379
|
+
* reads like a stream. Capped at about a second and a half.
|
|
380
|
+
*/
|
|
381
|
+
private reveal;
|
|
382
|
+
/** Cancels any request or reveal in flight. */
|
|
383
|
+
private halt;
|
|
384
|
+
private retitle;
|
|
385
|
+
private applyTitle;
|
|
386
|
+
/**
|
|
387
|
+
* Enter and blur both land here. Saving on Enter directly (not via blur())
|
|
388
|
+
* matters: blur never fires on an input that doesn't have focus.
|
|
389
|
+
*/
|
|
390
|
+
private commitTitle;
|
|
391
|
+
private commitRename;
|
|
392
|
+
private renameChat;
|
|
393
|
+
private fromServer;
|
|
394
|
+
private loadChats;
|
|
395
|
+
private upsertChat;
|
|
396
|
+
private touchChat;
|
|
397
|
+
private resetViewState;
|
|
398
|
+
private deleteOnServer;
|
|
399
|
+
private regenerate;
|
|
400
|
+
private retry;
|
|
401
|
+
private saveEdit;
|
|
402
|
+
private toggleRaw;
|
|
403
|
+
private copy;
|
|
404
|
+
private toggleMessageBookmark;
|
|
405
|
+
private toggleChatBookmark;
|
|
406
|
+
/** Removed at once; the server call waits out the undo window. */
|
|
407
|
+
private deleteMessage;
|
|
408
|
+
private deleteChat;
|
|
409
|
+
private feedback;
|
|
410
|
+
private showToast;
|
|
411
|
+
/** Ends the current toast, committing whatever it was holding back. */
|
|
412
|
+
private flushToast;
|
|
413
|
+
private undo;
|
|
414
|
+
private addFiles;
|
|
415
|
+
private scrollToBottom;
|
|
416
|
+
private onScroll;
|
|
417
|
+
private jumpToLatest;
|
|
418
|
+
private onKeydown;
|
|
419
|
+
private onComposerKey;
|
|
420
|
+
private onComposerInput;
|
|
421
|
+
private onDragEnter;
|
|
422
|
+
private onDragLeave;
|
|
423
|
+
private onDrop;
|
|
424
|
+
render(): TemplateResult<1>;
|
|
425
|
+
private renderLauncher;
|
|
426
|
+
private renderWorkspace;
|
|
427
|
+
private renderSidebar;
|
|
428
|
+
private renderThreadRow;
|
|
429
|
+
private renderHeader;
|
|
430
|
+
private renderExportMenu;
|
|
431
|
+
/** The suggestion cards. `[]` or `"none"` shows none; unset uses the mode's. */
|
|
432
|
+
private promptList;
|
|
433
|
+
private renderWelcome;
|
|
434
|
+
private renderThread;
|
|
435
|
+
private renderUser;
|
|
436
|
+
private pillLabel;
|
|
437
|
+
private renderBot;
|
|
438
|
+
private renderAnswer;
|
|
439
|
+
private renderInline;
|
|
440
|
+
private renderBlock;
|
|
441
|
+
private renderList;
|
|
442
|
+
private renderCode;
|
|
443
|
+
/** A host renderer for this language, at the rich level only. */
|
|
444
|
+
private renderCustom;
|
|
445
|
+
private renderTable;
|
|
446
|
+
private renderJsonBlock;
|
|
447
|
+
private renderChart;
|
|
448
|
+
private renderPanel;
|
|
449
|
+
private renderComposer;
|
|
450
|
+
}
|
|
451
|
+
declare global {
|
|
452
|
+
interface HTMLElementTagNameMap {
|
|
453
|
+
"singlebase-chat": SinglebaseChat;
|
|
454
|
+
}
|
|
455
|
+
}
|
|
@@ -50,6 +50,8 @@ export interface UploaderConfig {
|
|
|
50
50
|
allowRename: boolean;
|
|
51
51
|
autoUpload: boolean;
|
|
52
52
|
branding: boolean;
|
|
53
|
+
brandingText: string;
|
|
54
|
+
brandingUrl: string;
|
|
53
55
|
logoUrl: string;
|
|
54
56
|
logoText: string;
|
|
55
57
|
heading: string;
|
|
@@ -67,6 +69,7 @@ export interface UploaderConfig {
|
|
|
67
69
|
messages: Partial<SinglebaseUploadMessages>;
|
|
68
70
|
theme: "light" | "dark";
|
|
69
71
|
density: "comfortable" | "compact";
|
|
72
|
+
radius: "sharp" | "default" | "round";
|
|
70
73
|
onComplete: SinglebaseUploader["onComplete"];
|
|
71
74
|
onError: SinglebaseUploader["onError"];
|
|
72
75
|
}
|
|
@@ -93,6 +96,8 @@ export declare class SinglebaseUploader extends LitElement {
|
|
|
93
96
|
accessor messages: Partial<SinglebaseUploadMessages>;
|
|
94
97
|
accessor theme: "light" | "dark" | undefined;
|
|
95
98
|
accessor density: "comfortable" | "compact" | undefined;
|
|
99
|
+
/** Corner preset for this element: `sharp`, `default` or `round`. */
|
|
100
|
+
accessor radius: "sharp" | "default" | "round" | undefined;
|
|
96
101
|
/**
|
|
97
102
|
* `full` is the card with a dropzone and a reviewable list, `compact` the
|
|
98
103
|
* one-line attachments row, `button` a single control that uploads as soon
|
|
@@ -107,6 +112,10 @@ export declare class SinglebaseUploader extends LitElement {
|
|
|
107
112
|
accessor autoUpload: boolean;
|
|
108
113
|
/** The "Files by Singlebase" credit. A plain link — it makes no request. */
|
|
109
114
|
accessor branding: boolean;
|
|
115
|
+
/** The credit's text. Empty uses the element's default ("… by Singlebase"). */
|
|
116
|
+
accessor brandingText: string;
|
|
117
|
+
/** Where the credit links to. Only http(s); anything else uses singlebase.cloud. */
|
|
118
|
+
accessor brandingUrl: string;
|
|
110
119
|
accessor logoUrl: string;
|
|
111
120
|
accessor logoText: string;
|
|
112
121
|
accessor heading: string;
|
|
@@ -168,6 +177,11 @@ export declare class SinglebaseUploader extends LitElement {
|
|
|
168
177
|
* Unknown keys are ignored. Reading it returns the current settings.
|
|
169
178
|
*/
|
|
170
179
|
set config(value: Partial<UploaderConfig>);
|
|
180
|
+
/**
|
|
181
|
+
* Changes settings on the fly. Only the keys you pass change; staged files
|
|
182
|
+
* stay. Returns the element, so calls chain.
|
|
183
|
+
*/
|
|
184
|
+
configure(options: Partial<UploaderConfig>): this;
|
|
171
185
|
get config(): Partial<UploaderConfig>;
|
|
172
186
|
/** Drops every staged file and any notice. */
|
|
173
187
|
clear(): void;
|