@crestapps/ai-chat-ui 1.0.0-preview.18 → 1.0.0-preview.20
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/dist/ai-chat.css +18 -0
- package/dist/ai-chat.css.map +1 -1
- package/dist/ai-chat.js +177 -193
- package/dist/ai-chat.js.map +1 -1
- package/dist/ai-chat.min.css +1 -1
- package/dist/ai-chat.min.js +1 -1
- package/dist/ai-chat.min.js.map +1 -1
- package/dist/chat-interaction-settings.js +234 -0
- package/dist/chat-interaction-settings.js.map +1 -0
- package/dist/chat-interaction-settings.min.js +2 -0
- package/dist/chat-interaction-settings.min.js.map +1 -0
- package/dist/chat-interaction.js +769 -214
- package/dist/chat-interaction.js.map +1 -1
- package/dist/chat-interaction.min.js +1 -1
- package/dist/chat-interaction.min.js.map +1 -1
- package/dist/technical-name-generator.js +36 -8
- package/dist/technical-name-generator.js.map +1 -1
- package/dist/technical-name-generator.min.js +1 -1
- package/dist/technical-name-generator.min.js.map +1 -1
- package/package.json +1 -1
package/dist/ai-chat.css
CHANGED
|
@@ -39,6 +39,24 @@
|
|
|
39
39
|
min-width: 0;
|
|
40
40
|
}
|
|
41
41
|
|
|
42
|
+
.ai-chat-messages .ai-chat-message-body sup {
|
|
43
|
+
font-size: 0.75em;
|
|
44
|
+
line-height: 0;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
.ai-chat-messages .ai-chat-citation-list {
|
|
48
|
+
margin: 0.75rem 0 0;
|
|
49
|
+
padding-left: 1.25rem;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
.ai-chat-messages .ai-chat-citation-item + .ai-chat-citation-item {
|
|
53
|
+
margin-top: 0.25rem;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
.ai-chat-messages .ai-chat-citation-item a {
|
|
57
|
+
word-break: break-word;
|
|
58
|
+
}
|
|
59
|
+
|
|
42
60
|
.ai-partial-transcript {
|
|
43
61
|
font-style: italic;
|
|
44
62
|
opacity: 0.7;
|
package/dist/ai-chat.css.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["ai-chat.css"],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA","file":"ai-chat.css","sourcesContent":[".ai-chat-msg-role {\n font-size: 1.25rem;\n font-weight: 600;\n text-transform: uppercase;\n letter-spacing: 0.03em;\n margin-bottom: 0.35rem;\n}\n\n.ai-chat-msg-role-user {\n color: var(--bs-primary, #0d6efd);\n}\n\n.ai-chat-msg-role-assistant {\n color: var(--ai-chat-primary, #198754);\n}\n\n.ai-chat-messages .ai-chat-message-item {\n position: relative;\n padding: 0.25rem 0;\n}\n\n.ai-chat-messages .ai-chat-message-item + .ai-chat-message-item::before {\n content: '';\n display: block;\n width: 100%;\n margin: 0.5rem auto 0.75rem;\n border-top: 1px solid var(--bs-border-color, #dee2e6);\n}\n\n.ai-chat-messages .ai-chat-message-item p:last-child {\n margin-bottom: 0;\n}\n\n.ai-chat-messages .ai-chat-message-body {\n position: relative;\n padding: 0;\n overflow-wrap: break-word;\n word-break: break-word;\n min-width: 0;\n}\n\n.ai-partial-transcript {\n font-style: italic;\n opacity: 0.7;\n}\n\n.ai-chat-messages .message-buttons-container {\n position: absolute;\n right: 0.1rem;\n bottom: 0;\n display: inline-flex;\n align-items: center;\n gap: 0.35rem;\n width: auto;\n max-width: max-content;\n opacity: 0;\n pointer-events: none;\n transition: opacity 0.15s ease-in-out;\n background: rgba(255, 255, 255, 0.96);\n padding: 0.2rem 0.35rem;\n border-radius: 999px;\n box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);\n margin-bottom: 1rem;\n transform: translateY(50%);\n z-index: 1;\n}\n\n.ai-chat-messages .ai-chat-message-item:hover .message-buttons-container,\n.ai-chat-messages .ai-chat-message-item:focus-within .message-buttons-container {\n opacity: 1;\n pointer-events: auto;\n}\n\n.ai-chat-messages .message-buttons-container:has(.tts-playing) {\n opacity: 1;\n pointer-events: auto;\n}\n\n.ai-chat-messages .message-buttons-container > .button-message-toolbox {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n flex: 0 0 auto;\n width: 1.75rem;\n height: 1.75rem;\n margin: 0 !important;\n padding: 0 !important;\n border-radius: 50%;\n color: var(--bs-secondary-color, #6c757d) !important;\n text-decoration: none;\n}\n\n.ai-chat-messages .message-buttons-container .ai-chat-message-assistant-feedback {\n display: inline-flex;\n align-items: center;\n gap: 0.35rem;\n}\n\n.ai-chat-messages .message-buttons-container > .button-message-toolbox:hover,\n.ai-chat-messages .message-buttons-container > .button-message-toolbox:focus {\n color: var(--bs-body-color, #212529) !important;\n}\n\n.ai-chat-messages .message-buttons-container .tts-playing {\n color: var(--ai-chat-primary, #198754);\n}\n\n@keyframes spark-burst {\n 0% {\n transform: scale(1);\n opacity: 1;\n }\n 20% {\n transform: scale(1.8);\n opacity: 0.7;\n }\n 40% {\n transform: scale(0.9);\n opacity: 1;\n }\n 60% {\n transform: scale(1.3);\n }\n 100% {\n transform: scale(1);\n }\n}\n\n.spark-effect i,\n.spark-effect svg {\n display: inline-block;\n animation: spark-burst 0.5s ease-out;\n}\n\n.ai-chat-messages .ai-bot-icon {\n color: currentColor;\n display: inline-block;\n animation: none;\n}\n\n@keyframes ai-chat-streaming-effect {\n 0% { opacity: 1; transform: rotate(0deg); }\n 10% { opacity: 0.3; transform: rotate(0deg); }\n 20% { opacity: 1; transform: rotate(0deg); }\n 30% { opacity: 0.3; transform: rotate(0deg); }\n 40% { opacity: 1; transform: rotate(0deg); }\n 50% { opacity: 0.3; transform: rotate(0deg); }\n 60% { opacity: 1; transform: rotate(0deg); }\n 80% { opacity: 1; transform: rotate(360deg); }\n 100% { opacity: 1; transform: rotate(360deg); }\n}\n\n.ai-chat-messages .ai-streaming-icon {\n color: currentColor;\n display: inline-block;\n animation: ai-chat-streaming-effect 4s ease-in-out infinite;\n}\n\n.ai-chat-messages pre {\n position: relative;\n margin: 0;\n}\n\n.ai-chat-messages .ai-code-block {\n border: 1px solid var(--bs-border-color, #dee2e6);\n border-radius: 0.5rem;\n overflow: hidden;\n margin: 0.75rem 0;\n background: var(--bs-body-bg, #fff);\n}\n\n.ai-chat-messages .ai-code-header {\n display: flex;\n align-items: center;\n justify-content: space-between;\n padding: 0.5rem 1rem;\n font-size: 0.8rem;\n min-height: 2rem;\n}\n\n.ai-chat-messages .ai-code-lang {\n font-weight: 600;\n color: var(--bs-body-color, #212529);\n text-transform: capitalize;\n}\n\n.ai-chat-messages .ai-code-lang i {\n color: var(--bs-secondary-color, #6c757d);\n margin-right: 0.25rem;\n}\n\n.ai-chat-messages .ai-code-copy-btn {\n display: inline-flex;\n align-items: center;\n gap: 0.3rem;\n padding: 0.2rem;\n font-size: 0.8rem;\n background: transparent;\n border: none;\n cursor: pointer;\n color: var(--bs-secondary-color, #6c757d);\n transition: color 0.15s;\n white-space: nowrap;\n}\n\n.ai-chat-messages .ai-code-copy-btn:hover {\n color: var(--bs-body-color, #212529);\n}\n\n.ai-chat-messages .ai-code-block pre {\n margin: 0;\n background: transparent !important;\n}\n\n.ai-chat-messages .ai-code-block pre code.hljs {\n background: transparent !important;\n padding: 0.75rem 1rem 1rem;\n}\n\n.ai-chat-messages pre code.hljs {\n white-space: pre-wrap;\n word-wrap: break-word;\n overflow-wrap: break-word;\n border-radius: 0.375rem;\n}\n\n.ai-chat-doc-bar {\n border-bottom: 1px solid var(--bs-border-color, #dee2e6);\n}\n\n.ai-chat-drag-over {\n outline: 2px dashed var(--bs-primary, #0d6efd) !important;\n outline-offset: -2px;\n background-color: rgba(13, 110, 253, 0.05) !important;\n}\n\n.ai-chat-notification {\n margin: 0.75rem 0 0.25rem;\n padding: 0.625rem 0.875rem;\n border-radius: 0.5rem;\n border: 1px solid var(--bs-border-color, #dee2e6);\n background-color: var(--bs-light, #f8f9fa);\n font-size: 0.875rem;\n line-height: 1.4;\n}\n\n.ai-chat-notification-content {\n display: flex;\n align-items: center;\n gap: 0.5rem;\n}\n\n.ai-chat-notification-icon {\n flex-shrink: 0;\n font-size: 1rem;\n opacity: 0.8;\n}\n\n.ai-chat-notification-text {\n flex: 1;\n}\n\n.ai-chat-notification-dismiss {\n flex-shrink: 0;\n opacity: 0.5;\n transition: opacity 0.15s;\n}\n\n.ai-chat-notification-dismiss:hover {\n opacity: 1;\n}\n\n.ai-chat-notification-actions {\n display: flex;\n gap: 0.375rem;\n margin-top: 0.5rem;\n padding-top: 0.5rem;\n border-top: 1px solid var(--bs-border-color, #dee2e6);\n}\n\n.ai-chat-notification-actions .btn {\n font-size: 0.8125rem;\n padding: 0.1875rem 0.625rem;\n}\n\n.ai-chat-notification-typing {\n border-color: var(--ai-chat-primary, #198754);\n background-color: rgba(25, 135, 84, 0.05);\n}\n\n.ai-chat-notification-typing .ai-chat-notification-icon {\n color: var(--ai-chat-primary, #198754);\n animation: ai-chat-typing-pulse 1.5s ease-in-out infinite;\n}\n\n@keyframes ai-chat-typing-pulse {\n 0%, 100% { opacity: 0.4; }\n 50% { opacity: 1; }\n}\n\n.ai-chat-notification-transfer {\n border-color: var(--bs-warning, #ffc107);\n background-color: rgba(255, 193, 7, 0.06);\n}\n\n.ai-chat-notification-transfer .ai-chat-notification-icon {\n color: var(--bs-warning, #ffc107);\n animation: ai-chat-transfer-pulse 2s ease-in-out infinite;\n}\n\n@keyframes ai-chat-transfer-pulse {\n 0%, 100% { transform: scale(1); opacity: 0.7; }\n 50% { transform: scale(1.1); opacity: 1; }\n}\n\n.ai-chat-notification-ended,\n.ai-chat-notification-session-ended,\n.ai-chat-notification-conversation-ended {\n border-color: var(--bs-secondary, #6c757d);\n background-color: rgba(108, 117, 125, 0.05);\n}\n\n.ai-chat-notification-ended .ai-chat-notification-icon,\n.ai-chat-notification-session-ended .ai-chat-notification-icon,\n.ai-chat-notification-conversation-ended .ai-chat-notification-icon {\n color: var(--bs-secondary, #6c757d);\n}\n\n.ai-chat-notification-info,\n.ai-chat-notification-agent-connected {\n border-color: var(--bs-info, #0dcaf0);\n background-color: rgba(13, 202, 240, 0.05);\n}\n\n.ai-chat-notification-info .ai-chat-notification-icon,\n.ai-chat-notification-agent-connected .ai-chat-notification-icon {\n color: var(--bs-info, #0dcaf0);\n}\n\n.ai-chat-notification-warning,\n.ai-chat-notification-agent-reconnecting {\n border-color: var(--bs-warning, #ffc107);\n background-color: rgba(255, 193, 7, 0.06);\n}\n\n.ai-chat-notification-warning .ai-chat-notification-icon,\n.ai-chat-notification-agent-reconnecting .ai-chat-notification-icon {\n color: var(--bs-warning, #ffc107);\n}\n\n.ai-chat-notification-error,\n.ai-chat-notification-connection-lost {\n border-color: var(--bs-danger, #dc3545);\n background-color: rgba(220, 53, 69, 0.05);\n}\n\n.ai-chat-notification-error .ai-chat-notification-icon,\n.ai-chat-notification-connection-lost .ai-chat-notification-icon {\n color: var(--bs-danger, #dc3545);\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["ai-chat.css"],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA","file":"ai-chat.css","sourcesContent":[".ai-chat-msg-role {\n font-size: 1.25rem;\n font-weight: 600;\n text-transform: uppercase;\n letter-spacing: 0.03em;\n margin-bottom: 0.35rem;\n}\n\n.ai-chat-msg-role-user {\n color: var(--bs-primary, #0d6efd);\n}\n\n.ai-chat-msg-role-assistant {\n color: var(--ai-chat-primary, #198754);\n}\n\n.ai-chat-messages .ai-chat-message-item {\n position: relative;\n padding: 0.25rem 0;\n}\n\n.ai-chat-messages .ai-chat-message-item + .ai-chat-message-item::before {\n content: '';\n display: block;\n width: 100%;\n margin: 0.5rem auto 0.75rem;\n border-top: 1px solid var(--bs-border-color, #dee2e6);\n}\n\n.ai-chat-messages .ai-chat-message-item p:last-child {\n margin-bottom: 0;\n}\n\n.ai-chat-messages .ai-chat-message-body {\n position: relative;\n padding: 0;\n overflow-wrap: break-word;\n word-break: break-word;\n min-width: 0;\n}\n\n.ai-chat-messages .ai-chat-message-body sup {\n font-size: 0.75em;\n line-height: 0;\n}\n\n.ai-chat-messages .ai-chat-citation-list {\n margin: 0.75rem 0 0;\n padding-left: 1.25rem;\n}\n\n.ai-chat-messages .ai-chat-citation-item + .ai-chat-citation-item {\n margin-top: 0.25rem;\n}\n\n.ai-chat-messages .ai-chat-citation-item a {\n word-break: break-word;\n}\n\n.ai-partial-transcript {\n font-style: italic;\n opacity: 0.7;\n}\n\n.ai-chat-messages .message-buttons-container {\n position: absolute;\n right: 0.1rem;\n bottom: 0;\n display: inline-flex;\n align-items: center;\n gap: 0.35rem;\n width: auto;\n max-width: max-content;\n opacity: 0;\n pointer-events: none;\n transition: opacity 0.15s ease-in-out;\n background: rgba(255, 255, 255, 0.96);\n padding: 0.2rem 0.35rem;\n border-radius: 999px;\n box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);\n margin-bottom: 1rem;\n transform: translateY(50%);\n z-index: 1;\n}\n\n.ai-chat-messages .ai-chat-message-item:hover .message-buttons-container,\n.ai-chat-messages .ai-chat-message-item:focus-within .message-buttons-container {\n opacity: 1;\n pointer-events: auto;\n}\n\n.ai-chat-messages .message-buttons-container:has(.tts-playing) {\n opacity: 1;\n pointer-events: auto;\n}\n\n.ai-chat-messages .message-buttons-container > .button-message-toolbox {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n flex: 0 0 auto;\n width: 1.75rem;\n height: 1.75rem;\n margin: 0 !important;\n padding: 0 !important;\n border-radius: 50%;\n color: var(--bs-secondary-color, #6c757d) !important;\n text-decoration: none;\n}\n\n.ai-chat-messages .message-buttons-container .ai-chat-message-assistant-feedback {\n display: inline-flex;\n align-items: center;\n gap: 0.35rem;\n}\n\n.ai-chat-messages .message-buttons-container > .button-message-toolbox:hover,\n.ai-chat-messages .message-buttons-container > .button-message-toolbox:focus {\n color: var(--bs-body-color, #212529) !important;\n}\n\n.ai-chat-messages .message-buttons-container .tts-playing {\n color: var(--ai-chat-primary, #198754);\n}\n\n@keyframes spark-burst {\n 0% {\n transform: scale(1);\n opacity: 1;\n }\n 20% {\n transform: scale(1.8);\n opacity: 0.7;\n }\n 40% {\n transform: scale(0.9);\n opacity: 1;\n }\n 60% {\n transform: scale(1.3);\n }\n 100% {\n transform: scale(1);\n }\n}\n\n.spark-effect i,\n.spark-effect svg {\n display: inline-block;\n animation: spark-burst 0.5s ease-out;\n}\n\n.ai-chat-messages .ai-bot-icon {\n color: currentColor;\n display: inline-block;\n animation: none;\n}\n\n@keyframes ai-chat-streaming-effect {\n 0% { opacity: 1; transform: rotate(0deg); }\n 10% { opacity: 0.3; transform: rotate(0deg); }\n 20% { opacity: 1; transform: rotate(0deg); }\n 30% { opacity: 0.3; transform: rotate(0deg); }\n 40% { opacity: 1; transform: rotate(0deg); }\n 50% { opacity: 0.3; transform: rotate(0deg); }\n 60% { opacity: 1; transform: rotate(0deg); }\n 80% { opacity: 1; transform: rotate(360deg); }\n 100% { opacity: 1; transform: rotate(360deg); }\n}\n\n.ai-chat-messages .ai-streaming-icon {\n color: currentColor;\n display: inline-block;\n animation: ai-chat-streaming-effect 4s ease-in-out infinite;\n}\n\n.ai-chat-messages pre {\n position: relative;\n margin: 0;\n}\n\n.ai-chat-messages .ai-code-block {\n border: 1px solid var(--bs-border-color, #dee2e6);\n border-radius: 0.5rem;\n overflow: hidden;\n margin: 0.75rem 0;\n background: var(--bs-body-bg, #fff);\n}\n\n.ai-chat-messages .ai-code-header {\n display: flex;\n align-items: center;\n justify-content: space-between;\n padding: 0.5rem 1rem;\n font-size: 0.8rem;\n min-height: 2rem;\n}\n\n.ai-chat-messages .ai-code-lang {\n font-weight: 600;\n color: var(--bs-body-color, #212529);\n text-transform: capitalize;\n}\n\n.ai-chat-messages .ai-code-lang i {\n color: var(--bs-secondary-color, #6c757d);\n margin-right: 0.25rem;\n}\n\n.ai-chat-messages .ai-code-copy-btn {\n display: inline-flex;\n align-items: center;\n gap: 0.3rem;\n padding: 0.2rem;\n font-size: 0.8rem;\n background: transparent;\n border: none;\n cursor: pointer;\n color: var(--bs-secondary-color, #6c757d);\n transition: color 0.15s;\n white-space: nowrap;\n}\n\n.ai-chat-messages .ai-code-copy-btn:hover {\n color: var(--bs-body-color, #212529);\n}\n\n.ai-chat-messages .ai-code-block pre {\n margin: 0;\n background: transparent !important;\n}\n\n.ai-chat-messages .ai-code-block pre code.hljs {\n background: transparent !important;\n padding: 0.75rem 1rem 1rem;\n}\n\n.ai-chat-messages pre code.hljs {\n white-space: pre-wrap;\n word-wrap: break-word;\n overflow-wrap: break-word;\n border-radius: 0.375rem;\n}\n\n.ai-chat-doc-bar {\n border-bottom: 1px solid var(--bs-border-color, #dee2e6);\n}\n\n.ai-chat-drag-over {\n outline: 2px dashed var(--bs-primary, #0d6efd) !important;\n outline-offset: -2px;\n background-color: rgba(13, 110, 253, 0.05) !important;\n}\n\n.ai-chat-notification {\n margin: 0.75rem 0 0.25rem;\n padding: 0.625rem 0.875rem;\n border-radius: 0.5rem;\n border: 1px solid var(--bs-border-color, #dee2e6);\n background-color: var(--bs-light, #f8f9fa);\n font-size: 0.875rem;\n line-height: 1.4;\n}\n\n.ai-chat-notification-content {\n display: flex;\n align-items: center;\n gap: 0.5rem;\n}\n\n.ai-chat-notification-icon {\n flex-shrink: 0;\n font-size: 1rem;\n opacity: 0.8;\n}\n\n.ai-chat-notification-text {\n flex: 1;\n}\n\n.ai-chat-notification-dismiss {\n flex-shrink: 0;\n opacity: 0.5;\n transition: opacity 0.15s;\n}\n\n.ai-chat-notification-dismiss:hover {\n opacity: 1;\n}\n\n.ai-chat-notification-actions {\n display: flex;\n gap: 0.375rem;\n margin-top: 0.5rem;\n padding-top: 0.5rem;\n border-top: 1px solid var(--bs-border-color, #dee2e6);\n}\n\n.ai-chat-notification-actions .btn {\n font-size: 0.8125rem;\n padding: 0.1875rem 0.625rem;\n}\n\n.ai-chat-notification-typing {\n border-color: var(--ai-chat-primary, #198754);\n background-color: rgba(25, 135, 84, 0.05);\n}\n\n.ai-chat-notification-typing .ai-chat-notification-icon {\n color: var(--ai-chat-primary, #198754);\n animation: ai-chat-typing-pulse 1.5s ease-in-out infinite;\n}\n\n@keyframes ai-chat-typing-pulse {\n 0%, 100% { opacity: 0.4; }\n 50% { opacity: 1; }\n}\n\n.ai-chat-notification-transfer {\n border-color: var(--bs-warning, #ffc107);\n background-color: rgba(255, 193, 7, 0.06);\n}\n\n.ai-chat-notification-transfer .ai-chat-notification-icon {\n color: var(--bs-warning, #ffc107);\n animation: ai-chat-transfer-pulse 2s ease-in-out infinite;\n}\n\n@keyframes ai-chat-transfer-pulse {\n 0%, 100% { transform: scale(1); opacity: 0.7; }\n 50% { transform: scale(1.1); opacity: 1; }\n}\n\n.ai-chat-notification-ended,\n.ai-chat-notification-session-ended,\n.ai-chat-notification-conversation-ended {\n border-color: var(--bs-secondary, #6c757d);\n background-color: rgba(108, 117, 125, 0.05);\n}\n\n.ai-chat-notification-ended .ai-chat-notification-icon,\n.ai-chat-notification-session-ended .ai-chat-notification-icon,\n.ai-chat-notification-conversation-ended .ai-chat-notification-icon {\n color: var(--bs-secondary, #6c757d);\n}\n\n.ai-chat-notification-info,\n.ai-chat-notification-agent-connected {\n border-color: var(--bs-info, #0dcaf0);\n background-color: rgba(13, 202, 240, 0.05);\n}\n\n.ai-chat-notification-info .ai-chat-notification-icon,\n.ai-chat-notification-agent-connected .ai-chat-notification-icon {\n color: var(--bs-info, #0dcaf0);\n}\n\n.ai-chat-notification-warning,\n.ai-chat-notification-agent-reconnecting {\n border-color: var(--bs-warning, #ffc107);\n background-color: rgba(255, 193, 7, 0.06);\n}\n\n.ai-chat-notification-warning .ai-chat-notification-icon,\n.ai-chat-notification-agent-reconnecting .ai-chat-notification-icon {\n color: var(--bs-warning, #ffc107);\n}\n\n.ai-chat-notification-error,\n.ai-chat-notification-connection-lost {\n border-color: var(--bs-danger, #dc3545);\n background-color: rgba(220, 53, 69, 0.05);\n}\n\n.ai-chat-notification-error .ai-chat-notification-icon,\n.ai-chat-notification-connection-lost .ai-chat-notification-icon {\n color: var(--bs-danger, #dc3545);\n}\n"]}
|
package/dist/ai-chat.js
CHANGED
|
@@ -3,15 +3,18 @@
|
|
|
3
3
|
** Any changes made directly to this file will be overwritten next time its asset group is processed by Gulp.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
+
var _excluded = ["placeholder"];
|
|
6
7
|
function _regenerator() { /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */ var e, t, r = "function" == typeof Symbol ? Symbol : {}, n = r.iterator || "@@iterator", o = r.toStringTag || "@@toStringTag"; function i(r, n, o, i) { var c = n && n.prototype instanceof Generator ? n : Generator, u = Object.create(c.prototype); return _regeneratorDefine2(u, "_invoke", function (r, n, o) { var i, c, u, f = 0, p = o || [], y = !1, G = { p: 0, n: 0, v: e, a: d, f: d.bind(e, 4), d: function d(t, r) { return i = t, c = 0, u = e, G.n = r, a; } }; function d(r, n) { for (c = r, u = n, t = 0; !y && f && !o && t < p.length; t++) { var o, i = p[t], d = G.p, l = i[2]; r > 3 ? (o = l === n) && (u = i[(c = i[4]) ? 5 : (c = 3, 3)], i[4] = i[5] = e) : i[0] <= d && ((o = r < 2 && d < i[1]) ? (c = 0, G.v = n, G.n = i[1]) : d < l && (o = r < 3 || i[0] > n || n > l) && (i[4] = r, i[5] = n, G.n = l, c = 0)); } if (o || r > 1) return a; throw y = !0, n; } return function (o, p, l) { if (f > 1) throw TypeError("Generator is already running"); for (y && 1 === p && d(p, l), c = p, u = l; (t = c < 2 ? e : u) || !y;) { i || (c ? c < 3 ? (c > 1 && (G.n = -1), d(c, u)) : G.n = u : G.v = u); try { if (f = 2, i) { if (c || (o = "next"), t = i[o]) { if (!(t = t.call(i, u))) throw TypeError("iterator result is not an object"); if (!t.done) return t; u = t.value, c < 2 && (c = 0); } else 1 === c && (t = i["return"]) && t.call(i), c < 2 && (u = TypeError("The iterator does not provide a '" + o + "' method"), c = 1); i = e; } else if ((t = (y = G.n < 0) ? u : r.call(n, G)) !== a) break; } catch (t) { i = e, c = 1, u = t; } finally { f = 1; } } return { value: t, done: y }; }; }(r, o, i), !0), u; } var a = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} t = Object.getPrototypeOf; var c = [][n] ? t(t([][n]())) : (_regeneratorDefine2(t = {}, n, function () { return this; }), t), u = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(c); function f(e) { return Object.setPrototypeOf ? Object.setPrototypeOf(e, GeneratorFunctionPrototype) : (e.__proto__ = GeneratorFunctionPrototype, _regeneratorDefine2(e, o, "GeneratorFunction")), e.prototype = Object.create(u), e; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, _regeneratorDefine2(u, "constructor", GeneratorFunctionPrototype), _regeneratorDefine2(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = "GeneratorFunction", _regeneratorDefine2(GeneratorFunctionPrototype, o, "GeneratorFunction"), _regeneratorDefine2(u), _regeneratorDefine2(u, o, "Generator"), _regeneratorDefine2(u, n, function () { return this; }), _regeneratorDefine2(u, "toString", function () { return "[object Generator]"; }), (_regenerator = function _regenerator() { return { w: i, m: f }; })(); }
|
|
7
8
|
function _regeneratorDefine2(e, r, n, t) { var i = Object.defineProperty; try { i({}, "", {}); } catch (e) { i = 0; } _regeneratorDefine2 = function _regeneratorDefine(e, r, n, t) { function o(r, n) { _regeneratorDefine2(e, r, function (e) { return this._invoke(r, n, e); }); } r ? i ? i(e, r, { value: n, enumerable: !t, configurable: !t, writable: !t }) : e[r] = n : (o("next", 0), o("throw", 1), o("return", 2)); }, _regeneratorDefine2(e, r, n, t); }
|
|
8
9
|
function asyncGeneratorStep(n, t, e, r, o, a, c) { try { var i = n[a](c), u = i.value; } catch (n) { return void e(n); } i.done ? t(u) : Promise.resolve(u).then(r, o); }
|
|
9
10
|
function _asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { asyncGeneratorStep(a, r, o, _next, _throw, "next", n); } function _throw(n) { asyncGeneratorStep(a, r, o, _next, _throw, "throw", n); } _next(void 0); }); }; }
|
|
10
|
-
function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t["return"] || t["return"](); } finally { if (u) throw o; } } }; }
|
|
11
11
|
function _toConsumableArray(r) { return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread(); }
|
|
12
12
|
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
13
13
|
function _iterableToArray(r) { if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); }
|
|
14
14
|
function _arrayWithoutHoles(r) { if (Array.isArray(r)) return _arrayLikeToArray(r); }
|
|
15
|
+
function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
|
|
16
|
+
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
|
|
17
|
+
function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t["return"] || t["return"](); } finally { if (u) throw o; } } }; }
|
|
15
18
|
function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
|
|
16
19
|
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
17
20
|
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
@@ -52,7 +55,7 @@ window.openAIChatManager = function () {
|
|
|
52
55
|
minWidth: 320,
|
|
53
56
|
minHeight: 420
|
|
54
57
|
},
|
|
55
|
-
messageTemplate: "\n <div class=\"ai-chat-messages\">\n <div v-for=\"(message, index) in messages\" :key=\"'msg-' + index\" class=\"ai-chat-message-item\">\n <div>\n <div v-if=\"message.role === 'user'\" class=\"ai-chat-msg-role ai-chat-msg-role-user\">{{ userLabel }}</div>\n <div v-else-if=\"message.role !== 'indicator'\" :class=\"getAssistantRoleClasses(message)\">\n <span :class=\"getAssistantIconClasses(message, index)\"><span :class=\"getAssistantIcon(message)\"></span></span>\n {{ getAssistantLabel(message) }}\n </div>\n <div class=\"ai-chat-message-body lh-base\">\n <h4 v-if=\"message.title\">{{ message.title }}</h4>\n <div v-html=\"message.htmlContent\"></div>\n <span class=\"message-buttons-container\" v-if=\"!isIndicator(message)\">\n <template v-if=\"metricsEnabled && message.role === 'assistant'\">\n <span class=\"ai-chat-message-assistant-feedback\" :data-message-id=\"message.id\">\n <button class=\"btn btn-sm btn-link text-success p-0 me-2 button-message-toolbox rate-up-btn\" @click=\"rateMessage(message, true, $event)\" :title=\"thumbsUpTitle\">\n <span class=\"fa-regular fa-thumbs-up\"></span>\n </button>\n <button class=\"btn btn-sm btn-link text-danger p-0 me-2 button-message-toolbox rate-down-btn\" @click=\"rateMessage(message, false, $event)\" :title=\"thumbsDownTitle\">\n <span class=\"fa-regular fa-thumbs-down\"></span>\n </button>\n </span>\n </template>\n <button v-if=\"textToSpeechEnabled && !isConversationMode && message.role === 'assistant' && !message.isStreaming\" class=\"btn btn-sm btn-link text-secondary p-0 me-1 button-message-toolbox\" :class=\"{ 'tts-playing': ttsPlayingMessageIndex === index }\" :data-tts-message-index=\"index\" @click=\"toggleMessageTts(message, index)\" :title=\"ttsPlayingMessageIndex === index ? 'Pause audio' : 'Read aloud'\">\n <span :class=\"ttsPlayingMessageIndex === index ? 'fa-solid fa-circle-pause' : 'fa-solid fa-circle-play'\"></span>\n </button>\n <button class=\"btn btn-sm btn-link text-secondary p-0 button-message-toolbox\" @click=\"copyResponse(message
|
|
58
|
+
messageTemplate: "\n <div class=\"ai-chat-messages\">\n <div v-for=\"(message, index) in messages\" :key=\"'msg-' + index\" class=\"ai-chat-message-item\">\n <div>\n <div v-if=\"message.role === 'user'\" class=\"ai-chat-msg-role ai-chat-msg-role-user\">{{ userLabel }}</div>\n <div v-else-if=\"message.role !== 'indicator'\" :class=\"getAssistantRoleClasses(message)\">\n <span :class=\"getAssistantIconClasses(message, index)\"><span :class=\"getAssistantIcon(message)\"></span></span>\n {{ getAssistantLabel(message) }}\n </div>\n <div class=\"ai-chat-message-body lh-base\">\n <h4 v-if=\"message.title\">{{ message.title }}</h4>\n <div v-html=\"message.htmlContent\"></div>\n <ol v-if=\"message.citationReferences && message.citationReferences.length\" class=\"ai-chat-citation-list\">\n <li v-for=\"citation in message.citationReferences\" :key=\"'citation-' + (citation.referenceKey || citation.displayIndex)\" class=\"ai-chat-citation-item\">\n <a v-if=\"citation.link\" :href=\"citation.link\" :target=\"citation.isDownload ? null : '_blank'\" :rel=\"citation.isDownload ? null : 'noopener noreferrer'\">{{ citation.label }}</a>\n <span v-else>{{ citation.label }}</span>\n </li>\n </ol>\n <span class=\"message-buttons-container\" v-if=\"!isIndicator(message)\">\n <template v-if=\"metricsEnabled && message.role === 'assistant'\">\n <span class=\"ai-chat-message-assistant-feedback\" :data-message-id=\"message.id\">\n <button class=\"btn btn-sm btn-link text-success p-0 me-2 button-message-toolbox rate-up-btn\" @click=\"rateMessage(message, true, $event)\" :title=\"thumbsUpTitle\">\n <span class=\"fa-regular fa-thumbs-up\"></span>\n </button>\n <button class=\"btn btn-sm btn-link text-danger p-0 me-2 button-message-toolbox rate-down-btn\" @click=\"rateMessage(message, false, $event)\" :title=\"thumbsDownTitle\">\n <span class=\"fa-regular fa-thumbs-down\"></span>\n </button>\n </span>\n </template>\n <button v-if=\"textToSpeechEnabled && !isConversationMode && message.role === 'assistant' && !message.isStreaming\" class=\"btn btn-sm btn-link text-secondary p-0 me-1 button-message-toolbox\" :class=\"{ 'tts-playing': ttsPlayingMessageIndex === index }\" :data-tts-message-index=\"index\" @click=\"toggleMessageTts(message, index)\" :title=\"ttsPlayingMessageIndex === index ? 'Pause audio' : 'Read aloud'\">\n <span :class=\"ttsPlayingMessageIndex === index ? 'fa-solid fa-circle-pause' : 'fa-solid fa-circle-play'\"></span>\n </button>\n <button class=\"btn btn-sm btn-link text-secondary p-0 button-message-toolbox\" @click=\"copyResponse(message)\" :title=\"copyTitle\">\n <span class=\"fa-solid fa-copy\"></span>\n </button>\n </span>\n </div>\n </div>\n </div>\n <div v-for=\"notification in notifications\" :key=\"'notif-' + notification.type\" class=\"ai-chat-notification\" :class=\"'ai-chat-notification-' + (notification.type || 'info') + ' ' + (notification.cssClass || '')\">\n <div class=\"ai-chat-notification-content\">\n <span v-if=\"notification.icon\" :class=\"notification.icon\" class=\"ai-chat-notification-icon\"></span>\n <span class=\"ai-chat-notification-text\">{{ notification.content }}</span>\n <button v-if=\"notification.dismissible\" class=\"btn btn-sm btn-link p-0 ms-2 ai-chat-notification-dismiss\" @click=\"dismissNotification(notification.type)\" title=\"Dismiss\">\n <span class=\"fa-solid fa-xmark\"></span>\n </button>\n </div>\n <div v-if=\"notification.actions && notification.actions.length\" class=\"ai-chat-notification-actions\">\n <button v-for=\"action in notification.actions\" :key=\"action.name\" class=\"btn btn-sm\" :class=\"action.cssClass || 'btn-outline-secondary'\" @click=\"handleNotificationAction(notification.type, action.name)\">\n <span v-if=\"action.icon\" :class=\"action.icon\" class=\"me-1\"></span>\n {{ action.label }}\n </button>\n </div>\n </div>\n </div>\n ",
|
|
56
59
|
indicatorTemplate: "\n <div class=\"ai-chat-msg-role ai-chat-msg-role-assistant\">\n <span class=\"ai-streaming-icon\"><span class=\"fa fa-robot\" style=\"display: inline-block;\"></span></span>\n Assistant\n </div>\n "
|
|
57
60
|
};
|
|
58
61
|
|
|
@@ -86,16 +89,30 @@ window.openAIChatManager = function () {
|
|
|
86
89
|
return Math.min(Math.max(value, min), max);
|
|
87
90
|
}
|
|
88
91
|
function normalizeReference(reference) {
|
|
89
|
-
var _ref, _normalized$index, _ref2, _normalized$text, _ref3, _normalized$link;
|
|
92
|
+
var _ref, _normalized$index, _ref2, _normalized$text, _ref3, _normalized$title, _ref4, _normalized$link, _ref5, _normalized$reference;
|
|
90
93
|
if (!reference || _typeof(reference) !== 'object') {
|
|
91
94
|
return null;
|
|
92
95
|
}
|
|
93
96
|
var normalized = Object.assign({}, reference);
|
|
94
97
|
normalized.index = (_ref = (_normalized$index = normalized.index) !== null && _normalized$index !== void 0 ? _normalized$index : normalized.Index) !== null && _ref !== void 0 ? _ref : 0;
|
|
95
98
|
normalized.text = (_ref2 = (_normalized$text = normalized.text) !== null && _normalized$text !== void 0 ? _normalized$text : normalized.Text) !== null && _ref2 !== void 0 ? _ref2 : null;
|
|
96
|
-
normalized.
|
|
99
|
+
normalized.title = (_ref3 = (_normalized$title = normalized.title) !== null && _normalized$title !== void 0 ? _normalized$title : normalized.Title) !== null && _ref3 !== void 0 ? _ref3 : null;
|
|
100
|
+
normalized.link = sanitizeUrl((_ref4 = (_normalized$link = normalized.link) !== null && _normalized$link !== void 0 ? _normalized$link : normalized.Link) !== null && _ref4 !== void 0 ? _ref4 : null);
|
|
101
|
+
normalized.referenceType = (_ref5 = (_normalized$reference = normalized.referenceType) !== null && _normalized$reference !== void 0 ? _normalized$reference : normalized.ReferenceType) !== null && _ref5 !== void 0 ? _ref5 : null;
|
|
97
102
|
return normalized;
|
|
98
103
|
}
|
|
104
|
+
function isDownloadCitationReference(reference) {
|
|
105
|
+
if (!reference || _typeof(reference) !== 'object') {
|
|
106
|
+
return false;
|
|
107
|
+
}
|
|
108
|
+
if (typeof reference.referenceType === 'string' && reference.referenceType.toLowerCase() === 'document') {
|
|
109
|
+
return true;
|
|
110
|
+
}
|
|
111
|
+
if (typeof reference.link === 'string' && /\/ai\/documents\/.+\/download(?:$|\?)/i.test(reference.link)) {
|
|
112
|
+
return true;
|
|
113
|
+
}
|
|
114
|
+
return false;
|
|
115
|
+
}
|
|
99
116
|
function normalizeReferences(references) {
|
|
100
117
|
if (!references || _typeof(references) !== 'object') {
|
|
101
118
|
return {};
|
|
@@ -110,6 +127,125 @@ window.openAIChatManager = function () {
|
|
|
110
127
|
}
|
|
111
128
|
return normalized;
|
|
112
129
|
}
|
|
130
|
+
function getCitationLabel(reference, key) {
|
|
131
|
+
return reference.title || reference.text || key;
|
|
132
|
+
}
|
|
133
|
+
function buildCitationDisplay(content, references) {
|
|
134
|
+
var processedContent = (content || '').trim();
|
|
135
|
+
var messageReferences = normalizeReferences(references);
|
|
136
|
+
if (!processedContent || !Object.keys(messageReferences).length) {
|
|
137
|
+
return {
|
|
138
|
+
content: processedContent,
|
|
139
|
+
citations: []
|
|
140
|
+
};
|
|
141
|
+
}
|
|
142
|
+
var citedRefs = Object.entries(messageReferences).filter(function (_ref6) {
|
|
143
|
+
var _ref7 = _slicedToArray(_ref6, 1),
|
|
144
|
+
key = _ref7[0];
|
|
145
|
+
return processedContent.includes(key);
|
|
146
|
+
});
|
|
147
|
+
if (!citedRefs.length) {
|
|
148
|
+
return {
|
|
149
|
+
content: processedContent,
|
|
150
|
+
citations: []
|
|
151
|
+
};
|
|
152
|
+
}
|
|
153
|
+
citedRefs.sort(function (_ref8, _ref9) {
|
|
154
|
+
var _ref0 = _slicedToArray(_ref8, 2),
|
|
155
|
+
a = _ref0[1];
|
|
156
|
+
var _ref1 = _slicedToArray(_ref9, 2),
|
|
157
|
+
b = _ref1[1];
|
|
158
|
+
return a.index - b.index;
|
|
159
|
+
});
|
|
160
|
+
var citations = [];
|
|
161
|
+
var displayIndex = 1;
|
|
162
|
+
var _iterator = _createForOfIteratorHelper(citedRefs),
|
|
163
|
+
_step;
|
|
164
|
+
try {
|
|
165
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
166
|
+
var _step$value = _slicedToArray(_step.value, 2),
|
|
167
|
+
key = _step$value[0],
|
|
168
|
+
value = _step$value[1];
|
|
169
|
+
var placeholder = "__CITE_".concat(displayIndex, "_").concat(value.index || displayIndex, "__");
|
|
170
|
+
processedContent = processedContent.replaceAll(key, placeholder);
|
|
171
|
+
citations.push({
|
|
172
|
+
referenceKey: key,
|
|
173
|
+
displayIndex: displayIndex,
|
|
174
|
+
label: getCitationLabel(value, key),
|
|
175
|
+
link: value.link || null,
|
|
176
|
+
isDownload: isDownloadCitationReference(value),
|
|
177
|
+
placeholder: placeholder
|
|
178
|
+
});
|
|
179
|
+
displayIndex++;
|
|
180
|
+
}
|
|
181
|
+
} catch (err) {
|
|
182
|
+
_iterator.e(err);
|
|
183
|
+
} finally {
|
|
184
|
+
_iterator.f();
|
|
185
|
+
}
|
|
186
|
+
for (var _i2 = 0, _citations = citations; _i2 < _citations.length; _i2++) {
|
|
187
|
+
var citation = _citations[_i2];
|
|
188
|
+
processedContent = processedContent.replaceAll(citation.placeholder, "<sup>".concat(citation.displayIndex, "</sup>"));
|
|
189
|
+
}
|
|
190
|
+
processedContent = processedContent.replaceAll('</sup><sup>', '</sup><sup>,</sup><sup>');
|
|
191
|
+
return {
|
|
192
|
+
content: processedContent,
|
|
193
|
+
citations: citations.map(function (_ref10) {
|
|
194
|
+
var placeholder = _ref10.placeholder,
|
|
195
|
+
citation = _objectWithoutProperties(_ref10, _excluded);
|
|
196
|
+
return citation;
|
|
197
|
+
})
|
|
198
|
+
};
|
|
199
|
+
}
|
|
200
|
+
function buildCopyContent(content, citations) {
|
|
201
|
+
var copyContent = (content || '').trim();
|
|
202
|
+
if (!copyContent || !Array.isArray(citations) || citations.length === 0) {
|
|
203
|
+
return copyContent;
|
|
204
|
+
}
|
|
205
|
+
var _iterator2 = _createForOfIteratorHelper(citations),
|
|
206
|
+
_step2;
|
|
207
|
+
try {
|
|
208
|
+
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
209
|
+
var citation = _step2.value;
|
|
210
|
+
copyContent = copyContent.replaceAll(citation.referenceKey, "[".concat(citation.displayIndex, "]"));
|
|
211
|
+
}
|
|
212
|
+
} catch (err) {
|
|
213
|
+
_iterator2.e(err);
|
|
214
|
+
} finally {
|
|
215
|
+
_iterator2.f();
|
|
216
|
+
}
|
|
217
|
+
copyContent += '\n\nReferences:\n';
|
|
218
|
+
var _iterator3 = _createForOfIteratorHelper(citations),
|
|
219
|
+
_step3;
|
|
220
|
+
try {
|
|
221
|
+
for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
|
|
222
|
+
var _citation = _step3.value;
|
|
223
|
+
copyContent += "".concat(_citation.displayIndex, ". ").concat(_citation.label);
|
|
224
|
+
if (_citation.link) {
|
|
225
|
+
copyContent += " - ".concat(_citation.link);
|
|
226
|
+
}
|
|
227
|
+
copyContent += '\n';
|
|
228
|
+
}
|
|
229
|
+
} catch (err) {
|
|
230
|
+
_iterator3.e(err);
|
|
231
|
+
} finally {
|
|
232
|
+
_iterator3.f();
|
|
233
|
+
}
|
|
234
|
+
return copyContent.trimEnd();
|
|
235
|
+
}
|
|
236
|
+
function updateMessagePresentation(message, references) {
|
|
237
|
+
var messageReferences = normalizeReferences(references !== null && references !== void 0 ? references : message.references);
|
|
238
|
+
var rawContent = typeof message.rawContent === 'string' ? message.rawContent : typeof message.content === 'string' ? message.content : '';
|
|
239
|
+
var citationDisplay = buildCitationDisplay(rawContent, messageReferences);
|
|
240
|
+
message.rawContent = rawContent;
|
|
241
|
+
message.content = rawContent;
|
|
242
|
+
message.displayContent = citationDisplay.content;
|
|
243
|
+
message.references = messageReferences;
|
|
244
|
+
message.citationReferences = citationDisplay.citations;
|
|
245
|
+
message.copyContent = buildCopyContent(rawContent, citationDisplay.citations);
|
|
246
|
+
message.htmlContent = parseMarkdownContent(citationDisplay.content, message);
|
|
247
|
+
return message;
|
|
248
|
+
}
|
|
113
249
|
var renderer = new marked.Renderer();
|
|
114
250
|
|
|
115
251
|
// Modify the link rendering to open in a new tab
|
|
@@ -275,17 +411,17 @@ window.openAIChatManager = function () {
|
|
|
275
411
|
// Defer to requestAnimationFrame so the browser has fully laid out the
|
|
276
412
|
// canvas elements before Chart.js reads their dimensions.
|
|
277
413
|
requestAnimationFrame(function () {
|
|
278
|
-
var
|
|
279
|
-
|
|
414
|
+
var _iterator4 = _createForOfIteratorHelper(charts),
|
|
415
|
+
_step4;
|
|
280
416
|
try {
|
|
281
|
-
for (
|
|
282
|
-
var c =
|
|
417
|
+
for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
|
|
418
|
+
var c = _step4.value;
|
|
283
419
|
renderChartOnCanvas(c.chartId, c.config);
|
|
284
420
|
}
|
|
285
421
|
} catch (err) {
|
|
286
|
-
|
|
422
|
+
_iterator4.e(err);
|
|
287
423
|
} finally {
|
|
288
|
-
|
|
424
|
+
_iterator4.f();
|
|
289
425
|
}
|
|
290
426
|
});
|
|
291
427
|
}
|
|
@@ -338,8 +474,8 @@ window.openAIChatManager = function () {
|
|
|
338
474
|
return;
|
|
339
475
|
}
|
|
340
476
|
requestAnimationFrame(function () {
|
|
341
|
-
for (var
|
|
342
|
-
var chartId = _Object$keys[
|
|
477
|
+
for (var _i3 = 0, _Object$keys = Object.keys(configs); _i3 < _Object$keys.length; _i3++) {
|
|
478
|
+
var chartId = _Object$keys[_i3];
|
|
343
479
|
renderChartOnCanvas(chartId, configs[chartId]);
|
|
344
480
|
}
|
|
345
481
|
});
|
|
@@ -1034,7 +1170,7 @@ window.openAIChatManager = function () {
|
|
|
1034
1170
|
_this3.scrollToBottom();
|
|
1035
1171
|
}
|
|
1036
1172
|
});
|
|
1037
|
-
_this3.connection.on("ReceiveConversationAssistantToken", function (sessionId, messageId, token, responseId, appearance) {
|
|
1173
|
+
_this3.connection.on("ReceiveConversationAssistantToken", function (sessionId, messageId, token, responseId, references, appearance) {
|
|
1038
1174
|
if (!_this3._conversationAssistantMessage) {
|
|
1039
1175
|
_this3.stopAudio();
|
|
1040
1176
|
_this3.hideTypingIndicator();
|
|
@@ -1053,7 +1189,8 @@ window.openAIChatManager = function () {
|
|
|
1053
1189
|
htmlContent: "",
|
|
1054
1190
|
isStreaming: true,
|
|
1055
1191
|
userRating: null,
|
|
1056
|
-
appearance: _this3.normalizeAssistantAppearance(appearance)
|
|
1192
|
+
appearance: _this3.normalizeAssistantAppearance(appearance),
|
|
1193
|
+
references: {}
|
|
1057
1194
|
};
|
|
1058
1195
|
_this3.messages.push(newMessage);
|
|
1059
1196
|
_this3._conversationAssistantMessage = {
|
|
@@ -1067,19 +1204,22 @@ window.openAIChatManager = function () {
|
|
|
1067
1204
|
if (!msg.appearance) {
|
|
1068
1205
|
msg.appearance = _this3.normalizeAssistantAppearance(appearance);
|
|
1069
1206
|
}
|
|
1070
|
-
msg.
|
|
1071
|
-
msg.
|
|
1207
|
+
msg.rawContent = _this3._conversationAssistantMessage.content;
|
|
1208
|
+
msg.references = normalizeReferences(Object.assign({}, msg.references || {}, references || {}));
|
|
1209
|
+
updateMessagePresentation(msg, msg.references);
|
|
1072
1210
|
_this3.$nextTick(function () {
|
|
1073
1211
|
renderChartsInMessage(msg);
|
|
1074
1212
|
_this3.scrollToBottom();
|
|
1075
1213
|
});
|
|
1076
1214
|
}
|
|
1077
1215
|
});
|
|
1078
|
-
_this3.connection.on("ReceiveConversationAssistantComplete", function (sessionId, messageId) {
|
|
1216
|
+
_this3.connection.on("ReceiveConversationAssistantComplete", function (sessionId, messageId, references) {
|
|
1079
1217
|
if (_this3._conversationAssistantMessage) {
|
|
1080
1218
|
var msg = _this3.messages[_this3._conversationAssistantMessage.index];
|
|
1081
1219
|
if (msg) {
|
|
1082
1220
|
msg.isStreaming = false;
|
|
1221
|
+
msg.references = normalizeReferences(Object.assign({}, msg.references || {}, references || {}));
|
|
1222
|
+
updateMessagePresentation(msg, msg.references);
|
|
1083
1223
|
}
|
|
1084
1224
|
_this3._conversationAssistantMessage = null;
|
|
1085
1225
|
}
|
|
@@ -1170,82 +1310,9 @@ window.openAIChatManager = function () {
|
|
|
1170
1310
|
message.userRating = null;
|
|
1171
1311
|
}
|
|
1172
1312
|
if (message.content) {
|
|
1173
|
-
var
|
|
1174
|
-
message.
|
|
1175
|
-
|
|
1176
|
-
// Only include references that were actually cited in the response.
|
|
1177
|
-
var citedRefs = Object.entries(message.references).filter(function (_ref7) {
|
|
1178
|
-
var _ref8 = _slicedToArray(_ref7, 1),
|
|
1179
|
-
key = _ref8[0];
|
|
1180
|
-
return processedContent.includes(key);
|
|
1181
|
-
});
|
|
1182
|
-
if (citedRefs.length) {
|
|
1183
|
-
// Sort by original index so display indices follow a natural order.
|
|
1184
|
-
citedRefs.sort(function (_ref9, _ref0) {
|
|
1185
|
-
var _ref1 = _slicedToArray(_ref9, 2),
|
|
1186
|
-
a = _ref1[1];
|
|
1187
|
-
var _ref10 = _slicedToArray(_ref0, 2),
|
|
1188
|
-
b = _ref10[1];
|
|
1189
|
-
return a.index - b.index;
|
|
1190
|
-
});
|
|
1191
|
-
|
|
1192
|
-
// Phase 1: Replace all markers with unique placeholders.
|
|
1193
|
-
var displayIndex = 1;
|
|
1194
|
-
var _iterator2 = _createForOfIteratorHelper(citedRefs),
|
|
1195
|
-
_step2;
|
|
1196
|
-
try {
|
|
1197
|
-
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
1198
|
-
var _step2$value = _slicedToArray(_step2.value, 2),
|
|
1199
|
-
key = _step2$value[0],
|
|
1200
|
-
value = _step2$value[1];
|
|
1201
|
-
var placeholder = "__CITE_".concat(value.index, "__");
|
|
1202
|
-
processedContent = processedContent.replaceAll(key, placeholder);
|
|
1203
|
-
value._displayIndex = displayIndex++;
|
|
1204
|
-
value._placeholder = placeholder;
|
|
1205
|
-
}
|
|
1206
|
-
|
|
1207
|
-
// Phase 2: Replace placeholders with sequential display indices.
|
|
1208
|
-
} catch (err) {
|
|
1209
|
-
_iterator2.e(err);
|
|
1210
|
-
} finally {
|
|
1211
|
-
_iterator2.f();
|
|
1212
|
-
}
|
|
1213
|
-
var _iterator3 = _createForOfIteratorHelper(citedRefs),
|
|
1214
|
-
_step3;
|
|
1215
|
-
try {
|
|
1216
|
-
for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
|
|
1217
|
-
var _step3$value = _slicedToArray(_step3.value, 2),
|
|
1218
|
-
_value = _step3$value[1];
|
|
1219
|
-
processedContent = processedContent.replaceAll(_value._placeholder, "<sup><strong>".concat(_value._displayIndex, "</strong></sup>"));
|
|
1220
|
-
}
|
|
1221
|
-
|
|
1222
|
-
// if we have multiple references, add a comma to ensure we don't concatenate numbers.
|
|
1223
|
-
} catch (err) {
|
|
1224
|
-
_iterator3.e(err);
|
|
1225
|
-
} finally {
|
|
1226
|
-
_iterator3.f();
|
|
1227
|
-
}
|
|
1228
|
-
processedContent = processedContent.replaceAll('</strong></sup><sup>', '</strong></sup><sup>,</sup><sup>');
|
|
1229
|
-
processedContent += '<br><br>';
|
|
1230
|
-
var _iterator4 = _createForOfIteratorHelper(citedRefs),
|
|
1231
|
-
_step4;
|
|
1232
|
-
try {
|
|
1233
|
-
for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
|
|
1234
|
-
var _step4$value = _slicedToArray(_step4.value, 2),
|
|
1235
|
-
_key = _step4$value[0],
|
|
1236
|
-
_value2 = _step4$value[1];
|
|
1237
|
-
var label = _value2.text || _key;
|
|
1238
|
-
processedContent += _value2.link ? "**".concat(_value2._displayIndex, "**. [").concat(label, "](").concat(_value2.link, ")<br>") : "**".concat(_value2._displayIndex, "**. ").concat(label, "<br>");
|
|
1239
|
-
}
|
|
1240
|
-
} catch (err) {
|
|
1241
|
-
_iterator4.e(err);
|
|
1242
|
-
} finally {
|
|
1243
|
-
_iterator4.f();
|
|
1244
|
-
}
|
|
1245
|
-
}
|
|
1246
|
-
}
|
|
1247
|
-
message.content = processedContent;
|
|
1248
|
-
message.htmlContent = parseMarkdownContent(processedContent, message);
|
|
1313
|
+
var _message$rawContent;
|
|
1314
|
+
message.rawContent = (_message$rawContent = message.rawContent) !== null && _message$rawContent !== void 0 ? _message$rawContent : message.content;
|
|
1315
|
+
updateMessagePresentation(message, message.references);
|
|
1249
1316
|
}
|
|
1250
1317
|
this.addMessageInternal(message);
|
|
1251
1318
|
this.hidePlaceholder();
|
|
@@ -1471,9 +1538,9 @@ window.openAIChatManager = function () {
|
|
|
1471
1538
|
message.title = chunk.title;
|
|
1472
1539
|
}
|
|
1473
1540
|
if (chunk.references && _typeof(chunk.references) === "object" && Object.keys(chunk.references).length) {
|
|
1474
|
-
for (var
|
|
1541
|
+
for (var _i4 = 0, _Object$entries2 = Object.entries(chunk.references); _i4 < _Object$entries2.length; _i4++) {
|
|
1475
1542
|
var _normalizeReference2;
|
|
1476
|
-
var _Object$entries2$_i = _slicedToArray(_Object$entries2[
|
|
1543
|
+
var _Object$entries2$_i = _slicedToArray(_Object$entries2[_i4], 2),
|
|
1477
1544
|
key = _Object$entries2$_i[0],
|
|
1478
1545
|
value = _Object$entries2$_i[1];
|
|
1479
1546
|
references[key] = (_normalizeReference2 = normalizeReference(value)) !== null && _normalizeReference2 !== void 0 ? _normalizeReference2 : {};
|
|
@@ -1488,22 +1555,12 @@ window.openAIChatManager = function () {
|
|
|
1488
1555
|
if (chunk.responseId) {
|
|
1489
1556
|
lastResponseId = chunk.responseId;
|
|
1490
1557
|
}
|
|
1491
|
-
|
|
1492
|
-
for (var _i4 = 0, _Object$entries3 = Object.entries(references); _i4 < _Object$entries3.length; _i4++) {
|
|
1493
|
-
var _Object$entries3$_i = _slicedToArray(_Object$entries3[_i4], 2),
|
|
1494
|
-
_key2 = _Object$entries3$_i[0],
|
|
1495
|
-
_value3 = _Object$entries3$_i[1];
|
|
1496
|
-
processedContent = processedContent.replaceAll(_key2, "<sup><strong>".concat(_value3.index, "</strong></sup>"));
|
|
1497
|
-
}
|
|
1498
|
-
|
|
1499
|
-
// Append processed content to the message.
|
|
1500
|
-
// if we have multiple references, add a comma to ensure we don't concatenate numbers.
|
|
1501
|
-
content += processedContent.replaceAll('</strong></sup><sup>', '</strong></sup><sup>,</sup><sup>');
|
|
1558
|
+
content += chunk.content;
|
|
1502
1559
|
}
|
|
1503
1560
|
|
|
1504
1561
|
// Update the existing message
|
|
1505
|
-
message.
|
|
1506
|
-
message
|
|
1562
|
+
message.rawContent = content;
|
|
1563
|
+
updateMessagePresentation(message, references);
|
|
1507
1564
|
_this8.messages[messageIndex] = message;
|
|
1508
1565
|
_this8.$nextTick(function () {
|
|
1509
1566
|
renderChartsInMessage(message);
|
|
@@ -1560,85 +1617,10 @@ window.openAIChatManager = function () {
|
|
|
1560
1617
|
var _this9 = this;
|
|
1561
1618
|
references = normalizeReferences(references);
|
|
1562
1619
|
if (Object.keys(references).length) {
|
|
1620
|
+
var _ref15, _message$rawContent2;
|
|
1563
1621
|
var message = this.messages[messageIndex];
|
|
1564
|
-
|
|
1565
|
-
|
|
1566
|
-
// Only include references that were actually cited in the response.
|
|
1567
|
-
// Check both raw [doc:N] markers and already-rendered <sup> tags from streaming.
|
|
1568
|
-
var citedRefs = Object.entries(references).filter(function (_ref12) {
|
|
1569
|
-
var _ref13 = _slicedToArray(_ref12, 2),
|
|
1570
|
-
key = _ref13[0],
|
|
1571
|
-
value = _ref13[1];
|
|
1572
|
-
return content.includes(key) || content.includes("<sup><strong>".concat(value.index, "</strong></sup>"));
|
|
1573
|
-
});
|
|
1574
|
-
if (!citedRefs.length) {
|
|
1575
|
-
return;
|
|
1576
|
-
}
|
|
1577
|
-
|
|
1578
|
-
// Sort by original index so display indices follow a natural order.
|
|
1579
|
-
citedRefs.sort(function (_ref14, _ref15) {
|
|
1580
|
-
var _ref16 = _slicedToArray(_ref14, 2),
|
|
1581
|
-
a = _ref16[1];
|
|
1582
|
-
var _ref17 = _slicedToArray(_ref15, 2),
|
|
1583
|
-
b = _ref17[1];
|
|
1584
|
-
return a.index - b.index;
|
|
1585
|
-
});
|
|
1586
|
-
|
|
1587
|
-
// Phase 1: Replace all markers with unique placeholders to avoid collisions during remapping.
|
|
1588
|
-
var processed = content.trim();
|
|
1589
|
-
var displayIndex = 1;
|
|
1590
|
-
var _iterator5 = _createForOfIteratorHelper(citedRefs),
|
|
1591
|
-
_step5;
|
|
1592
|
-
try {
|
|
1593
|
-
for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) {
|
|
1594
|
-
var _step5$value = _slicedToArray(_step5.value, 2),
|
|
1595
|
-
key = _step5$value[0],
|
|
1596
|
-
value = _step5$value[1];
|
|
1597
|
-
var placeholder = "__CITE_".concat(value.index, "__");
|
|
1598
|
-
processed = processed.replaceAll(key, placeholder);
|
|
1599
|
-
processed = processed.replaceAll("<sup><strong>".concat(value.index, "</strong></sup>"), placeholder);
|
|
1600
|
-
value._displayIndex = displayIndex++;
|
|
1601
|
-
value._placeholder = placeholder;
|
|
1602
|
-
}
|
|
1603
|
-
|
|
1604
|
-
// Phase 2: Replace placeholders with sequential display indices.
|
|
1605
|
-
} catch (err) {
|
|
1606
|
-
_iterator5.e(err);
|
|
1607
|
-
} finally {
|
|
1608
|
-
_iterator5.f();
|
|
1609
|
-
}
|
|
1610
|
-
var _iterator6 = _createForOfIteratorHelper(citedRefs),
|
|
1611
|
-
_step6;
|
|
1612
|
-
try {
|
|
1613
|
-
for (_iterator6.s(); !(_step6 = _iterator6.n()).done;) {
|
|
1614
|
-
var _step6$value = _slicedToArray(_step6.value, 2),
|
|
1615
|
-
_value4 = _step6$value[1];
|
|
1616
|
-
processed = processed.replaceAll(_value4._placeholder, "<sup><strong>".concat(_value4._displayIndex, "</strong></sup>"));
|
|
1617
|
-
}
|
|
1618
|
-
} catch (err) {
|
|
1619
|
-
_iterator6.e(err);
|
|
1620
|
-
} finally {
|
|
1621
|
-
_iterator6.f();
|
|
1622
|
-
}
|
|
1623
|
-
processed = processed.replaceAll('</strong></sup><sup>', '</strong></sup><sup>,</sup><sup>');
|
|
1624
|
-
processed += '<br><br>';
|
|
1625
|
-
var _iterator7 = _createForOfIteratorHelper(citedRefs),
|
|
1626
|
-
_step7;
|
|
1627
|
-
try {
|
|
1628
|
-
for (_iterator7.s(); !(_step7 = _iterator7.n()).done;) {
|
|
1629
|
-
var _step7$value = _slicedToArray(_step7.value, 2),
|
|
1630
|
-
_key3 = _step7$value[0],
|
|
1631
|
-
_value5 = _step7$value[1];
|
|
1632
|
-
var label = _value5.text || _key3;
|
|
1633
|
-
processed += _value5.link ? "**".concat(_value5._displayIndex, "**. [").concat(label, "](").concat(_value5.link, ")<br>") : "**".concat(_value5._displayIndex, "**. ").concat(label, "<br>");
|
|
1634
|
-
}
|
|
1635
|
-
} catch (err) {
|
|
1636
|
-
_iterator7.e(err);
|
|
1637
|
-
} finally {
|
|
1638
|
-
_iterator7.f();
|
|
1639
|
-
}
|
|
1640
|
-
message.content = processed;
|
|
1641
|
-
message.htmlContent = parseMarkdownContent(processed, message);
|
|
1622
|
+
message.rawContent = (_ref15 = (_message$rawContent2 = message.rawContent) !== null && _message$rawContent2 !== void 0 ? _message$rawContent2 : message.content) !== null && _ref15 !== void 0 ? _ref15 : '';
|
|
1623
|
+
updateMessagePresentation(message, references);
|
|
1642
1624
|
this.messages[messageIndex] = message;
|
|
1643
1625
|
this.$nextTick(function () {
|
|
1644
1626
|
renderChartsInMessage(message);
|
|
@@ -1766,18 +1748,18 @@ window.openAIChatManager = function () {
|
|
|
1766
1748
|
}, 0);
|
|
1767
1749
|
var combined = new Uint8Array(totalLength);
|
|
1768
1750
|
var offset = 0;
|
|
1769
|
-
var
|
|
1770
|
-
|
|
1751
|
+
var _iterator5 = _createForOfIteratorHelper(this.audioChunks),
|
|
1752
|
+
_step5;
|
|
1771
1753
|
try {
|
|
1772
|
-
for (
|
|
1773
|
-
var chunk =
|
|
1754
|
+
for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) {
|
|
1755
|
+
var chunk = _step5.value;
|
|
1774
1756
|
combined.set(chunk, offset);
|
|
1775
1757
|
offset += chunk.length;
|
|
1776
1758
|
}
|
|
1777
1759
|
} catch (err) {
|
|
1778
|
-
|
|
1760
|
+
_iterator5.e(err);
|
|
1779
1761
|
} finally {
|
|
1780
|
-
|
|
1762
|
+
_iterator5.f();
|
|
1781
1763
|
}
|
|
1782
1764
|
this.audioChunks = [];
|
|
1783
1765
|
var blob = new Blob([combined], {
|
|
@@ -2509,7 +2491,9 @@ window.openAIChatManager = function () {
|
|
|
2509
2491
|
return sessionId;
|
|
2510
2492
|
},
|
|
2511
2493
|
copyResponse: function copyResponse(message) {
|
|
2512
|
-
|
|
2494
|
+
var _ref17, _message$copyContent;
|
|
2495
|
+
var text = message && _typeof(message) === 'object' ? (_ref17 = (_message$copyContent = message.copyContent) !== null && _message$copyContent !== void 0 ? _message$copyContent : message.content) !== null && _ref17 !== void 0 ? _ref17 : '' : message !== null && message !== void 0 ? message : '';
|
|
2496
|
+
navigator.clipboard.writeText(text);
|
|
2513
2497
|
},
|
|
2514
2498
|
updateFeedbackIcons: function updateFeedbackIcons(container, userRating) {
|
|
2515
2499
|
if (!container) {
|