@tylertech/forge-ai 0.13.13 → 0.14.0-dev.1
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/custom-elements.json +5378 -4972
- package/dist/ai-chatbot/ai-chatbot.d.ts +16 -16
- package/dist/ai-chatbot/ai-chatbot.mjs +32 -60
- package/dist/ai-chatbot/index.d.ts +1 -1
- package/dist/ai-chatbot/types.d.ts +5 -5
- package/dist/ai-chatbot-launcher/ai-chatbot-launcher.d.ts +38 -1
- package/dist/ai-chatbot-launcher/ai-chatbot-launcher.mjs +225 -14
- package/dist/ai-chatbot-launcher/ai-chatbot-launcher.scss.mjs +1 -1
- package/dist/ai-conversations-panel/ai-conversations-panel.d.ts +3 -3
- package/dist/ai-conversations-panel/ai-conversations-panel.mjs +21 -21
- package/dist/ai-conversations-panel/ai-conversations-panel.scss.mjs +1 -1
- package/dist/ai-thread-actions-menu/ai-thread-actions-menu.mjs +1 -1
- package/dist/ai-threads-search/ai-threads-search.d.ts +36 -0
- package/dist/ai-threads-search/ai-threads-search.mjs +135 -67
- package/dist/ai-threads-search/ai-threads-search.scss.mjs +1 -1
- package/dist/core/overlay/overlay.d.ts +10 -0
- package/dist/core/overlay/overlay.mjs +15 -2
- package/dist/core/popover/popover.d.ts +10 -0
- package/dist/core/popover/popover.mjs +5 -0
- package/dist/utils.d.ts +18 -0
- package/dist/utils.mjs +35 -0
- package/package.json +1 -1
|
@@ -2,7 +2,7 @@ import { TemplateResult, CSSResult } from 'lit';
|
|
|
2
2
|
import { AiMessageThreadComponent } from '../ai-message-thread';
|
|
3
3
|
import { AiPromptComponent } from '../ai-prompt';
|
|
4
4
|
import { AiChatbotBase } from './ai-chatbot-base.js';
|
|
5
|
-
import { Agent, ChatMessage,
|
|
5
|
+
import { Agent, ChatMessage, ForgeAiChatbotThreadSelectEventData, ForgeAiChatbotThreadSearchEventData, ForgeAiChatbotThreadLoadMoreEventData, ForgeAiChatbotThreadRenameEventData, ForgeAiChatbotThreadDeleteEventData, ForgeAiChatbotContextRemoveEventData, Thread } from './types.js';
|
|
6
6
|
import { Ref } from 'lit/directives/ref.js';
|
|
7
7
|
declare global {
|
|
8
8
|
interface HTMLElementTagNameMap {
|
|
@@ -27,12 +27,12 @@ declare global {
|
|
|
27
27
|
'forge-ai-chatbot-thread-state-change': CustomEvent<void>;
|
|
28
28
|
'forge-ai-chatbot-conversations-open': CustomEvent<void>;
|
|
29
29
|
'forge-ai-chatbot-conversations-close': CustomEvent<void>;
|
|
30
|
-
'forge-ai-chatbot-
|
|
30
|
+
'forge-ai-chatbot-thread-select': CustomEvent<ForgeAiChatbotThreadSelectEventData>;
|
|
31
31
|
'forge-ai-chatbot-new-chat': CustomEvent<void>;
|
|
32
|
-
'forge-ai-chatbot-
|
|
33
|
-
'forge-ai-chatbot-
|
|
34
|
-
'forge-ai-chatbot-
|
|
35
|
-
'forge-ai-chatbot-
|
|
32
|
+
'forge-ai-chatbot-thread-search': CustomEvent<ForgeAiChatbotThreadSearchEventData>;
|
|
33
|
+
'forge-ai-chatbot-thread-load-more': CustomEvent<ForgeAiChatbotThreadLoadMoreEventData>;
|
|
34
|
+
'forge-ai-chatbot-thread-rename': CustomEvent<ForgeAiChatbotThreadRenameEventData>;
|
|
35
|
+
'forge-ai-chatbot-thread-delete': CustomEvent<ForgeAiChatbotThreadDeleteEventData>;
|
|
36
36
|
'forge-ai-chatbot-context-remove': CustomEvent<ForgeAiChatbotContextRemoveEventData>;
|
|
37
37
|
}
|
|
38
38
|
}
|
|
@@ -99,7 +99,7 @@ export declare const AiChatbotComponentTagName: keyof HTMLElementTagNameMap;
|
|
|
99
99
|
* @property {Suggestion[]} suggestions - Suggestions to display in the empty state
|
|
100
100
|
* @property {FeatureToggle} clearOption - Controls the clear-conversation header action. `'on'` (default) shows it when messages exist; `'off'` hides it entirely.
|
|
101
101
|
* @property {FeatureToggle} exportOption - Controls the export-conversation header action. `'on'` (default) shows it when messages exist; `'off'` hides it entirely.
|
|
102
|
-
* @property {string | null} selectedThreadId - The id of the currently selected
|
|
102
|
+
* @property {string | null} selectedThreadId - The id of the currently selected thread. Set this to highlight a thread in the conversations panel (e.g. when restoring a conversation loaded from the backend). Updated internally when a thread is selected or a new chat starts.
|
|
103
103
|
* @property {boolean} threadsLoading - When true, shows a loading indicator in the conversations panel's recent chats list while threads are loading (default: false)
|
|
104
104
|
*
|
|
105
105
|
* @cssproperty --forge-ai-chatbot-icon-color - The fill color for the AI icon. Defaults to `tertiary`.
|
|
@@ -123,12 +123,12 @@ export declare const AiChatbotComponentTagName: keyof HTMLElementTagNameMap;
|
|
|
123
123
|
* @event {CustomEvent<void>} forge-ai-chatbot-thread-state-change - Fired when there is a change to the thread state (messages, files, selected agent, etc). Use this to capture the latest thread state for persistence.
|
|
124
124
|
* @event {CustomEvent<void>} forge-ai-chatbot-conversations-open - Fired when conversations panel opens
|
|
125
125
|
* @event {CustomEvent<void>} forge-ai-chatbot-conversations-close - Fired when conversations panel closes
|
|
126
|
-
* @event {CustomEvent<
|
|
126
|
+
* @event {CustomEvent<ForgeAiChatbotThreadSelectEventData>} forge-ai-chatbot-thread-select - Fired when user selects a thread
|
|
127
127
|
* @event {CustomEvent<void>} forge-ai-chatbot-new-chat - Fired when user clicks new chat button (cancelable)
|
|
128
|
-
* @event {CustomEvent<
|
|
129
|
-
* @event {CustomEvent<
|
|
130
|
-
* @event {CustomEvent<
|
|
131
|
-
* @event {CustomEvent<
|
|
128
|
+
* @event {CustomEvent<ForgeAiChatbotThreadSearchEventData>} forge-ai-chatbot-thread-search - Fired when search query changes in conversations panel (debounced, cancelable)
|
|
129
|
+
* @event {CustomEvent<ForgeAiChatbotThreadLoadMoreEventData>} forge-ai-chatbot-thread-load-more - Fired when scrolling near bottom in recent chats or search chats. Query field differentiates contexts.
|
|
130
|
+
* @event {CustomEvent<ForgeAiChatbotThreadRenameEventData>} forge-ai-chatbot-thread-rename - Fired when user renames a thread. Cancelable - if prevented, call onSuccess() to commit or onError() to revert.
|
|
131
|
+
* @event {CustomEvent<ForgeAiChatbotThreadDeleteEventData>} forge-ai-chatbot-thread-delete - Fired when user deletes a thread. Cancelable - if prevented, call onSuccess() to commit deletion or onError() to revert. Otherwise optimistically removed.
|
|
132
132
|
*/
|
|
133
133
|
export declare class AiChatbotComponent extends AiChatbotBase {
|
|
134
134
|
#private;
|
|
@@ -138,10 +138,10 @@ export declare class AiChatbotComponent extends AiChatbotBase {
|
|
|
138
138
|
expanded: boolean;
|
|
139
139
|
minimizeIcon: 'default' | 'panel';
|
|
140
140
|
showConversationsButton: boolean;
|
|
141
|
-
|
|
141
|
+
threads: Thread[];
|
|
142
142
|
conversationsOpen: boolean;
|
|
143
|
-
|
|
144
|
-
|
|
143
|
+
showThreadRename: boolean;
|
|
144
|
+
showThreadDelete: boolean;
|
|
145
145
|
selectedThreadId: string | null;
|
|
146
146
|
threadsLoading: boolean;
|
|
147
147
|
protected _messageThreadRef: Ref<AiMessageThreadComponent>;
|
|
@@ -166,4 +166,4 @@ export declare class AiChatbotComponent extends AiChatbotBase {
|
|
|
166
166
|
render(): TemplateResult;
|
|
167
167
|
}
|
|
168
168
|
export type { FeatureToggle } from './ai-chatbot-base.js';
|
|
169
|
-
export type { Thread,
|
|
169
|
+
export type { Thread, ForgeAiChatbotThreadSelectEventData, ForgeAiChatbotThreadSearchEventData, ForgeAiChatbotThreadLoadMoreEventData, ForgeAiChatbotThreadRenameEventData, ForgeAiChatbotThreadDeleteEventData } from './types.js';
|
|
@@ -3,6 +3,7 @@ import { property, customElement } from "lit/decorators.js";
|
|
|
3
3
|
import { createRef, ref } from "lit/directives/ref.js";
|
|
4
4
|
import { when } from "lit/directives/when.js";
|
|
5
5
|
import { AiChatbotBase } from "./ai-chatbot-base.mjs";
|
|
6
|
+
import { forwardCancelableEvent } from "../utils.mjs";
|
|
6
7
|
import "../ai-attachment/ai-attachment.mjs";
|
|
7
8
|
import "../ai-chat-header/ai-chat-header.mjs";
|
|
8
9
|
import "../ai-chat-interface/ai-chat-interface.mjs";
|
|
@@ -32,7 +33,7 @@ var __accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot
|
|
|
32
33
|
var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
|
|
33
34
|
var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
|
34
35
|
var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "access private method"), method);
|
|
35
|
-
var _chatInterfaceRef, _headerRef, _conversationsPanelRef, _conversationsDialogRef, _boundEscapeHandler, _AiChatbotComponent_instances, handleHeaderExpand_fn, handleHeaderMinimize_fn, handleHeaderClear_fn, handleHeaderInfo_fn, handleConversationsDialogClose_fn, handleEscapeKey_fn, handleBackdropClick_fn, handleConversationsToggle_fn, handleThreadSelect_fn, handleNewChat_fn, handlePanelClose_fn,
|
|
36
|
+
var _chatInterfaceRef, _headerRef, _conversationsPanelRef, _conversationsDialogRef, _boundEscapeHandler, _AiChatbotComponent_instances, handleHeaderExpand_fn, handleHeaderMinimize_fn, handleHeaderClear_fn, handleHeaderInfo_fn, handleConversationsDialogClose_fn, handleEscapeKey_fn, handleBackdropClick_fn, handleConversationsToggle_fn, handleThreadSelect_fn, handleNewChat_fn, handlePanelClose_fn, _handleThreadSearch, _handleThreadLoadMore, _handleThreadRename, _handleThreadDelete, promptSlot_get, messageThread_get;
|
|
36
37
|
const AiChatbotComponentTagName = "forge-ai-chatbot";
|
|
37
38
|
let AiChatbotComponent = class extends AiChatbotBase {
|
|
38
39
|
constructor() {
|
|
@@ -43,10 +44,10 @@ let AiChatbotComponent = class extends AiChatbotBase {
|
|
|
43
44
|
this.expanded = false;
|
|
44
45
|
this.minimizeIcon = "default";
|
|
45
46
|
this.showConversationsButton = false;
|
|
46
|
-
this.
|
|
47
|
+
this.threads = [];
|
|
47
48
|
this.conversationsOpen = false;
|
|
48
|
-
this.
|
|
49
|
-
this.
|
|
49
|
+
this.showThreadRename = false;
|
|
50
|
+
this.showThreadDelete = false;
|
|
50
51
|
this.selectedThreadId = null;
|
|
51
52
|
this.threadsLoading = false;
|
|
52
53
|
__privateAdd(this, _chatInterfaceRef, createRef());
|
|
@@ -56,51 +57,22 @@ let AiChatbotComponent = class extends AiChatbotBase {
|
|
|
56
57
|
__privateAdd(this, _conversationsPanelRef, createRef());
|
|
57
58
|
__privateAdd(this, _conversationsDialogRef, createRef());
|
|
58
59
|
__privateAdd(this, _boundEscapeHandler, __privateMethod(this, _AiChatbotComponent_instances, handleEscapeKey_fn).bind(this));
|
|
59
|
-
__privateAdd(this,
|
|
60
|
-
|
|
60
|
+
__privateAdd(this, _handleThreadSearch, (e) => {
|
|
61
|
+
forwardCancelableEvent(this, e, "forge-ai-chatbot-thread-search");
|
|
62
|
+
});
|
|
63
|
+
__privateAdd(this, _handleThreadLoadMore, (e) => {
|
|
64
|
+
const event = new CustomEvent("forge-ai-chatbot-thread-load-more", {
|
|
61
65
|
detail: e.detail,
|
|
62
66
|
bubbles: true,
|
|
63
|
-
composed: true
|
|
64
|
-
cancelable: true
|
|
67
|
+
composed: true
|
|
65
68
|
});
|
|
66
|
-
if (!this.dispatchEvent(event)) {
|
|
67
|
-
e.preventDefault();
|
|
68
|
-
}
|
|
69
|
-
});
|
|
70
|
-
__privateAdd(this, _handleConversationLoadMore, (e) => {
|
|
71
|
-
const event = new CustomEvent(
|
|
72
|
-
"forge-ai-chatbot-conversation-load-more",
|
|
73
|
-
{
|
|
74
|
-
detail: e.detail,
|
|
75
|
-
bubbles: true,
|
|
76
|
-
composed: true
|
|
77
|
-
}
|
|
78
|
-
);
|
|
79
69
|
this.dispatchEvent(event);
|
|
80
70
|
});
|
|
81
|
-
__privateAdd(this,
|
|
82
|
-
|
|
83
|
-
detail: e.detail,
|
|
84
|
-
bubbles: true,
|
|
85
|
-
composed: true,
|
|
86
|
-
cancelable: true
|
|
87
|
-
});
|
|
88
|
-
const dispatched = this.dispatchEvent(event);
|
|
89
|
-
if (!dispatched) {
|
|
90
|
-
e.preventDefault();
|
|
91
|
-
}
|
|
71
|
+
__privateAdd(this, _handleThreadRename, (e) => {
|
|
72
|
+
forwardCancelableEvent(this, e, "forge-ai-chatbot-thread-rename");
|
|
92
73
|
});
|
|
93
|
-
__privateAdd(this,
|
|
94
|
-
|
|
95
|
-
detail: e.detail,
|
|
96
|
-
bubbles: true,
|
|
97
|
-
composed: true,
|
|
98
|
-
cancelable: true
|
|
99
|
-
});
|
|
100
|
-
const dispatched = this.dispatchEvent(event);
|
|
101
|
-
if (!dispatched) {
|
|
102
|
-
e.preventDefault();
|
|
103
|
-
}
|
|
74
|
+
__privateAdd(this, _handleThreadDelete, (e) => {
|
|
75
|
+
forwardCancelableEvent(this, e, "forge-ai-chatbot-thread-delete");
|
|
104
76
|
});
|
|
105
77
|
}
|
|
106
78
|
_handleInfo() {
|
|
@@ -213,19 +185,19 @@ let AiChatbotComponent = class extends AiChatbotBase {
|
|
|
213
185
|
@close=${__privateMethod(this, _AiChatbotComponent_instances, handleConversationsDialogClose_fn)}>
|
|
214
186
|
<forge-ai-conversations-panel
|
|
215
187
|
${ref(__privateGet(this, _conversationsPanelRef))}
|
|
216
|
-
.
|
|
188
|
+
.threads=${this.threads}
|
|
217
189
|
.selectedThreadId=${this.selectedThreadId}
|
|
218
190
|
?loading=${this.threadsLoading}
|
|
219
191
|
?show-back-button=${true}
|
|
220
|
-
?show-
|
|
221
|
-
?show-
|
|
192
|
+
?show-thread-rename=${this.showThreadRename}
|
|
193
|
+
?show-thread-delete=${this.showThreadDelete}
|
|
222
194
|
@forge-ai-conversations-panel-select=${__privateMethod(this, _AiChatbotComponent_instances, handleThreadSelect_fn)}
|
|
223
195
|
@forge-ai-conversations-panel-new-chat=${__privateMethod(this, _AiChatbotComponent_instances, handleNewChat_fn)}
|
|
224
196
|
@forge-ai-conversations-panel-close=${__privateMethod(this, _AiChatbotComponent_instances, handlePanelClose_fn)}
|
|
225
|
-
@forge-ai-conversations-panel-search=${__privateGet(this,
|
|
226
|
-
@forge-ai-conversations-panel-load-more=${__privateGet(this,
|
|
227
|
-
@forge-ai-conversations-panel-rename=${__privateGet(this,
|
|
228
|
-
@forge-ai-conversations-panel-delete=${__privateGet(this,
|
|
197
|
+
@forge-ai-conversations-panel-search=${__privateGet(this, _handleThreadSearch)}
|
|
198
|
+
@forge-ai-conversations-panel-load-more=${__privateGet(this, _handleThreadLoadMore)}
|
|
199
|
+
@forge-ai-conversations-panel-rename=${__privateGet(this, _handleThreadRename)}
|
|
200
|
+
@forge-ai-conversations-panel-delete=${__privateGet(this, _handleThreadDelete)}>
|
|
229
201
|
</forge-ai-conversations-panel>
|
|
230
202
|
</dialog>
|
|
231
203
|
`
|
|
@@ -279,7 +251,7 @@ handleThreadSelect_fn = function(evt) {
|
|
|
279
251
|
const { id, title } = evt.detail;
|
|
280
252
|
this.selectedThreadId = id;
|
|
281
253
|
this._dispatchHostEvent({
|
|
282
|
-
type: "forge-ai-chatbot-
|
|
254
|
+
type: "forge-ai-chatbot-thread-select",
|
|
283
255
|
detail: { id, title }
|
|
284
256
|
});
|
|
285
257
|
this.hideConversations();
|
|
@@ -297,10 +269,10 @@ handleNewChat_fn = function(event) {
|
|
|
297
269
|
handlePanelClose_fn = function() {
|
|
298
270
|
this.hideConversations();
|
|
299
271
|
};
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
272
|
+
_handleThreadSearch = /* @__PURE__ */ new WeakMap();
|
|
273
|
+
_handleThreadLoadMore = /* @__PURE__ */ new WeakMap();
|
|
274
|
+
_handleThreadRename = /* @__PURE__ */ new WeakMap();
|
|
275
|
+
_handleThreadDelete = /* @__PURE__ */ new WeakMap();
|
|
304
276
|
promptSlot_get = function() {
|
|
305
277
|
const isUploading = this._isUploading;
|
|
306
278
|
return html`
|
|
@@ -392,16 +364,16 @@ __decorateClass([
|
|
|
392
364
|
], AiChatbotComponent.prototype, "showConversationsButton", 2);
|
|
393
365
|
__decorateClass([
|
|
394
366
|
property({ type: Array, attribute: false })
|
|
395
|
-
], AiChatbotComponent.prototype, "
|
|
367
|
+
], AiChatbotComponent.prototype, "threads", 2);
|
|
396
368
|
__decorateClass([
|
|
397
369
|
property({ type: Boolean, attribute: "conversations-open", reflect: true })
|
|
398
370
|
], AiChatbotComponent.prototype, "conversationsOpen", 2);
|
|
399
371
|
__decorateClass([
|
|
400
|
-
property({ type: Boolean, attribute: "show-
|
|
401
|
-
], AiChatbotComponent.prototype, "
|
|
372
|
+
property({ type: Boolean, attribute: "show-thread-rename" })
|
|
373
|
+
], AiChatbotComponent.prototype, "showThreadRename", 2);
|
|
402
374
|
__decorateClass([
|
|
403
|
-
property({ type: Boolean, attribute: "show-
|
|
404
|
-
], AiChatbotComponent.prototype, "
|
|
375
|
+
property({ type: Boolean, attribute: "show-thread-delete" })
|
|
376
|
+
], AiChatbotComponent.prototype, "showThreadDelete", 2);
|
|
405
377
|
__decorateClass([
|
|
406
378
|
property({ type: String, attribute: "selected-thread-id" })
|
|
407
379
|
], AiChatbotComponent.prototype, "selectedThreadId", 2);
|
|
@@ -4,7 +4,7 @@ export type { ForgeAiChatbotMessageEventData, ForgeAiChatbotToolCallEventData, F
|
|
|
4
4
|
export { AiChatbotToolCallComponent, AiChatbotToolCallComponentTagName } from './ai-chatbot-tool-call.js';
|
|
5
5
|
export type { Suggestion } from '../ai-suggestions/index.js';
|
|
6
6
|
export { AgentAdapter, type MessageStartEvent, type MessageDeltaEvent, type MessageEndEvent, type ToolCallEvent, type ToolCallStartEvent, type ToolCallArgsEvent, type ToolCallEndEvent, type FileUploadEvent, type FileRemoveEvent, type AdapterState, type ErrorEvent, type CustomAgentEvent, type RawAgentEvent, type RunStartedAgentEvent, type StepStartedAgentEvent, type StepFinishedAgentEvent, type StateSnapshotAgentEvent, type StateDeltaAgentEvent, type ActivitySnapshotAgentEvent, type ActivityDeltaAgentEvent } from './agent-adapter.js';
|
|
7
|
-
export type { Agent, ChatMessage, ClientMessageAction, ClientMessageInput, ClientMessageKind, ContextItem, ToolDefinition, ToolCall, ToolRenderer, IToolRenderer, HandlerContext, ToolStartContext, ToolDeltaContext, ToolEndContext, FileAttachment, UploadedFileMetadata, FileUploadCallbacks, FileUploadHandler, FileRemoveCallbacks, ThreadState, FeedbackType, ResponseFeedback, MessageItem, ForgeAiChatbotContextRemoveEventData,
|
|
7
|
+
export type { Agent, ChatMessage, ClientMessageAction, ClientMessageInput, ClientMessageKind, ContextItem, ToolDefinition, ToolCall, ToolRenderer, IToolRenderer, HandlerContext, ToolStartContext, ToolDeltaContext, ToolEndContext, FileAttachment, UploadedFileMetadata, FileUploadCallbacks, FileUploadHandler, FileRemoveCallbacks, ThreadState, FeedbackType, ResponseFeedback, MessageItem, ForgeAiChatbotContextRemoveEventData, ForgeAiChatbotThreadSelectEventData, ForgeAiChatbotThreadSearchEventData, ForgeAiChatbotThreadLoadMoreEventData, ForgeAiChatbotThreadRenameEventData, ForgeAiChatbotThreadDeleteEventData } from './types.js';
|
|
8
8
|
export * from './ag-ui-adapter.js';
|
|
9
9
|
export * from './http-agent-with-credentials.js';
|
|
10
10
|
export * from './event-emitter.js';
|
|
@@ -305,26 +305,26 @@ export interface ThreadState {
|
|
|
305
305
|
timestamp?: number;
|
|
306
306
|
selectedAgentId?: string;
|
|
307
307
|
}
|
|
308
|
-
export interface
|
|
308
|
+
export interface ForgeAiChatbotThreadSelectEventData {
|
|
309
309
|
id: string;
|
|
310
310
|
title: string;
|
|
311
311
|
}
|
|
312
|
-
export interface
|
|
312
|
+
export interface ForgeAiChatbotThreadSearchEventData {
|
|
313
313
|
query: string;
|
|
314
314
|
setResults: (results: Thread[]) => void;
|
|
315
315
|
}
|
|
316
|
-
export interface
|
|
316
|
+
export interface ForgeAiChatbotThreadLoadMoreEventData {
|
|
317
317
|
query: string;
|
|
318
318
|
appendResults: (results: Thread[]) => void;
|
|
319
319
|
}
|
|
320
|
-
export interface
|
|
320
|
+
export interface ForgeAiChatbotThreadRenameEventData {
|
|
321
321
|
id: string;
|
|
322
322
|
oldTitle: string;
|
|
323
323
|
newTitle: string;
|
|
324
324
|
onSuccess: () => void;
|
|
325
325
|
onError: (error?: string) => void;
|
|
326
326
|
}
|
|
327
|
-
export interface
|
|
327
|
+
export interface ForgeAiChatbotThreadDeleteEventData {
|
|
328
328
|
id: string;
|
|
329
329
|
thread: Thread;
|
|
330
330
|
onSuccess: () => void;
|
|
@@ -6,7 +6,7 @@ import { AiChatbotBase } from '../ai-chatbot/ai-chatbot-base.js';
|
|
|
6
6
|
import { ChatMessage, ThreadState } from '../ai-chatbot/types.js';
|
|
7
7
|
import { Thread } from '../ai-threads/ai-threads';
|
|
8
8
|
import { Ref } from 'lit/directives/ref.js';
|
|
9
|
-
export type LauncherViewState = 'welcome' | 'conversation';
|
|
9
|
+
export type LauncherViewState = 'welcome' | 'conversation' | 'history';
|
|
10
10
|
export interface ForgeAiChatbotLauncherThreadRenameEventData {
|
|
11
11
|
id: string;
|
|
12
12
|
oldTitle: string;
|
|
@@ -20,14 +20,32 @@ export interface ForgeAiChatbotLauncherThreadDeleteEventData {
|
|
|
20
20
|
onSuccess: () => void;
|
|
21
21
|
onError: (error?: string) => void;
|
|
22
22
|
}
|
|
23
|
+
export interface ForgeAiChatbotLauncherThreadSelectEventData {
|
|
24
|
+
id: string;
|
|
25
|
+
title: string;
|
|
26
|
+
}
|
|
27
|
+
export interface ForgeAiChatbotLauncherThreadSearchEventData {
|
|
28
|
+
query: string;
|
|
29
|
+
setResults: (results: Thread[]) => void;
|
|
30
|
+
}
|
|
31
|
+
export interface ForgeAiChatbotLauncherThreadLoadMoreEventData {
|
|
32
|
+
query: string;
|
|
33
|
+
appendResults: (results: Thread[]) => void;
|
|
34
|
+
}
|
|
23
35
|
declare global {
|
|
24
36
|
interface HTMLElementTagNameMap {
|
|
25
37
|
'forge-ai-chatbot-launcher': AiChatbotLauncherComponent;
|
|
26
38
|
}
|
|
27
39
|
interface HTMLElementEventMap {
|
|
28
40
|
'forge-ai-chatbot-launcher-conversation-start': CustomEvent<void>;
|
|
41
|
+
'forge-ai-chatbot-launcher-history-open': CustomEvent<void>;
|
|
42
|
+
'forge-ai-chatbot-launcher-history-close': CustomEvent<void>;
|
|
29
43
|
'forge-ai-chatbot-launcher-thread-rename': CustomEvent<ForgeAiChatbotLauncherThreadRenameEventData>;
|
|
30
44
|
'forge-ai-chatbot-launcher-thread-delete': CustomEvent<ForgeAiChatbotLauncherThreadDeleteEventData>;
|
|
45
|
+
'forge-ai-chatbot-launcher-thread-select': CustomEvent<ForgeAiChatbotLauncherThreadSelectEventData>;
|
|
46
|
+
'forge-ai-chatbot-launcher-thread-search': CustomEvent<ForgeAiChatbotLauncherThreadSearchEventData>;
|
|
47
|
+
'forge-ai-chatbot-launcher-thread-load-more': CustomEvent<ForgeAiChatbotLauncherThreadLoadMoreEventData>;
|
|
48
|
+
'forge-ai-chatbot-launcher-new-chat': CustomEvent<void>;
|
|
31
49
|
}
|
|
32
50
|
}
|
|
33
51
|
export declare const AiChatbotLauncherComponentTagName: keyof HTMLElementTagNameMap;
|
|
@@ -56,6 +74,10 @@ export declare const AiChatbotLauncherComponentTagName: keyof HTMLElementTagName
|
|
|
56
74
|
* @property {string} threadName - The name of the current thread (shown in conversation view breadcrumb)
|
|
57
75
|
* @property {boolean} showThreadRename - Whether to show the rename option in thread actions menu
|
|
58
76
|
* @property {boolean} showThreadDelete - Whether to show the delete option in thread actions menu
|
|
77
|
+
* @property {Thread[]} threads - The list of chats shown in the history popover and full history view
|
|
78
|
+
* @property {number} totalThreads - Total number of chats available. When greater than the number of loaded threads, infinite scroll is enabled (0 disables it)
|
|
79
|
+
* @property {boolean} threadsLoading - Whether chats are currently loading, used to gate the history button and its disabled state
|
|
80
|
+
* @property {string | null} selectedThreadId - The id of the currently selected thread, highlighted in the history popover/view. Updated internally when a thread is selected or a new chat starts.
|
|
59
81
|
*
|
|
60
82
|
* @cssproperty --forge-ai-chatbot-launcher-icon-color - The fill color for the AI icon.
|
|
61
83
|
*
|
|
@@ -65,11 +87,17 @@ export declare const AiChatbotLauncherComponentTagName: keyof HTMLElementTagName
|
|
|
65
87
|
* @event {CustomEvent<ForgeAiChatbotToolCallEventData>} forge-ai-chatbot-tool-call - Fired when a tool needs to be executed
|
|
66
88
|
* @event {CustomEvent<ForgeAiChatbotErrorEventData>} forge-ai-chatbot-error - Fired when an error occurs
|
|
67
89
|
* @event {CustomEvent<void>} forge-ai-chatbot-launcher-conversation-start - Fired when transitioning from welcome to conversation view
|
|
90
|
+
* @event {CustomEvent<void>} forge-ai-chatbot-launcher-history-open - Fired when transitioning to the full-height history view
|
|
91
|
+
* @event {CustomEvent<void>} forge-ai-chatbot-launcher-history-close - Fired when leaving the full-height history view
|
|
68
92
|
* @event {CustomEvent<ForgeAiChatbotResponseFeedbackEventData>} forge-ai-chatbot-response-feedback - Fired when user provides feedback on a response
|
|
69
93
|
* @event {CustomEvent<void>} forge-ai-chatbot-info - Fired when header info option is selected
|
|
70
94
|
* @event {CustomEvent<ForgeAiChatbotAgentChangeEventData>} forge-ai-chatbot-agent-change - Fired when agent selection changes
|
|
71
95
|
* @event {CustomEvent<ForgeAiChatbotLauncherThreadRenameEventData>} forge-ai-chatbot-launcher-thread-rename - Fired when thread rename is saved. Parent should update threadName property and call onSuccess() or onError()
|
|
72
96
|
* @event {CustomEvent<ForgeAiChatbotLauncherThreadDeleteEventData>} forge-ai-chatbot-launcher-thread-delete - Fired when thread deletion is confirmed. Parent should delete thread and call onSuccess() or onError()
|
|
97
|
+
* @event {CustomEvent<ForgeAiChatbotLauncherThreadSelectEventData>} forge-ai-chatbot-launcher-thread-select - Fired when a thread is selected from the history popover or full history view
|
|
98
|
+
* @event {CustomEvent<ForgeAiChatbotLauncherThreadSearchEventData>} forge-ai-chatbot-launcher-thread-search - Fired when the history search query changes (debounced). Cancelable - call setResults() with the results
|
|
99
|
+
* @event {CustomEvent<ForgeAiChatbotLauncherThreadLoadMoreEventData>} forge-ai-chatbot-launcher-thread-load-more - Fired when scrolling near the bottom of the history list for pagination. Call appendResults() with the next page (empty array signals no more results)
|
|
100
|
+
* @event {CustomEvent<void>} forge-ai-chatbot-launcher-new-chat - Fired when "New chat" is clicked from the full history view. Cancelable - prevents startNewChat() from being called
|
|
73
101
|
*/
|
|
74
102
|
export declare class AiChatbotLauncherComponent extends AiChatbotBase {
|
|
75
103
|
#private;
|
|
@@ -79,14 +107,23 @@ export declare class AiChatbotLauncherComponent extends AiChatbotBase {
|
|
|
79
107
|
threadName?: string;
|
|
80
108
|
showThreadRename: boolean;
|
|
81
109
|
showThreadDelete: boolean;
|
|
110
|
+
threads: Thread[];
|
|
111
|
+
totalThreads: number;
|
|
112
|
+
threadsLoading: boolean;
|
|
113
|
+
selectedThreadId: string | null;
|
|
82
114
|
private _viewState;
|
|
83
115
|
private _skipAnimation;
|
|
84
116
|
private _editingThreadId;
|
|
117
|
+
private _historyPopoverOpen;
|
|
85
118
|
protected _messageThreadRef: Ref<AiMessageThreadComponent>;
|
|
86
119
|
protected _promptRef: Ref<AiPromptComponent>;
|
|
87
120
|
constructor();
|
|
88
121
|
protected _onConnected(): void;
|
|
89
122
|
startConversation(): void;
|
|
123
|
+
/**
|
|
124
|
+
* Navigates directly to the full history view (not the history popover).
|
|
125
|
+
*/
|
|
126
|
+
showHistory(): void;
|
|
90
127
|
protected _handleInfo(): void;
|
|
91
128
|
protected _handleSend(evt: CustomEvent<ForgeAiPromptSendEventData>): Promise<void>;
|
|
92
129
|
protected _handleSuggestionSelect(evt: CustomEvent<ForgeAiSuggestionsEventData>): Promise<void>;
|