@genesislcap/ai-assistant 14.403.0-ai-assistant.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/api-extractor.json +4 -0
- package/dist/ai-assistant.api.json +4028 -0
- package/dist/ai-assistant.d.ts +396 -0
- package/dist/dts/channel/ai-activity-channel.d.ts +32 -0
- package/dist/dts/channel/ai-activity-channel.d.ts.map +1 -0
- package/dist/dts/components/activity-halo/activity-halo.d.ts +31 -0
- package/dist/dts/components/activity-halo/activity-halo.d.ts.map +1 -0
- package/dist/dts/components/chat-bubble/chat-bubble.d.ts +52 -0
- package/dist/dts/components/chat-bubble/chat-bubble.d.ts.map +1 -0
- package/dist/dts/components/chat-bubble/chat-bubble.styles.d.ts +2 -0
- package/dist/dts/components/chat-bubble/chat-bubble.styles.d.ts.map +1 -0
- package/dist/dts/components/chat-bubble/chat-bubble.template.d.ts +4 -0
- package/dist/dts/components/chat-bubble/chat-bubble.template.d.ts.map +1 -0
- package/dist/dts/components/chat-bubble/index.d.ts +2 -0
- package/dist/dts/components/chat-bubble/index.d.ts.map +1 -0
- package/dist/dts/components/chat-driver/chat-driver.d.ts +49 -0
- package/dist/dts/components/chat-driver/chat-driver.d.ts.map +1 -0
- package/dist/dts/components/chat-driver/index.d.ts +2 -0
- package/dist/dts/components/chat-driver/index.d.ts.map +1 -0
- package/dist/dts/components/chat-interaction-wrapper/chat-interaction-wrapper.d.ts +19 -0
- package/dist/dts/components/chat-interaction-wrapper/chat-interaction-wrapper.d.ts.map +1 -0
- package/dist/dts/components/chat-interaction-wrapper/chat-interaction-wrapper.styles.d.ts +2 -0
- package/dist/dts/components/chat-interaction-wrapper/chat-interaction-wrapper.styles.d.ts.map +1 -0
- package/dist/dts/components/chat-interaction-wrapper/chat-interaction-wrapper.template.d.ts +3 -0
- package/dist/dts/components/chat-interaction-wrapper/chat-interaction-wrapper.template.d.ts.map +1 -0
- package/dist/dts/components/chat-interaction-wrapper/index.d.ts +4 -0
- package/dist/dts/components/chat-interaction-wrapper/index.d.ts.map +1 -0
- package/dist/dts/components/chat-markdown/chat-markdown.d.ts +6 -0
- package/dist/dts/components/chat-markdown/chat-markdown.d.ts.map +1 -0
- package/dist/dts/components/chat-markdown/index.d.ts +2 -0
- package/dist/dts/components/chat-markdown/index.d.ts.map +1 -0
- package/dist/dts/components/halo-overlay.d.ts +25 -0
- package/dist/dts/components/halo-overlay.d.ts.map +1 -0
- package/dist/dts/config/config.d.ts +51 -0
- package/dist/dts/config/config.d.ts.map +1 -0
- package/dist/dts/config/configure.d.ts +1 -0
- package/dist/dts/config/configure.d.ts.map +1 -0
- package/dist/dts/config/index.d.ts +2 -0
- package/dist/dts/config/index.d.ts.map +1 -0
- package/dist/dts/index.d.ts +10 -0
- package/dist/dts/index.d.ts.map +1 -0
- package/dist/dts/main/index.d.ts +5 -0
- package/dist/dts/main/index.d.ts.map +1 -0
- package/dist/dts/main/main.d.ts +103 -0
- package/dist/dts/main/main.d.ts.map +1 -0
- package/dist/dts/main/main.styles.d.ts +2 -0
- package/dist/dts/main/main.styles.d.ts.map +1 -0
- package/dist/dts/main/main.template.d.ts +4 -0
- package/dist/dts/main/main.template.d.ts.map +1 -0
- package/dist/dts/main/main.types.d.ts +54 -0
- package/dist/dts/main/main.types.d.ts.map +1 -0
- package/dist/dts/styles/index.d.ts +2 -0
- package/dist/dts/styles/index.d.ts.map +1 -0
- package/dist/dts/styles/styles.d.ts +5 -0
- package/dist/dts/styles/styles.d.ts.map +1 -0
- package/dist/dts/tags/index.d.ts +1 -0
- package/dist/dts/tags/index.d.ts.map +1 -0
- package/dist/dts/types/ai-chat-widget.d.ts +12 -0
- package/dist/dts/types/ai-chat-widget.d.ts.map +1 -0
- package/dist/dts/utils/index.d.ts +2 -0
- package/dist/dts/utils/index.d.ts.map +1 -0
- package/dist/dts/utils/logger.d.ts +2 -0
- package/dist/dts/utils/logger.d.ts.map +1 -0
- package/dist/esm/channel/ai-activity-channel.js +2 -0
- package/dist/esm/components/activity-halo/activity-halo.js +119 -0
- package/dist/esm/components/chat-bubble/chat-bubble.js +381 -0
- package/dist/esm/components/chat-bubble/chat-bubble.styles.js +193 -0
- package/dist/esm/components/chat-bubble/chat-bubble.template.js +50 -0
- package/dist/esm/components/chat-bubble/index.js +1 -0
- package/dist/esm/components/chat-driver/chat-driver.js +209 -0
- package/dist/esm/components/chat-driver/index.js +1 -0
- package/dist/esm/components/chat-interaction-wrapper/chat-interaction-wrapper.js +90 -0
- package/dist/esm/components/chat-interaction-wrapper/chat-interaction-wrapper.styles.js +6 -0
- package/dist/esm/components/chat-interaction-wrapper/chat-interaction-wrapper.template.js +4 -0
- package/dist/esm/components/chat-interaction-wrapper/index.js +3 -0
- package/dist/esm/components/chat-markdown/chat-markdown.js +95 -0
- package/dist/esm/components/chat-markdown/index.js +1 -0
- package/dist/esm/components/halo-overlay.js +118 -0
- package/dist/esm/config/config.js +16 -0
- package/dist/esm/config/configure.js +0 -0
- package/dist/esm/config/index.js +1 -0
- package/dist/esm/index.js +8 -0
- package/dist/esm/main/index.js +4 -0
- package/dist/esm/main/main.js +491 -0
- package/dist/esm/main/main.styles.js +356 -0
- package/dist/esm/main/main.template.js +272 -0
- package/dist/esm/main/main.types.js +22 -0
- package/dist/esm/styles/index.js +1 -0
- package/dist/esm/styles/styles.js +237 -0
- package/dist/esm/tags/index.js +0 -0
- package/dist/esm/types/ai-chat-widget.js +1 -0
- package/dist/esm/utils/index.js +1 -0
- package/dist/esm/utils/logger.js +2 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/dist/tsdoc-metadata.json +11 -0
- package/docs/.gitattributes +2 -0
- package/docs/api/ai-assistant.ai_activity_channel_name.md +11 -0
- package/docs/api/ai-assistant.aiactivityevents.md +24 -0
- package/docs/api/ai-assistant.aiactivityhalo.channelname.md +16 -0
- package/docs/api/ai-assistant.aiactivityhalo.connectedcallback.md +18 -0
- package/docs/api/ai-assistant.aiactivityhalo.disconnectedcallback.md +18 -0
- package/docs/api/ai-assistant.aiactivityhalo.haloactive.md +14 -0
- package/docs/api/ai-assistant.aiactivityhalo.md +176 -0
- package/docs/api/ai-assistant.aiactivityhalo.minshowtime.md +16 -0
- package/docs/api/ai-assistant.aiactivityhalo.tools.md +16 -0
- package/docs/api/ai-assistant.aiassistantanimation.md +18 -0
- package/docs/api/ai-assistant.aiassistantanimationdef.label.md +16 -0
- package/docs/api/ai-assistant.aiassistantanimationdef.md +80 -0
- package/docs/api/ai-assistant.aiassistantanimationdef.tooltip.md +16 -0
- package/docs/api/ai-assistant.aiassistantconfig.chatconfig.md +16 -0
- package/docs/api/ai-assistant.aiassistantconfig.debugstatefactory.md +16 -0
- package/docs/api/ai-assistant.aiassistantconfig.headertitle.md +16 -0
- package/docs/api/ai-assistant.aiassistantconfig.md +157 -0
- package/docs/api/ai-assistant.aiassistantconfig.systemprompt.md +16 -0
- package/docs/api/ai-assistant.aiassistantconfig.tooldefinitions.md +16 -0
- package/docs/api/ai-assistant.aiassistantconfig.toolhandlers.md +16 -0
- package/docs/api/ai-assistant.aiassistantserializedstate.enabledanimations.md +14 -0
- package/docs/api/ai-assistant.aiassistantserializedstate.md +118 -0
- package/docs/api/ai-assistant.aiassistantserializedstate.messages.md +14 -0
- package/docs/api/ai-assistant.aiassistantserializedstate.showthinkingsteps.md +14 -0
- package/docs/api/ai-assistant.aiassistantserializedstate.showtoolcalls.md +14 -0
- package/docs/api/ai-assistant.aiassistantstate.md +16 -0
- package/docs/api/ai-assistant.aichatbubble.bubbleleft.md +11 -0
- package/docs/api/ai-assistant.aichatbubble.bubbletop.md +11 -0
- package/docs/api/ai-assistant.aichatbubble.channelname.md +11 -0
- package/docs/api/ai-assistant.aichatbubble.connectedcallback.md +15 -0
- package/docs/api/ai-assistant.aichatbubble.designsystemprefix.md +11 -0
- package/docs/api/ai-assistant.aichatbubble.dialogcontent.md +11 -0
- package/docs/api/ai-assistant.aichatbubble.dialogcontentchanged.md +64 -0
- package/docs/api/ai-assistant.aichatbubble.dialogheight.md +11 -0
- package/docs/api/ai-assistant.aichatbubble.dialogleft.md +11 -0
- package/docs/api/ai-assistant.aichatbubble.dialogopen.md +11 -0
- package/docs/api/ai-assistant.aichatbubble.dialogopenchanged.md +64 -0
- package/docs/api/ai-assistant.aichatbubble.dialogtop.md +11 -0
- package/docs/api/ai-assistant.aichatbubble.dialogwidth.md +11 -0
- package/docs/api/ai-assistant.aichatbubble.disconnectedcallback.md +15 -0
- package/docs/api/ai-assistant.aichatbubble.hovered.md +11 -0
- package/docs/api/ai-assistant.aichatbubble.imagesrc.md +11 -0
- package/docs/api/ai-assistant.aichatbubble.md +396 -0
- package/docs/api/ai-assistant.aichatbubble.onbubblemousedown.md +50 -0
- package/docs/api/ai-assistant.aichatbubble.onclosedialog.md +15 -0
- package/docs/api/ai-assistant.aichatbubble.ondialogheadermousedown.md +53 -0
- package/docs/api/ai-assistant.aichatbubble.onpopout.md +15 -0
- package/docs/api/ai-assistant.aichatbubble.title.md +11 -0
- package/docs/api/ai-assistant.aichatbubble.tooltipstyle.md +11 -0
- package/docs/api/ai-assistant.aichatwidget.data.md +14 -0
- package/docs/api/ai-assistant.aichatwidget.md +80 -0
- package/docs/api/ai-assistant.aichatwidget.resolved.md +16 -0
- package/docs/api/ai-assistant.animation_defs.md +25 -0
- package/docs/api/ai-assistant.chatdriver._constructor_.md +99 -0
- package/docs/api/ai-assistant.chatdriver.gethistory.md +18 -0
- package/docs/api/ai-assistant.chatdriver.isbusy.md +18 -0
- package/docs/api/ai-assistant.chatdriver.loadhistory.md +55 -0
- package/docs/api/ai-assistant.chatdriver.md +158 -0
- package/docs/api/ai-assistant.chatdriver.requestinteraction.md +73 -0
- package/docs/api/ai-assistant.chatdriver.resolveinteraction.md +69 -0
- package/docs/api/ai-assistant.chatdriver.sendmessage.md +69 -0
- package/docs/api/ai-assistant.chathistoryupdatedevent.md +16 -0
- package/docs/api/ai-assistant.defaultaiassistantconfig.md +16 -0
- package/docs/api/ai-assistant.foundationaiassistant.aiprovider.md +14 -0
- package/docs/api/ai-assistant.foundationaiassistant.applystate.md +55 -0
- package/docs/api/ai-assistant.foundationaiassistant.attachmenterrors.md +14 -0
- package/docs/api/ai-assistant.foundationaiassistant.attachments.md +14 -0
- package/docs/api/ai-assistant.foundationaiassistant.channelname.md +14 -0
- package/docs/api/ai-assistant.foundationaiassistant.chatconfig.md +14 -0
- package/docs/api/ai-assistant.foundationaiassistant.connectedcallback.md +18 -0
- package/docs/api/ai-assistant.foundationaiassistant.debugstatefactory.md +14 -0
- package/docs/api/ai-assistant.foundationaiassistant.designsystemprefix.md +14 -0
- package/docs/api/ai-assistant.foundationaiassistant.disconnectedcallback.md +18 -0
- package/docs/api/ai-assistant.foundationaiassistant.downloadhistory.md +18 -0
- package/docs/api/ai-assistant.foundationaiassistant.enabledanimations.md +16 -0
- package/docs/api/ai-assistant.foundationaiassistant.handlefileselect.md +53 -0
- package/docs/api/ai-assistant.foundationaiassistant.handleinteractioncompleted.md +53 -0
- package/docs/api/ai-assistant.foundationaiassistant.handlepopout.md +20 -0
- package/docs/api/ai-assistant.foundationaiassistant.handlesendclick.md +18 -0
- package/docs/api/ai-assistant.foundationaiassistant.hasactivependinginteraction.md +16 -0
- package/docs/api/ai-assistant.foundationaiassistant.headertitle.md +14 -0
- package/docs/api/ai-assistant.foundationaiassistant.imagesrc.md +14 -0
- package/docs/api/ai-assistant.foundationaiassistant.inputvalue.md +14 -0
- package/docs/api/ai-assistant.foundationaiassistant.md +826 -0
- package/docs/api/ai-assistant.foundationaiassistant.messages.md +14 -0
- package/docs/api/ai-assistant.foundationaiassistant.messageschanged.md +18 -0
- package/docs/api/ai-assistant.foundationaiassistant.onchatheadermousedown.md +53 -0
- package/docs/api/ai-assistant.foundationaiassistant.placeholder.md +14 -0
- package/docs/api/ai-assistant.foundationaiassistant.popoutmode.md +16 -0
- package/docs/api/ai-assistant.foundationaiassistant.removeattachment.md +53 -0
- package/docs/api/ai-assistant.foundationaiassistant.removeattachmenterror.md +53 -0
- package/docs/api/ai-assistant.foundationaiassistant.setenabledanimations.md +53 -0
- package/docs/api/ai-assistant.foundationaiassistant.settingsopen.md +16 -0
- package/docs/api/ai-assistant.foundationaiassistant.showhalo.md +16 -0
- package/docs/api/ai-assistant.foundationaiassistant.showhalochanged.md +18 -0
- package/docs/api/ai-assistant.foundationaiassistant.showloadingindicator.md +16 -0
- package/docs/api/ai-assistant.foundationaiassistant.showloadingindicatorchanged.md +18 -0
- package/docs/api/ai-assistant.foundationaiassistant.showthinkingsteps.md +16 -0
- package/docs/api/ai-assistant.foundationaiassistant.showtoolcalls.md +16 -0
- package/docs/api/ai-assistant.foundationaiassistant.state.md +14 -0
- package/docs/api/ai-assistant.foundationaiassistant.statechanged.md +18 -0
- package/docs/api/ai-assistant.foundationaiassistant.systemprompt.md +14 -0
- package/docs/api/ai-assistant.foundationaiassistant.togglesettings.md +18 -0
- package/docs/api/ai-assistant.foundationaiassistant.toggleshowthinkingsteps.md +18 -0
- package/docs/api/ai-assistant.foundationaiassistant.toggleshowtoolcalls.md +18 -0
- package/docs/api/ai-assistant.foundationaiassistant.tooldefinitions.md +14 -0
- package/docs/api/ai-assistant.foundationaiassistant.toolhandlers.md +14 -0
- package/docs/api/ai-assistant.foundationaiassistant.triggerfileinput.md +18 -0
- package/docs/api/ai-assistant.foundationaiassistant.visiblemessages.md +16 -0
- package/docs/api/ai-assistant.foundationaiassistanttemplate.md +50 -0
- package/docs/api/ai-assistant.md +262 -0
- package/docs/api/ai-assistant.popoutmode.md +16 -0
- package/docs/api/index.md +30 -0
- package/docs/api-report.md.api.md +280 -0
- package/license.txt +46 -0
- package/package.json +92 -0
- package/src/channel/ai-activity-channel.ts +30 -0
- package/src/components/activity-halo/activity-halo.ts +113 -0
- package/src/components/chat-bubble/chat-bubble.styles.ts +194 -0
- package/src/components/chat-bubble/chat-bubble.template.ts +63 -0
- package/src/components/chat-bubble/chat-bubble.ts +389 -0
- package/src/components/chat-bubble/index.ts +1 -0
- package/src/components/chat-driver/chat-driver.ts +254 -0
- package/src/components/chat-driver/index.ts +1 -0
- package/src/components/chat-interaction-wrapper/chat-interaction-wrapper.styles.ts +7 -0
- package/src/components/chat-interaction-wrapper/chat-interaction-wrapper.template.ts +6 -0
- package/src/components/chat-interaction-wrapper/chat-interaction-wrapper.ts +89 -0
- package/src/components/chat-interaction-wrapper/index.ts +3 -0
- package/src/components/chat-markdown/chat-markdown.ts +87 -0
- package/src/components/chat-markdown/index.ts +1 -0
- package/src/components/halo-overlay.ts +115 -0
- package/src/config/config.ts +59 -0
- package/src/config/configure.ts +0 -0
- package/src/config/index.ts +1 -0
- package/src/index.ts +9 -0
- package/src/main/index.ts +4 -0
- package/src/main/main.styles.ts +357 -0
- package/src/main/main.template.ts +364 -0
- package/src/main/main.ts +474 -0
- package/src/main/main.types.ts +58 -0
- package/src/styles/index.ts +1 -0
- package/src/styles/styles.ts +238 -0
- package/src/tags/index.ts +0 -0
- package/src/types/ai-chat-widget.ts +11 -0
- package/src/utils/index.ts +1 -0
- package/src/utils/logger.ts +3 -0
- package/temp/api-report.md.api.md +280 -0
- package/tsconfig.json +11 -0
|
@@ -0,0 +1,364 @@
|
|
|
1
|
+
import type { ChatAttachment, ChatMessage, ChatToolCall } from '@genesislcap/foundation-ai';
|
|
2
|
+
import { html, repeat, when, ViewTemplate } from '@genesislcap/web-core';
|
|
3
|
+
import type { FoundationAiAssistant } from './main';
|
|
4
|
+
import { ANIMATION_DEFS } from './main.types';
|
|
5
|
+
|
|
6
|
+
const animationItemRenderer = (option: any): ViewTemplate => html`
|
|
7
|
+
<span part="option-label" title="${() => option.tooltip}">${() => option.label}</span>
|
|
8
|
+
`;
|
|
9
|
+
|
|
10
|
+
const animationOptions = Object.entries(ANIMATION_DEFS).map(([value, def]) => ({
|
|
11
|
+
value,
|
|
12
|
+
label: def.label,
|
|
13
|
+
tooltip: def.tooltip,
|
|
14
|
+
}));
|
|
15
|
+
|
|
16
|
+
// Genesis G-mark icon bundled as inline SVG — no runtime asset dependency.
|
|
17
|
+
// Clients can override the avatar entirely via the `image-src` attribute.
|
|
18
|
+
const genesisIconTemplate = html`
|
|
19
|
+
<svg
|
|
20
|
+
viewBox="-4 0 30 26"
|
|
21
|
+
fill="none"
|
|
22
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
23
|
+
style="width:60%;height:60%"
|
|
24
|
+
>
|
|
25
|
+
<path
|
|
26
|
+
d="M18.7702 23.0437C18.7702 22.4675 18.8526 21.8089 19.0995 21.3149C19.3465 20.7386 19.6758 20.2447 20.0874 19.833C20.4991 19.4214 20.993 19.0921 21.5693 18.8451C22.1456 18.5982 22.7219 18.5158 23.2981 18.5158H25.9326V11.6828H19.1819V14.3172C19.1819 15.5521 18.6879 16.7047 17.8647 17.5279C17.0414 18.3512 15.8888 18.8451 14.7363 18.9275H6.7507V6.99025H16.4651V0.157227H3.54C2.63442 0.157227 1.72884 0.568855 1.07023 1.22746C0.411628 1.88606 0 2.79165 0 3.77955V22.2205C0 23.1261 0.411628 24.0316 1.07023 24.7726C1.72884 25.4312 2.63442 25.8428 3.54 25.8428H18.7702V23.0437Z"
|
|
27
|
+
fill="currentColor"
|
|
28
|
+
/>
|
|
29
|
+
</svg>
|
|
30
|
+
`;
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* @beta
|
|
34
|
+
*/
|
|
35
|
+
const messageType = (m: ChatMessage): string =>
|
|
36
|
+
m.role === 'user'
|
|
37
|
+
? 'user'
|
|
38
|
+
: m.thinking
|
|
39
|
+
? 'ai-thinking'
|
|
40
|
+
: m.toolCalls
|
|
41
|
+
? 'ai-function'
|
|
42
|
+
: m.interaction
|
|
43
|
+
? 'interaction'
|
|
44
|
+
: 'ai';
|
|
45
|
+
|
|
46
|
+
export const FoundationAiAssistantTemplate = (
|
|
47
|
+
designSystemPrefix: string,
|
|
48
|
+
): ViewTemplate<FoundationAiAssistant> => {
|
|
49
|
+
const buttonTag = `${designSystemPrefix}-button`;
|
|
50
|
+
const switchTag = `${designSystemPrefix}-switch`;
|
|
51
|
+
const multiselectTag = `${designSystemPrefix}-multiselect`;
|
|
52
|
+
const textareaTag = `${designSystemPrefix}-text-area`;
|
|
53
|
+
const iconTag = `${designSystemPrefix}-icon`;
|
|
54
|
+
|
|
55
|
+
return html<FoundationAiAssistant>`
|
|
56
|
+
<div class="chat-wrapper" part="chat-wrapper">
|
|
57
|
+
${when(
|
|
58
|
+
(x) => !!x.chatConfig.acceptedFiles,
|
|
59
|
+
html<FoundationAiAssistant>`
|
|
60
|
+
<input
|
|
61
|
+
class="file-input"
|
|
62
|
+
type="file"
|
|
63
|
+
multiple
|
|
64
|
+
accept=${(x) => x.chatConfig.acceptedFiles}
|
|
65
|
+
@change=${(x, c) => x.handleFileSelect(c.event)}
|
|
66
|
+
/>
|
|
67
|
+
`,
|
|
68
|
+
)}
|
|
69
|
+
${when(
|
|
70
|
+
(x) =>
|
|
71
|
+
!!x.popoutMode ||
|
|
72
|
+
x.chatConfig.showToolCalls != null ||
|
|
73
|
+
x.chatConfig.showThinkingSteps != null ||
|
|
74
|
+
x.chatConfig.allowDebugDownload === true ||
|
|
75
|
+
x.chatConfig.animations != null,
|
|
76
|
+
html<FoundationAiAssistant>`
|
|
77
|
+
<div
|
|
78
|
+
class="chat-header ${(x) => (x.popoutMode === 'expand' ? 'draggable' : '')}"
|
|
79
|
+
part="chat-header"
|
|
80
|
+
@mousedown="${(x, c) => x.onChatHeaderMouseDown(c.event as MouseEvent)}"
|
|
81
|
+
>
|
|
82
|
+
${when(
|
|
83
|
+
(x) => !!x.headerTitle,
|
|
84
|
+
html<FoundationAiAssistant>`
|
|
85
|
+
<span class="chat-title" part="chat-title">${(x) => x.headerTitle}</span>
|
|
86
|
+
`,
|
|
87
|
+
)}
|
|
88
|
+
<div class="header-actions" part="header-actions">
|
|
89
|
+
<slot name="header-actions-extra"></slot>
|
|
90
|
+
${when(
|
|
91
|
+
(x) => !!x.popoutMode,
|
|
92
|
+
html<FoundationAiAssistant>`
|
|
93
|
+
<${buttonTag}
|
|
94
|
+
class="popout-button"
|
|
95
|
+
part="popout-button"
|
|
96
|
+
appearance="stealth"
|
|
97
|
+
title="${(x) => (x.popoutMode === 'expand' ? 'Expand to panel' : 'Pop back to bubble')}"
|
|
98
|
+
?disabled=${(x) => x.hasActivePendingInteraction}
|
|
99
|
+
@click=${(x) => x.handlePopout()}
|
|
100
|
+
><${iconTag} name="${(x) => (x.popoutMode === 'expand' ? 'external-link-alt' : 'compress-alt')}"></${iconTag}></${buttonTag}>
|
|
101
|
+
`,
|
|
102
|
+
)}
|
|
103
|
+
${when(
|
|
104
|
+
(x) =>
|
|
105
|
+
x.chatConfig.showToolCalls != null ||
|
|
106
|
+
x.chatConfig.showThinkingSteps != null ||
|
|
107
|
+
x.chatConfig.allowDebugDownload === true ||
|
|
108
|
+
x.chatConfig.animations != null,
|
|
109
|
+
html<FoundationAiAssistant>`
|
|
110
|
+
<${buttonTag}
|
|
111
|
+
class="settings-button"
|
|
112
|
+
part="settings-button"
|
|
113
|
+
appearance="stealth"
|
|
114
|
+
title="Settings"
|
|
115
|
+
@click=${(x) => x.toggleSettings()}
|
|
116
|
+
><${iconTag} name="cog"></${iconTag}></${buttonTag}>
|
|
117
|
+
`,
|
|
118
|
+
)}
|
|
119
|
+
</div>
|
|
120
|
+
</div>
|
|
121
|
+
${when(
|
|
122
|
+
(x) => x.settingsOpen,
|
|
123
|
+
html<FoundationAiAssistant>`
|
|
124
|
+
<div class="settings-panel" part="settings-panel">
|
|
125
|
+
${when(
|
|
126
|
+
(x) => x.chatConfig.showToolCalls != null,
|
|
127
|
+
html<FoundationAiAssistant>`
|
|
128
|
+
<${switchTag}
|
|
129
|
+
part="toggle-tool-calls"
|
|
130
|
+
:checked=${(x) => x.showToolCalls}
|
|
131
|
+
@change=${(x) => x.toggleShowToolCalls()}
|
|
132
|
+
>Tool calls</${switchTag}>
|
|
133
|
+
`,
|
|
134
|
+
)}
|
|
135
|
+
${when(
|
|
136
|
+
(x) => x.chatConfig.showThinkingSteps != null,
|
|
137
|
+
html<FoundationAiAssistant>`
|
|
138
|
+
<${switchTag}
|
|
139
|
+
part="toggle-thinking"
|
|
140
|
+
:checked=${(x) => x.showThinkingSteps}
|
|
141
|
+
@change=${(x) => x.toggleShowThinkingSteps()}
|
|
142
|
+
>Thinking</${switchTag}>
|
|
143
|
+
`,
|
|
144
|
+
)}
|
|
145
|
+
${when(
|
|
146
|
+
(x) => x.chatConfig.allowDebugDownload === true,
|
|
147
|
+
html<FoundationAiAssistant>`
|
|
148
|
+
<${buttonTag}
|
|
149
|
+
part="download-button"
|
|
150
|
+
appearance="stealth"
|
|
151
|
+
@click=${(x) => x.downloadHistory()}
|
|
152
|
+
>Download debug state</${buttonTag}>
|
|
153
|
+
`,
|
|
154
|
+
)}
|
|
155
|
+
${when(
|
|
156
|
+
(x) => x.chatConfig.animations?.userConfigurable === true,
|
|
157
|
+
html<FoundationAiAssistant>`
|
|
158
|
+
<div class="settings-animations">
|
|
159
|
+
<span class="settings-label">Animations</span>
|
|
160
|
+
<${multiselectTag}
|
|
161
|
+
part="toggle-animations"
|
|
162
|
+
:selectedOptions=${(x) => x.enabledAnimations}
|
|
163
|
+
:options=${() => animationOptions}
|
|
164
|
+
:itemRenderer=${() => animationItemRenderer}
|
|
165
|
+
@selectionChange=${(x, c) =>
|
|
166
|
+
x.setEnabledAnimations((c.event as CustomEvent).detail)}
|
|
167
|
+
search="false"
|
|
168
|
+
all="false"
|
|
169
|
+
></${multiselectTag}>
|
|
170
|
+
</div>
|
|
171
|
+
`,
|
|
172
|
+
)}
|
|
173
|
+
</div>
|
|
174
|
+
`,
|
|
175
|
+
)}
|
|
176
|
+
`,
|
|
177
|
+
)}
|
|
178
|
+
|
|
179
|
+
<div class="messages" part="messages">
|
|
180
|
+
|
|
181
|
+
${repeat(
|
|
182
|
+
(x) => x.visibleMessages,
|
|
183
|
+
html<ChatMessage, FoundationAiAssistant>`
|
|
184
|
+
<div class="message-row ${(m) => messageType(m)}">
|
|
185
|
+
${when(
|
|
186
|
+
(m) => m.role !== 'user',
|
|
187
|
+
html<ChatMessage, FoundationAiAssistant>`
|
|
188
|
+
<div class="avatar ${(m) => messageType(m)}">
|
|
189
|
+
${when(
|
|
190
|
+
(m, c) => !!(c.parent as FoundationAiAssistant).imageSrc,
|
|
191
|
+
html<ChatMessage, FoundationAiAssistant>`
|
|
192
|
+
<img
|
|
193
|
+
src="${(m, c) => (c.parent as FoundationAiAssistant).imageSrc}"
|
|
194
|
+
alt="Assistant"
|
|
195
|
+
class="avatar-img"
|
|
196
|
+
/>
|
|
197
|
+
`,
|
|
198
|
+
)}
|
|
199
|
+
${when(
|
|
200
|
+
(m, c) => !(c.parent as FoundationAiAssistant).imageSrc,
|
|
201
|
+
genesisIconTemplate,
|
|
202
|
+
)}
|
|
203
|
+
</div>
|
|
204
|
+
`,
|
|
205
|
+
)}
|
|
206
|
+
<div class="message ${(m) => messageType(m)}">
|
|
207
|
+
<div class="sender">
|
|
208
|
+
${(m) =>
|
|
209
|
+
m.role === 'user'
|
|
210
|
+
? 'You'
|
|
211
|
+
: m.thinking
|
|
212
|
+
? 'Thinking'
|
|
213
|
+
: m.toolCalls
|
|
214
|
+
? 'Tool Call'
|
|
215
|
+
: 'Assistant'}
|
|
216
|
+
</div>
|
|
217
|
+
<div class="content">
|
|
218
|
+
${when(
|
|
219
|
+
(m) => m.content,
|
|
220
|
+
html<ChatMessage, FoundationAiAssistant>`
|
|
221
|
+
<ai-chat-markdown :content="${(m) => m.content}"></ai-chat-markdown>
|
|
222
|
+
`,
|
|
223
|
+
)}
|
|
224
|
+
${when(
|
|
225
|
+
(m) => m.toolCalls,
|
|
226
|
+
html<ChatMessage, FoundationAiAssistant>`
|
|
227
|
+
${repeat(
|
|
228
|
+
(m) => m.toolCalls ?? [],
|
|
229
|
+
html<ChatToolCall>`
|
|
230
|
+
<pre class="payload"><strong>${(tc) => tc.name}</strong>(${(tc) =>
|
|
231
|
+
JSON.stringify(tc.args, null, 2)})</pre>
|
|
232
|
+
`,
|
|
233
|
+
)}
|
|
234
|
+
`,
|
|
235
|
+
)}
|
|
236
|
+
${when(
|
|
237
|
+
(m) => m.interaction,
|
|
238
|
+
html<ChatMessage, FoundationAiAssistant>`
|
|
239
|
+
<ai-chat-interaction-wrapper
|
|
240
|
+
:componentName=${(m) => m.interaction!.componentName}
|
|
241
|
+
:data=${(m) => m.interaction!.data}
|
|
242
|
+
:interactionId=${(m) => m.interaction!.interactionId}
|
|
243
|
+
:resolved=${(m) => !!m.interaction!.resolved}
|
|
244
|
+
@interaction-completed=${(m, c) =>
|
|
245
|
+
c.parent.handleInteractionCompleted(c.event)}
|
|
246
|
+
></ai-chat-interaction-wrapper>
|
|
247
|
+
`,
|
|
248
|
+
)}
|
|
249
|
+
</div>
|
|
250
|
+
</div>
|
|
251
|
+
</div>
|
|
252
|
+
`,
|
|
253
|
+
)}
|
|
254
|
+
${when(
|
|
255
|
+
(x) =>
|
|
256
|
+
x.showLoadingIndicator &&
|
|
257
|
+
(x.chatConfig.animations == null || x.enabledAnimations.includes('loading')),
|
|
258
|
+
html<FoundationAiAssistant>`
|
|
259
|
+
<div class="message-row ai" part="thinking">
|
|
260
|
+
<div class="avatar">
|
|
261
|
+
${when(
|
|
262
|
+
(x) => !!x.imageSrc,
|
|
263
|
+
html<FoundationAiAssistant>`
|
|
264
|
+
<img src="${(x) => x.imageSrc}" alt="Assistant" class="avatar-img" />
|
|
265
|
+
`,
|
|
266
|
+
)}
|
|
267
|
+
${when((x) => !x.imageSrc, genesisIconTemplate)}
|
|
268
|
+
</div>
|
|
269
|
+
<div class="thinking-dots">
|
|
270
|
+
<div class="dot dot-1"></div>
|
|
271
|
+
<div class="dot dot-2"></div>
|
|
272
|
+
<div class="dot dot-3"></div>
|
|
273
|
+
<div class="dot dot-4"></div>
|
|
274
|
+
</div>
|
|
275
|
+
</div>
|
|
276
|
+
`,
|
|
277
|
+
)}
|
|
278
|
+
</div>
|
|
279
|
+
|
|
280
|
+
${when(
|
|
281
|
+
(x) => x.attachments.length > 0 || x.attachmentErrors.length > 0,
|
|
282
|
+
html<FoundationAiAssistant>`
|
|
283
|
+
<div class="attachment-chips" part="attachment-chips">
|
|
284
|
+
${repeat(
|
|
285
|
+
(x) => x.attachments,
|
|
286
|
+
html<ChatAttachment, FoundationAiAssistant>`
|
|
287
|
+
<span class="attachment-chip" part="attachment-chip">
|
|
288
|
+
${(a) => a.name}
|
|
289
|
+
<button
|
|
290
|
+
class="chip-remove"
|
|
291
|
+
type="button"
|
|
292
|
+
@click=${(a, c) => c.parent.removeAttachment(a)}
|
|
293
|
+
>
|
|
294
|
+
×
|
|
295
|
+
</button>
|
|
296
|
+
</span>
|
|
297
|
+
`,
|
|
298
|
+
)}
|
|
299
|
+
${repeat(
|
|
300
|
+
(x) => x.attachmentErrors,
|
|
301
|
+
html<string, FoundationAiAssistant>`
|
|
302
|
+
<span class="attachment-chip attachment-chip-error" part="attachment-chip-error">
|
|
303
|
+
${(err) => err}
|
|
304
|
+
<button
|
|
305
|
+
class="chip-remove"
|
|
306
|
+
type="button"
|
|
307
|
+
@click=${(err, c) => c.parent.removeAttachmentError(err)}
|
|
308
|
+
>
|
|
309
|
+
×
|
|
310
|
+
</button>
|
|
311
|
+
</span>
|
|
312
|
+
`,
|
|
313
|
+
)}
|
|
314
|
+
</div>
|
|
315
|
+
`,
|
|
316
|
+
)}
|
|
317
|
+
|
|
318
|
+
<div class="input-row" part="input-row">
|
|
319
|
+
${when(
|
|
320
|
+
(x) => !!x.chatConfig.acceptedFiles,
|
|
321
|
+
html<FoundationAiAssistant>`
|
|
322
|
+
<${buttonTag}
|
|
323
|
+
class="attach-button"
|
|
324
|
+
part="attach-button"
|
|
325
|
+
appearance="stealth"
|
|
326
|
+
title=${(x) => `Attach file (${x.chatConfig.acceptedFiles})`}
|
|
327
|
+
?disabled=${(x) => x.state === 'loading'}
|
|
328
|
+
@click=${(x) => x.triggerFileInput()}
|
|
329
|
+
><${iconTag} name="paperclip"></${iconTag}></${buttonTag}>
|
|
330
|
+
`,
|
|
331
|
+
)}
|
|
332
|
+
<${textareaTag}
|
|
333
|
+
class="chat-input"
|
|
334
|
+
part="input"
|
|
335
|
+
placeholder=${(x) => x.placeholder}
|
|
336
|
+
:value=${(x) => x.inputValue}
|
|
337
|
+
?disabled=${(x) => x.state === 'loading'}
|
|
338
|
+
@input=${(x, c) => (x.inputValue = (c.event.target as any).value)}
|
|
339
|
+
@keydown=${(x, c) => {
|
|
340
|
+
if (
|
|
341
|
+
(c.event as KeyboardEvent).key === 'Enter' &&
|
|
342
|
+
!(c.event as KeyboardEvent).shiftKey
|
|
343
|
+
) {
|
|
344
|
+
c.event.preventDefault();
|
|
345
|
+
x.handleSendClick();
|
|
346
|
+
return false;
|
|
347
|
+
}
|
|
348
|
+
return true;
|
|
349
|
+
}}
|
|
350
|
+
></${textareaTag}>
|
|
351
|
+
<${buttonTag}
|
|
352
|
+
class="send-button"
|
|
353
|
+
part="send-button"
|
|
354
|
+
?disabled=${(x) => x.state === 'loading' || (!x.inputValue.trim() && !x.attachments.length)}
|
|
355
|
+
@click=${(x) => x.handleSendClick()}
|
|
356
|
+
>Send</${buttonTag}>
|
|
357
|
+
</div>
|
|
358
|
+
<ai-halo-overlay
|
|
359
|
+
part="halo-overlay"
|
|
360
|
+
?active=${(x) => x.showHalo && x.enabledAnimations.includes('halo')}
|
|
361
|
+
></ai-halo-overlay>
|
|
362
|
+
</div>
|
|
363
|
+
`;
|
|
364
|
+
};
|