diff --git a/dashboard/pages/analyst.vue b/dashboard/pages/analyst.vue index 709753f..a0b82c2 100644 --- a/dashboard/pages/analyst.vue +++ b/dashboard/pages/analyst.vue @@ -17,8 +17,10 @@ const currentChatMessages = ref([]); const scroller = ref(null); async function sendMessage() { + if (loading.value) return; if (!activeProject.value) return; + loading.value = true; const body: any = { text: currentText.value } @@ -63,6 +65,7 @@ async function sendMessage() { } async function openChat(chat_id?: string) { + menuOpen.value = false; if (!activeProject.value) return; if (!chat_id) { currentChatMessages.value = []; @@ -87,53 +90,27 @@ function parseMessageContent(content: string) { return content.replace(/\*\*(.*?)\*\*/g, '$1'); } +function onKeyDown(e: KeyboardEvent) { + if (e.code !== 'Enter') return; + if (e.shiftKey === true) return; + sendMessage(); +} + +const menuOpen = ref(false); + +const defaultPrompts = [ + 'How many visits i got last week ?', + 'How many visits i got last month ?', + 'How many visits i got today ?', + 'How many events i got last week ?', +] +