Adds full text indexes, and advanced search capabilities to the StyleAI chat bot.

This commit is contained in:
Cameron Redmore 2025-04-26 14:20:15 +01:00
parent ef002ec79b
commit 8dda301461
11 changed files with 252 additions and 36 deletions

View file

@ -75,6 +75,9 @@
import { ref, watch, nextTick } from 'vue';
import { QScrollArea, QChatMessage, QSpinnerDots } from 'quasar'; // Import QSpinnerDots
import { marked } from 'marked'; // Import marked
import { useRouter } from 'vue-router';
const router = useRouter();
const props = defineProps({
messages: {
@ -127,7 +130,18 @@ const parseMarkdown = (content) =>
}
// Configure marked options if needed (e.g., sanitization)
// marked.setOptions({ sanitize: true }); // Example: Enable sanitization
return marked(content);
content = marked(content);
//Find any anchor tags which go to `/mantis/$MANTIS_ID` and give them an onclick to call `window.openMantis($MANTIS_ID)` instead.
content = content.replace(/<a href="\/mantis\/(\d+)"/g, (match, mantisId) =>
{
return `<a class='cursor-pointer' onclick="window.openMantis(${mantisId})"`;
});
//Set all anchor tags to open in new tab
content = content.replace(/<a /g, '<a target="_blank" rel="noopener noreferrer" ');
return content;
};
// Scroll to bottom when messages change or component mounts
@ -139,6 +153,11 @@ watch(() => props.messages, () =>
});
}, { deep: true, immediate: true });
window.openMantis = (ticketId) =>
{
router.push({ name: 'mantis', params: { ticketId } });
};
</script>
<style>