@tylertech/forge-ai 0.11.2 → 0.11.4
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 +3546 -3542
- package/dist/ai-assistant-response/ai-assistant-response.mjs +12 -6
- package/dist/ai-chatbot/ag-ui-adapter.mjs +2 -1
- package/dist/ai-chatbot/markdown-stream-controller.mjs +3 -2
- package/dist/ai-chatbot-launcher/ai-chatbot-launcher.scss.mjs +1 -1
- package/dist/ai-message-thread/ai-message-thread.mjs +14 -7
- package/dist/core/chatbot-core-controller.mjs +3 -2
- package/package.json +1 -1
|
@@ -69,7 +69,8 @@ _AiAssistantResponseComponent_instances = /* @__PURE__ */ new WeakSet();
|
|
|
69
69
|
hasVisibleContent_get = function() {
|
|
70
70
|
return this.response.children.some((child) => {
|
|
71
71
|
if (child.type === "text") {
|
|
72
|
-
|
|
72
|
+
const content = typeof child.content === "string" ? child.content : "";
|
|
73
|
+
return content.trim().length > 0;
|
|
73
74
|
}
|
|
74
75
|
if (this.debugMode) {
|
|
75
76
|
return true;
|
|
@@ -91,10 +92,11 @@ updateEmptyState_fn = function() {
|
|
|
91
92
|
}
|
|
92
93
|
};
|
|
93
94
|
renderTextChunk_fn = function(child) {
|
|
94
|
-
|
|
95
|
+
const content = typeof child.content === "string" ? child.content : "";
|
|
96
|
+
if (!content.trim()) {
|
|
95
97
|
return nothing;
|
|
96
98
|
}
|
|
97
|
-
const renderedHtml = __privateGet(this, _markdownController).getCachedHtml(child.messageId,
|
|
99
|
+
const renderedHtml = __privateGet(this, _markdownController).getCachedHtml(child.messageId, content);
|
|
98
100
|
return html`<div class="text-chunk">${unsafeHTML(renderedHtml)}</div>`;
|
|
99
101
|
};
|
|
100
102
|
renderToolCall_fn = function(toolCall) {
|
|
@@ -211,9 +213,13 @@ toolbar_get = function() {
|
|
|
211
213
|
if (this.response.status !== "complete") {
|
|
212
214
|
return nothing;
|
|
213
215
|
}
|
|
214
|
-
const hasTextContent = this.response.children.some(
|
|
215
|
-
(child
|
|
216
|
-
|
|
216
|
+
const hasTextContent = this.response.children.some((child) => {
|
|
217
|
+
if (child.type !== "text") {
|
|
218
|
+
return false;
|
|
219
|
+
}
|
|
220
|
+
const content = typeof child.content === "string" ? child.content : "";
|
|
221
|
+
return content.trim().length > 0;
|
|
222
|
+
});
|
|
217
223
|
if (!hasTextContent) {
|
|
218
224
|
return nothing;
|
|
219
225
|
}
|
|
@@ -317,7 +317,8 @@ class AgUiAdapter extends AgentAdapter {
|
|
|
317
317
|
#transformMessages(messages) {
|
|
318
318
|
return messages.filter((msg) => msg.role === "user" || msg.role === "assistant" || msg.role === "system" || msg.role === "tool").filter((msg) => !msg.clientOnly).filter((msg) => {
|
|
319
319
|
if (msg.role === "assistant") {
|
|
320
|
-
|
|
320
|
+
const content = typeof msg.content === "string" ? msg.content : "";
|
|
321
|
+
return content.trim().length > 0 || msg.toolCalls && msg.toolCalls.length > 0;
|
|
321
322
|
}
|
|
322
323
|
return true;
|
|
323
324
|
}).map((msg) => {
|
|
@@ -21,10 +21,11 @@ class MarkdownStreamController {
|
|
|
21
21
|
return `${messageId}:${hash}`;
|
|
22
22
|
}
|
|
23
23
|
getCachedHtml(messageId, content) {
|
|
24
|
-
const
|
|
24
|
+
const str = String(content ?? "");
|
|
25
|
+
const key = this.#getCacheKey(messageId, str);
|
|
25
26
|
let html = this.#markdownCache.get(key);
|
|
26
27
|
if (!html) {
|
|
27
|
-
html = renderMarkdown(
|
|
28
|
+
html = renderMarkdown(str);
|
|
28
29
|
this.#markdownCache.set(key, html);
|
|
29
30
|
if (this.#markdownCache.size > 100) {
|
|
30
31
|
const firstKey = this.#markdownCache.keys().next().value;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const styles = '/**\n * @license\n * Copyright Tyler Technologies, Inc. \n * License: Apache-2.0\n */\n/**\n * @license\n * Copyright Tyler Technologies, Inc. \n * License: Apache-2.0\n */\n/**\n * @license\n * Copyright Tyler Technologies, Inc. \n * License: Apache-2.0\n */\n/**\n * @license\n * Copyright Tyler Technologies, Inc. \n * License: Apache-2.0\n */\n/**\n * @license\n * Copyright Tyler Technologies, Inc. \n * License: Apache-2.0\n */\n/**\n * @license\n * Copyright Tyler Technologies, Inc. \n * License: Apache-2.0\n */\n/**\n * @license\n * Copyright Tyler Technologies, Inc. \n * License: Apache-2.0\n */\n/**\n * @license\n * Copyright Tyler Technologies, Inc. \n * License: Apache-2.0\n */\n/**\n * @license\n * Copyright Tyler Technologies, Inc. \n * License: Apache-2.0\n */\n/**\n * @license\n * Copyright Tyler Technologies, Inc. \n * License: Apache-2.0\n */\n/**\n * @license\n * Copyright Tyler Technologies, Inc. \n * License: Apache-2.0\n */\n/**\n * @license\n * Copyright Tyler Technologies, Inc. \n * License: Apache-2.0\n */\n/**\n * @license\n * Copyright Tyler Technologies, Inc. \n * License: Apache-2.0\n */\n/**\n * @license\n * Copyright Tyler Technologies, Inc. \n * License: Apache-2.0\n */\n/**\n * @license\n * Copyright Tyler Technologies, Inc. \n * License: Apache-2.0\n */\n/**\n * @license\n * Copyright Tyler Technologies, Inc. \n * License: Apache-2.0\n */\n/**\n * @license\n * Copyright Tyler Technologies, Inc. \n * License: Apache-2.0\n */\n/**\n * @license\n * Copyright Tyler Technologies, Inc. \n * License: Apache-2.0\n */\n/**\n * @license\n * Copyright Tyler Technologies, Inc. \n * License: Apache-2.0\n */\n/**\n * @license\n * Copyright Tyler Technologies, Inc. \n * License: Apache-2.0\n */\n/**\n * @license\n * Copyright Tyler Technologies, Inc. \n * License: Apache-2.0\n */\n/**\n * @license\n * Copyright Tyler Technologies, Inc. \n * License: Apache-2.0\n */\n/**\n * @license\n * Copyright Tyler Technologies, Inc. \n * License: Apache-2.0\n */\n/**\n * @license\n * Copyright Tyler Technologies, Inc. \n * License: Apache-2.0\n */\n/**\n * @license\n * Copyright Tyler Technologies, Inc. \n * License: Apache-2.0\n */\n/**\n * @license\n * Copyright Tyler Technologies, Inc. \n * License: Apache-2.0\n */\n/**\n * @license\n * Copyright Tyler Technologies, Inc. \n * License: Apache-2.0\n */\n/**\n * @license\n * Copyright Tyler Technologies, Inc. \n * License: Apache-2.0\n */\n/* prettier-ignore */\n/**\n * @license\n * Copyright Tyler Technologies, Inc. \n * License: Apache-2.0\n */\n/**\n * @license\n * Copyright Tyler Technologies, Inc. \n * License: Apache-2.0\n */\n/**\n * @license\n * Copyright Tyler Technologies, Inc. \n * License: Apache-2.0\n */\n/**\n * @license\n * Copyright Tyler Technologies, Inc. \n * License: Apache-2.0\n */\n/**\n * @license\n * Copyright Tyler Technologies, Inc. \n * License: Apache-2.0\n */\n/**\n * @license\n * Copyright Tyler Technologies, Inc. \n * License: Apache-2.0\n */\n/**\n * @license\n * Copyright Tyler Technologies, Inc. \n * License: Apache-2.0\n */\n/**\n * @license\n * Copyright Tyler Technologies, Inc. \n * License: Apache-2.0\n */\n/**\n * @license\n * Copyright Tyler Technologies, Inc. \n * License: Apache-2.0\n */\n/**\n * @license\n * Copyright Tyler Technologies, Inc. \n * License: Apache-2.0\n */\n/**\n * @license\n * Copyright Tyler Technologies, Inc. \n * License: Apache-2.0\n */\n/**\n * @license\n * Copyright Tyler Technologies, Inc. \n * License: Apache-2.0\n */\n/**\n * @license\n * Copyright Tyler Technologies, Inc. \n * License: Apache-2.0\n */\n/**\n * @license\n * Copyright Tyler Technologies, Inc. \n * License: Apache-2.0\n */\n:host {\n display: block;\n height: 100%;\n}\n\n.launcher {\n display: flex;\n flex-direction: column;\n height: 100%;\n box-sizing: border-box;\n}\n\n.welcome {\n display: flex;\n flex-direction: column;\n align-items: center;\n gap: var(--forge-spacing-xxsmall, 4px);\n animation: fade-in 300ms var(--forge-animation-easing-standard, cubic-bezier(0.2, 0, 0, 1));\n max-inline-size: 768px;\n margin-inline: auto;\n width: 100%;\n box-sizing: border-box;\n padding-inline: var(--forge-spacing-xxlarge, 48px);\n}\n\n.welcome-header {\n display: flex;\n align-items: center;\n gap: var(--forge-spacing-xsmall, 8px);\n}\n\n.icon {\n --forge-ai-icon-size: 48px;\n color: var(--forge-theme-tertiary, #3d5afe);\n}\n\n.title {\n margin: 0;\n -moz-osx-font-smoothing: grayscale;\n -webkit-font-smoothing: antialiased;\n font-family: var(--forge-typography-heading6-font-family, var(--forge-typography-font-family, "Roboto", sans-serif));\n font-size: var(--forge-typography-heading6-font-size, calc(var(--forge-typography-font-size, 1rem) * var(--forge-typography-heading6-font-size-scale, 1.75)));\n font-weight: var(--forge-typography-heading6-font-weight, 500);\n line-height: var(--forge-typography-heading6-line-height, calc(var(--forge-typography-font-size, 1rem) * var(--forge-typography-heading6-line-height-scale, 2.125)));\n letter-spacing: var(--forge-typography-heading6-letter-spacing, 0em);\n text-transform: var(--forge-typography-heading6-text-transform, inherit);\n text-decoration: var(--forge-typography-heading6-text-decoration, inherit);\n color: var(--forge-theme-text-high, rgba(0, 0, 0, 0.87));\n}\n\n.description {\n -moz-osx-font-smoothing: grayscale;\n -webkit-font-smoothing: antialiased;\n font-family: var(--forge-typography-body1-font-family, var(--forge-typography-font-family, "Roboto", sans-serif));\n font-size: var(--forge-typography-body1-font-size, calc(var(--forge-typography-font-size, 1rem) * var(--forge-typography-body-font-size-scale, 0.875)));\n font-weight: var(--forge-typography-body1-font-weight, 400);\n line-height: var(--forge-typography-body1-line-height, calc(var(--forge-typography-font-size, 1rem) * var(--forge-typography-body-line-height-scale, 1.125)));\n letter-spacing: var(--forge-typography-body1-letter-spacing, 0.0357142857em);\n text-transform: var(--forge-typography-body1-text-transform, inherit);\n text-decoration: var(--forge-typography-body1-text-decoration, inherit);\n color: var(--forge-theme-text-medium, rgba(0, 0, 0, 0.6));\n text-align: center;\n margin-block-end: var(--forge-spacing-medium, 16px);\n}\n\n.prompt-container {\n --forge-card-outline-width: 0;\n inline-size: 100%;\n}\n\n.prompt-section {\n display: flex;\n flex-direction: column;\n gap: var(--forge-spacing-xsmall, 8px);\n width: 100%;\n box-sizing: border-box;\n}\n\n.disclaimer {\n -moz-osx-font-smoothing: grayscale;\n -webkit-font-smoothing: antialiased;\n font-family: var(--forge-typography-label1-font-family, var(--forge-typography-font-family, "Roboto", sans-serif));\n font-size: var(--forge-typography-label1-font-size, calc(var(--forge-typography-font-size, 1rem) * var(--forge-typography-label-font-size-scale, 0.75)));\n font-weight: var(--forge-typography-label1-font-weight, 400);\n line-height: var(--forge-typography-label1-line-height, calc(var(--forge-typography-font-size, 1rem) * var(--forge-typography-label-line-height-scale, 1.25)));\n letter-spacing: var(--forge-typography-label1-letter-spacing, 0.0357142857em);\n text-transform: var(--forge-typography-label1-text-transform, inherit);\n text-decoration: var(--forge-typography-label1-text-decoration, inherit);\n color: var(--forge-theme-text-medium, rgba(0, 0, 0, 0.6));\n text-align: center;\n}\n\n.welcome-suggestions {\n inline-size: 100%;\n margin-block-start: var(--forge-spacing-large, 24px);\n}\n.welcome-suggestions forge-ai-suggestions {\n margin-inline: var(--forge-spacing-medium, 16px);\n}\n\n.conversation {\n display: flex;\n flex-direction: column;\n flex: 1;\n min-height: 0;\n}\n\n.conversation forge-ai-chat-header {\n flex-shrink: 0;\n max-inline-size: 768px;\n margin-inline: auto;\n width: 100%;\n}\n\n.conversation forge-ai-message-thread {\n --forge-ai-message-thread-content-max-width: 768px;\n flex: 1;\n min-height: 0;\n animation: fade-in var(--forge-animation-duration-medium2, 300ms) var(--forge-animation-easing-decelerate, cubic-bezier(0, 0, 0, 1));\n}\n\n.session-files {\n display: flex;\n flex-direction: column;\n gap: var(--forge-spacing-xsmall, 8px);\n min-width: 0;\n}\n.session-files .session-files-header {\n -moz-osx-font-smoothing: grayscale;\n -webkit-font-smoothing: antialiased;\n font-family: var(--forge-typography-label1-font-family, var(--forge-typography-font-family, "Roboto", sans-serif));\n font-size: var(--forge-typography-label1-font-size, calc(var(--forge-typography-font-size, 1rem) * var(--forge-typography-label-font-size-scale, 0.75)));\n font-weight: var(--forge-typography-label1-font-weight, 400);\n line-height: var(--forge-typography-label1-line-height, calc(var(--forge-typography-font-size, 1rem) * var(--forge-typography-label-line-height-scale, 1.25)));\n letter-spacing: var(--forge-typography-label1-letter-spacing, 0.0357142857em);\n text-transform: var(--forge-typography-label1-text-transform, inherit);\n text-decoration: var(--forge-typography-label1-text-decoration, inherit);\n color: var(--forge-theme-text-medium, rgba(0, 0, 0, 0.6));\n}\n.session-files .session-files-list::-webkit-scrollbar {\n height: var(--forge-scrollbar-height, 16px);\n width: var(--forge-scrollbar-width, 16px);\n}\n.session-files .session-files-list::-webkit-scrollbar-track {\n background-color: var(--forge-scrollbar-track-container, var(--forge-theme-surface-container-low, #ebebeb));\n}\n.session-files .session-files-list::-webkit-scrollbar-track:hover {\n background-color: var(--forge-scrollbar-track-container-hover, var(--forge-theme-surface-container-low, #ebebeb));\n}\n.session-files .session-files-list::-webkit-scrollbar-corner {\n background-color: var(--forge-scrollbar-track-container, var(--forge-theme-surface-container-low, #ebebeb));\n}\n.session-files .session-files-list::-webkit-scrollbar-thumb {\n height: var(--forge-scrollbar-thumb-min-height, 32px);\n width: var(--forge-scrollbar-thumb-min-width, 32px);\n border-radius: var(--forge-scrollbar-border-radius, calc(var(--forge-shape-full, 9999px) * var(--forge-shape-factor, 1)));\n border-width: var(--forge-scrollbar-border-width, 3px);\n border-style: solid;\n border-color: transparent;\n background-color: var(--forge-scrollbar-thumb-container, var(--forge-theme-surface-container-medium, #c2c2c2));\n background-clip: content-box;\n}\n.session-files .session-files-list::-webkit-scrollbar-thumb:hover {\n background-color: var(--forge-scrollbar-thumb-container-hover, var(--forge-theme-surface-container-high, #9e9e9e));\n}\n.session-files .session-files-list {\n display: flex;\n gap: var(--forge-spacing-small, 12px);\n overflow-x: auto;\n padding-block-end: var(--forge-spacing-xxsmall, 4px);\n}\n\n@keyframes fade-in {\n from {\n opacity: 0;\n }\n to {\n opacity: 1;\n }\n}\n@keyframes prompt-slide-down {\n from {\n transform: translateY(-30vh);\n }\n to {\n transform: translateY(0);\n }\n}\n:host(:state(welcome)) {\n --_ai-chatbot-launcher-align: var(--forge-ai-chatbot-launcher-align, center);\n}\n:host(:state(welcome)) .launcher {\n align-items: center;\n justify-content: var(--_ai-chatbot-launcher-align);\n padding: var(--forge-spacing-xxlarge, 48px);\n gap: var(--forge-spacing-xxsmall, 4px);\n}\n:host(:state(welcome)) .welcome {\n display: flex;\n}\n:host(:state(welcome)) .conversation {\n display: none;\n}\n:host(:state(welcome)) .prompt-section {\n max-inline-size: 768px;\n width: 100%;\n}\n:host(:state(welcome)) .session-files {\n inline-size: 100%;\n}\n:host(:state(welcome)) .welcome-suggestions {\n max-inline-size: 768px;\n width: 100%;\n}\n\n:host(:state(conversation)) .welcome {\n display: none;\n}\n:host(:state(conversation)) .conversation {\n display: flex;\n}\n:host(:state(conversation)) .prompt-section {\n padding: var(--forge-spacing-medium, 16px) var(--forge-spacing-medium, 16px) var(--forge-spacing-xsmall, 8px);\n max-inline-size: 768px;\n margin-inline: auto;\n animation: prompt-slide-down var(--forge-animation-duration-medium2, 300ms) var(--forge-animation-easing-decelerate, cubic-bezier(0, 0, 0, 1));\n}\n:host(:state(conversation)) .prompt-container {\n --forge-card-outline-width: initial;\n border: none;\n background: transparent;\n}\n:host(:state(conversation)) forge-ai-prompt {\n max-inline-size: none;\n}';
|
|
1
|
+
const styles = '/**\n * @license\n * Copyright Tyler Technologies, Inc. \n * License: Apache-2.0\n */\n/**\n * @license\n * Copyright Tyler Technologies, Inc. \n * License: Apache-2.0\n */\n/**\n * @license\n * Copyright Tyler Technologies, Inc. \n * License: Apache-2.0\n */\n/**\n * @license\n * Copyright Tyler Technologies, Inc. \n * License: Apache-2.0\n */\n/**\n * @license\n * Copyright Tyler Technologies, Inc. \n * License: Apache-2.0\n */\n/**\n * @license\n * Copyright Tyler Technologies, Inc. \n * License: Apache-2.0\n */\n/**\n * @license\n * Copyright Tyler Technologies, Inc. \n * License: Apache-2.0\n */\n/**\n * @license\n * Copyright Tyler Technologies, Inc. \n * License: Apache-2.0\n */\n/**\n * @license\n * Copyright Tyler Technologies, Inc. \n * License: Apache-2.0\n */\n/**\n * @license\n * Copyright Tyler Technologies, Inc. \n * License: Apache-2.0\n */\n/**\n * @license\n * Copyright Tyler Technologies, Inc. \n * License: Apache-2.0\n */\n/**\n * @license\n * Copyright Tyler Technologies, Inc. \n * License: Apache-2.0\n */\n/**\n * @license\n * Copyright Tyler Technologies, Inc. \n * License: Apache-2.0\n */\n/**\n * @license\n * Copyright Tyler Technologies, Inc. \n * License: Apache-2.0\n */\n/**\n * @license\n * Copyright Tyler Technologies, Inc. \n * License: Apache-2.0\n */\n/**\n * @license\n * Copyright Tyler Technologies, Inc. \n * License: Apache-2.0\n */\n/**\n * @license\n * Copyright Tyler Technologies, Inc. \n * License: Apache-2.0\n */\n/**\n * @license\n * Copyright Tyler Technologies, Inc. \n * License: Apache-2.0\n */\n/**\n * @license\n * Copyright Tyler Technologies, Inc. \n * License: Apache-2.0\n */\n/**\n * @license\n * Copyright Tyler Technologies, Inc. \n * License: Apache-2.0\n */\n/**\n * @license\n * Copyright Tyler Technologies, Inc. \n * License: Apache-2.0\n */\n/**\n * @license\n * Copyright Tyler Technologies, Inc. \n * License: Apache-2.0\n */\n/**\n * @license\n * Copyright Tyler Technologies, Inc. \n * License: Apache-2.0\n */\n/**\n * @license\n * Copyright Tyler Technologies, Inc. \n * License: Apache-2.0\n */\n/**\n * @license\n * Copyright Tyler Technologies, Inc. \n * License: Apache-2.0\n */\n/**\n * @license\n * Copyright Tyler Technologies, Inc. \n * License: Apache-2.0\n */\n/**\n * @license\n * Copyright Tyler Technologies, Inc. \n * License: Apache-2.0\n */\n/**\n * @license\n * Copyright Tyler Technologies, Inc. \n * License: Apache-2.0\n */\n/* prettier-ignore */\n/**\n * @license\n * Copyright Tyler Technologies, Inc. \n * License: Apache-2.0\n */\n/**\n * @license\n * Copyright Tyler Technologies, Inc. \n * License: Apache-2.0\n */\n/**\n * @license\n * Copyright Tyler Technologies, Inc. \n * License: Apache-2.0\n */\n/**\n * @license\n * Copyright Tyler Technologies, Inc. \n * License: Apache-2.0\n */\n/**\n * @license\n * Copyright Tyler Technologies, Inc. \n * License: Apache-2.0\n */\n/**\n * @license\n * Copyright Tyler Technologies, Inc. \n * License: Apache-2.0\n */\n/**\n * @license\n * Copyright Tyler Technologies, Inc. \n * License: Apache-2.0\n */\n/**\n * @license\n * Copyright Tyler Technologies, Inc. \n * License: Apache-2.0\n */\n/**\n * @license\n * Copyright Tyler Technologies, Inc. \n * License: Apache-2.0\n */\n/**\n * @license\n * Copyright Tyler Technologies, Inc. \n * License: Apache-2.0\n */\n/**\n * @license\n * Copyright Tyler Technologies, Inc. \n * License: Apache-2.0\n */\n/**\n * @license\n * Copyright Tyler Technologies, Inc. \n * License: Apache-2.0\n */\n/**\n * @license\n * Copyright Tyler Technologies, Inc. \n * License: Apache-2.0\n */\n/**\n * @license\n * Copyright Tyler Technologies, Inc. \n * License: Apache-2.0\n */\n:host {\n display: block;\n height: 100%;\n}\n\n.launcher {\n display: flex;\n flex-direction: column;\n height: 100%;\n box-sizing: border-box;\n}\n\n.welcome {\n display: flex;\n flex-direction: column;\n align-items: center;\n gap: var(--forge-spacing-xxsmall, 4px);\n animation: fade-in 300ms var(--forge-animation-easing-standard, cubic-bezier(0.2, 0, 0, 1));\n max-inline-size: 768px;\n margin-inline: auto;\n width: 100%;\n box-sizing: border-box;\n padding-inline: var(--forge-spacing-xxlarge, 48px);\n}\n\n.welcome-header {\n display: flex;\n align-items: center;\n gap: var(--forge-spacing-xsmall, 8px);\n}\n\n.icon {\n --forge-ai-icon-size: 48px;\n color: var(--forge-theme-tertiary, #3d5afe);\n}\n\n.title {\n margin: 0;\n -moz-osx-font-smoothing: grayscale;\n -webkit-font-smoothing: antialiased;\n font-family: var(--forge-typography-heading6-font-family, var(--forge-typography-font-family, "Roboto", sans-serif));\n font-size: var(--forge-typography-heading6-font-size, calc(var(--forge-typography-font-size, 1rem) * var(--forge-typography-heading6-font-size-scale, 1.75)));\n font-weight: var(--forge-typography-heading6-font-weight, 500);\n line-height: var(--forge-typography-heading6-line-height, calc(var(--forge-typography-font-size, 1rem) * var(--forge-typography-heading6-line-height-scale, 2.125)));\n letter-spacing: var(--forge-typography-heading6-letter-spacing, 0em);\n text-transform: var(--forge-typography-heading6-text-transform, inherit);\n text-decoration: var(--forge-typography-heading6-text-decoration, inherit);\n color: var(--forge-theme-text-high, rgba(0, 0, 0, 0.87));\n}\n\n.description {\n -moz-osx-font-smoothing: grayscale;\n -webkit-font-smoothing: antialiased;\n font-family: var(--forge-typography-body1-font-family, var(--forge-typography-font-family, "Roboto", sans-serif));\n font-size: var(--forge-typography-body1-font-size, calc(var(--forge-typography-font-size, 1rem) * var(--forge-typography-body-font-size-scale, 0.875)));\n font-weight: var(--forge-typography-body1-font-weight, 400);\n line-height: var(--forge-typography-body1-line-height, calc(var(--forge-typography-font-size, 1rem) * var(--forge-typography-body-line-height-scale, 1.125)));\n letter-spacing: var(--forge-typography-body1-letter-spacing, 0.0357142857em);\n text-transform: var(--forge-typography-body1-text-transform, inherit);\n text-decoration: var(--forge-typography-body1-text-decoration, inherit);\n color: var(--forge-theme-text-medium, rgba(0, 0, 0, 0.6));\n text-align: center;\n margin-block-end: var(--forge-spacing-medium, 16px);\n}\n\n.prompt-container {\n --forge-card-outline-width: 0;\n inline-size: 100%;\n}\n\n.prompt-section {\n display: flex;\n flex-direction: column;\n gap: var(--forge-spacing-xsmall, 8px);\n width: 100%;\n box-sizing: border-box;\n}\n\n.disclaimer {\n -moz-osx-font-smoothing: grayscale;\n -webkit-font-smoothing: antialiased;\n font-family: var(--forge-typography-label1-font-family, var(--forge-typography-font-family, "Roboto", sans-serif));\n font-size: var(--forge-typography-label1-font-size, calc(var(--forge-typography-font-size, 1rem) * var(--forge-typography-label-font-size-scale, 0.75)));\n font-weight: var(--forge-typography-label1-font-weight, 400);\n line-height: var(--forge-typography-label1-line-height, calc(var(--forge-typography-font-size, 1rem) * var(--forge-typography-label-line-height-scale, 1.25)));\n letter-spacing: var(--forge-typography-label1-letter-spacing, 0.0357142857em);\n text-transform: var(--forge-typography-label1-text-transform, inherit);\n text-decoration: var(--forge-typography-label1-text-decoration, inherit);\n color: var(--forge-theme-text-medium, rgba(0, 0, 0, 0.6));\n text-align: center;\n}\n\n.welcome-suggestions {\n inline-size: 100%;\n margin-block-start: var(--forge-spacing-large, 24px);\n}\n.welcome-suggestions forge-ai-suggestions {\n margin-inline: var(--forge-spacing-medium, 16px);\n}\n\n.conversation {\n display: flex;\n flex-direction: column;\n flex: 1;\n min-height: 0;\n}\n\n.conversation forge-ai-chat-header {\n flex-shrink: 0;\n max-inline-size: 768px;\n margin-inline: auto;\n width: 100%;\n}\n\n.conversation forge-ai-message-thread {\n --forge-ai-message-thread-content-max-width: 768px;\n flex: 1;\n min-height: 0;\n animation: fade-in var(--forge-animation-duration-medium2, 300ms) var(--forge-animation-easing-decelerate, cubic-bezier(0, 0, 0, 1));\n}\n\n.session-files {\n display: flex;\n flex-direction: column;\n gap: var(--forge-spacing-xsmall, 8px);\n min-width: 0;\n}\n.session-files .session-files-header {\n -moz-osx-font-smoothing: grayscale;\n -webkit-font-smoothing: antialiased;\n font-family: var(--forge-typography-label1-font-family, var(--forge-typography-font-family, "Roboto", sans-serif));\n font-size: var(--forge-typography-label1-font-size, calc(var(--forge-typography-font-size, 1rem) * var(--forge-typography-label-font-size-scale, 0.75)));\n font-weight: var(--forge-typography-label1-font-weight, 400);\n line-height: var(--forge-typography-label1-line-height, calc(var(--forge-typography-font-size, 1rem) * var(--forge-typography-label-line-height-scale, 1.25)));\n letter-spacing: var(--forge-typography-label1-letter-spacing, 0.0357142857em);\n text-transform: var(--forge-typography-label1-text-transform, inherit);\n text-decoration: var(--forge-typography-label1-text-decoration, inherit);\n color: var(--forge-theme-text-medium, rgba(0, 0, 0, 0.6));\n}\n.session-files .session-files-list::-webkit-scrollbar {\n height: var(--forge-scrollbar-height, 16px);\n width: var(--forge-scrollbar-width, 16px);\n}\n.session-files .session-files-list::-webkit-scrollbar-track {\n background-color: var(--forge-scrollbar-track-container, var(--forge-theme-surface-container-low, #ebebeb));\n}\n.session-files .session-files-list::-webkit-scrollbar-track:hover {\n background-color: var(--forge-scrollbar-track-container-hover, var(--forge-theme-surface-container-low, #ebebeb));\n}\n.session-files .session-files-list::-webkit-scrollbar-corner {\n background-color: var(--forge-scrollbar-track-container, var(--forge-theme-surface-container-low, #ebebeb));\n}\n.session-files .session-files-list::-webkit-scrollbar-thumb {\n height: var(--forge-scrollbar-thumb-min-height, 32px);\n width: var(--forge-scrollbar-thumb-min-width, 32px);\n border-radius: var(--forge-scrollbar-border-radius, calc(var(--forge-shape-full, 9999px) * var(--forge-shape-factor, 1)));\n border-width: var(--forge-scrollbar-border-width, 3px);\n border-style: solid;\n border-color: transparent;\n background-color: var(--forge-scrollbar-thumb-container, var(--forge-theme-surface-container-medium, #c2c2c2));\n background-clip: content-box;\n}\n.session-files .session-files-list::-webkit-scrollbar-thumb:hover {\n background-color: var(--forge-scrollbar-thumb-container-hover, var(--forge-theme-surface-container-high, #9e9e9e));\n}\n.session-files .session-files-list {\n display: flex;\n gap: var(--forge-spacing-small, 12px);\n overflow-x: auto;\n padding-block-end: var(--forge-spacing-xxsmall, 4px);\n}\n\n@keyframes fade-in {\n from {\n opacity: 0;\n }\n to {\n opacity: 1;\n }\n}\n@keyframes prompt-slide-down {\n from {\n transform: translateY(-30vh);\n }\n to {\n transform: translateY(0);\n }\n}\n:host(:state(welcome)) {\n --_ai-chatbot-launcher-align: var(--forge-ai-chatbot-launcher-align, center);\n}\n:host(:state(welcome)) .launcher {\n align-items: center;\n justify-content: var(--_ai-chatbot-launcher-align);\n gap: var(--forge-spacing-xxsmall, 4px);\n}\n:host(:state(welcome)) .welcome {\n display: flex;\n}\n:host(:state(welcome)) .conversation {\n display: none;\n}\n:host(:state(welcome)) .prompt-section {\n max-inline-size: 768px;\n width: 100%;\n}\n:host(:state(welcome)) .session-files {\n inline-size: 100%;\n}\n:host(:state(welcome)) .welcome-suggestions {\n max-inline-size: 768px;\n width: 100%;\n}\n\n:host(:state(conversation)) .welcome {\n display: none;\n}\n:host(:state(conversation)) .conversation {\n display: flex;\n}\n:host(:state(conversation)) .prompt-section {\n padding: var(--forge-spacing-medium, 16px) var(--forge-spacing-medium, 16px) var(--forge-spacing-xsmall, 8px);\n max-inline-size: 768px;\n margin-inline: auto;\n animation: prompt-slide-down var(--forge-animation-duration-medium2, 300ms) var(--forge-animation-easing-decelerate, cubic-bezier(0, 0, 0, 1));\n}\n:host(:state(conversation)) .prompt-container {\n --forge-card-outline-width: initial;\n border: none;\n background: transparent;\n}\n:host(:state(conversation)) forge-ai-prompt {\n max-inline-size: none;\n}';
|
|
2
2
|
export {
|
|
3
3
|
styles as default
|
|
4
4
|
};
|
|
@@ -210,7 +210,13 @@ thinkingIndicator_get = function() {
|
|
|
210
210
|
const lastItem = this.messageItems[this.messageItems.length - 1];
|
|
211
211
|
if (lastItem?.type === "assistant") {
|
|
212
212
|
const response = lastItem.data;
|
|
213
|
-
const hasTextContent = response.children.some((c) =>
|
|
213
|
+
const hasTextContent = response.children.some((c) => {
|
|
214
|
+
if (c.type !== "text") {
|
|
215
|
+
return false;
|
|
216
|
+
}
|
|
217
|
+
const content = typeof c.content === "string" ? c.content : "";
|
|
218
|
+
return content.trim().length > 0;
|
|
219
|
+
});
|
|
214
220
|
if (hasTextContent) {
|
|
215
221
|
return nothing;
|
|
216
222
|
}
|
|
@@ -261,13 +267,14 @@ messages_get = function() {
|
|
|
261
267
|
return __privateMethod(this, _AiMessageThreadComponent_instances, renderToolCall_fn).call(this, item.data);
|
|
262
268
|
}
|
|
263
269
|
const msg = item.data;
|
|
270
|
+
const content = typeof msg.content === "string" ? msg.content : "";
|
|
264
271
|
if (msg.role === "user") {
|
|
265
|
-
const renderedHtml = __privateGet(this, _markdownController).getCachedHtml(msg.id,
|
|
272
|
+
const renderedHtml = __privateGet(this, _markdownController).getCachedHtml(msg.id, content);
|
|
266
273
|
return html`
|
|
267
274
|
<forge-ai-user-message
|
|
268
275
|
message-id=${msg.id}
|
|
269
276
|
.timestamp=${msg.timestamp}
|
|
270
|
-
.content=${
|
|
277
|
+
.content=${content}
|
|
271
278
|
?streaming=${this.showThinking}
|
|
272
279
|
@forge-ai-user-message-copy=${(e) => __privateMethod(this, _AiMessageThreadComponent_instances, handleUserCopy_fn).call(this, e.detail.messageId)}
|
|
273
280
|
@forge-ai-user-message-resend=${(e) => __privateMethod(this, _AiMessageThreadComponent_instances, handleUserResend_fn).call(this, e.detail.messageId)}
|
|
@@ -276,9 +283,9 @@ messages_get = function() {
|
|
|
276
283
|
</forge-ai-user-message>
|
|
277
284
|
`;
|
|
278
285
|
} else if (msg.role === "system") {
|
|
279
|
-
return html`<div class="system-message">${
|
|
286
|
+
return html`<div class="system-message">${content}</div>`;
|
|
280
287
|
} else if (msg.status === "error") {
|
|
281
|
-
const renderedHtml = __privateGet(this, _markdownController).getCachedHtml(msg.id,
|
|
288
|
+
const renderedHtml = __privateGet(this, _markdownController).getCachedHtml(msg.id, content);
|
|
282
289
|
return html`
|
|
283
290
|
<forge-ai-error-message>
|
|
284
291
|
<span slot="title">Error</span>
|
|
@@ -286,8 +293,8 @@ messages_get = function() {
|
|
|
286
293
|
</forge-ai-error-message>
|
|
287
294
|
`;
|
|
288
295
|
} else {
|
|
289
|
-
return when(
|
|
290
|
-
const renderedHtml = __privateGet(this, _markdownController).getCachedHtml(msg.id,
|
|
296
|
+
return when(content.trim().length, () => {
|
|
297
|
+
const renderedHtml = __privateGet(this, _markdownController).getCachedHtml(msg.id, content);
|
|
291
298
|
return html`<forge-ai-response-message>${unsafeHTML(renderedHtml)}</forge-ai-response-message>`;
|
|
292
299
|
});
|
|
293
300
|
}
|
|
@@ -266,7 +266,8 @@ class ChatbotCoreController {
|
|
|
266
266
|
this.#adapter.sendToolResult(toolCallId, result, this.getMessages());
|
|
267
267
|
}
|
|
268
268
|
async sendMessage(config) {
|
|
269
|
-
|
|
269
|
+
const content = typeof config.content === "string" ? config.content : "";
|
|
270
|
+
if (!content.trim() || !this.#adapter || this.isStreaming) {
|
|
270
271
|
if (!this.#adapter) {
|
|
271
272
|
console.warn("No adapter configured.");
|
|
272
273
|
}
|
|
@@ -278,7 +279,7 @@ class ChatbotCoreController {
|
|
|
278
279
|
const userMessage = {
|
|
279
280
|
id: generateId(),
|
|
280
281
|
role: "user",
|
|
281
|
-
content
|
|
282
|
+
content,
|
|
282
283
|
timestamp: config.timestamp ?? Date.now(),
|
|
283
284
|
status: "pending"
|
|
284
285
|
};
|