Tags
@@ -599,6 +599,17 @@ function backendsGallery() {
}
},
+ renderMarkdown(text) {
+ if (!text) return '';
+ try {
+ const html = marked.parse(text);
+ return DOMPurify.sanitize(html);
+ } catch (error) {
+ console.error('Error rendering markdown:', error);
+ return text;
+ }
+ },
+
openModal(backend) {
this.selectedBackend = backend;
},
diff --git a/core/http/views/chat.html b/core/http/views/chat.html
index f9ec82835..fef0b3bb5 100644
--- a/core/http/views/chat.html
+++ b/core/http/views/chat.html
@@ -265,25 +265,8 @@ SOFTWARE.
{{ end }}
{{ end }}
-
-
-
-
-
-
-
-
-
+
-
-
-
@@ -457,7 +429,6 @@ SOFTWARE.
-
@@ -759,7 +730,7 @@ SOFTWARE.
{{ if $galleryConfig.Icon }}

{{end}}
-
{{ $galleryConfig.Description }}
+
{{ $galleryConfig.Description }}
Links
@@ -798,6 +769,59 @@ SOFTWARE.
});
// Context size is now initialized in the Alpine store initialization above
+
+ // Process markdown in model info modal when it opens
+ document.addEventListener('DOMContentLoaded', () => {
+ const modalElement = document.getElementById('model-info-modal');
+ const descriptionElement = document.getElementById('model-info-description');
+
+ if (modalElement && descriptionElement) {
+ // Process markdown on initial load
+ const processMarkdown = () => {
+ if (descriptionElement && typeof marked !== 'undefined' && typeof DOMPurify !== 'undefined') {
+ const originalText = descriptionElement.textContent || descriptionElement.innerText;
+ if (originalText) {
+ try {
+ const html = marked.parse(originalText);
+ descriptionElement.innerHTML = DOMPurify.sanitize(html);
+ } catch (error) {
+ console.error('Error rendering markdown:', error);
+ }
+ }
+ }
+ };
+
+ // Process immediately if modal is already visible
+ if (!modalElement.classList.contains('hidden')) {
+ processMarkdown();
+ }
+
+ // Listen for modal show events (Flowbite uses data-modal-show attribute changes)
+ const observer = new MutationObserver((mutations) => {
+ mutations.forEach((mutation) => {
+ if (mutation.type === 'attributes' && mutation.attributeName === 'aria-hidden') {
+ const isHidden = modalElement.getAttribute('aria-hidden') === 'true';
+ if (!isHidden) {
+ // Modal is now visible, process markdown
+ setTimeout(processMarkdown, 100);
+ }
+ }
+ });
+ });
+
+ observer.observe(modalElement, {
+ attributes: true,
+ attributeFilter: ['aria-hidden', 'class']
+ });
+
+ // Also listen for click events on modal toggle buttons
+ document.querySelectorAll('[data-modal-toggle="model-info-modal"]').forEach(button => {
+ button.addEventListener('click', () => {
+ setTimeout(processMarkdown, 200);
+ });
+ });
+ }
+ });