diff --git a/dashboard/components/dashboard/ActionableChart.vue b/dashboard/components/dashboard/ActionableChart.vue index 4a1bbcc..73a4718 100644 --- a/dashboard/components/dashboard/ActionableChart.vue +++ b/dashboard/components/dashboard/ActionableChart.vue @@ -123,8 +123,14 @@ function externalTooltipHandler(context: { chart: any, tooltip: TooltipModel<'li return; } const { left: positionX, top: positionY } = chart.canvas.getBoundingClientRect(); + + + const xSwap = tooltip.caretX > (window.innerWidth * 0.5) ? -450 : -100; + tooltipEl.style.opacity = '1'; - tooltipEl.style.left = positionX + tooltip.caretX + 'px'; + + tooltipEl.style.left = positionX + (tooltip.caretX + xSwap) + 'px'; + tooltipEl.style.top = positionY + tooltip.caretY + 'px'; tooltipEl.style.padding = tooltip.options.padding + 'px ' + tooltip.options.padding + 'px'; diff --git a/dashboard/pages/events.vue b/dashboard/pages/events.vue index aa2557e..9560e44 100644 --- a/dashboard/pages/events.vue +++ b/dashboard/pages/events.vue @@ -36,8 +36,20 @@ const eventsData = await useFetch(`/api/data/count`, { method: 'POST', headers,
- - Total events: {{ eventsData.data.value?.[0].total || '???' }} + +
+
+ Total events: {{ eventsData.data.value?.[0]?.total || '0' }} +
+
+ Waiting for your first event... +
+
+
+ + Go to docs + +
diff --git a/dashboard/server/ai/functions/AI_Events.ts b/dashboard/server/ai/functions/AI_Events.ts index 911d06e..d8de4c8 100644 --- a/dashboard/server/ai/functions/AI_Events.ts +++ b/dashboard/server/ai/functions/AI_Events.ts @@ -2,7 +2,7 @@ import { EventModel } from "@schema/metrics/EventSchema"; import { AdvancedTimelineAggregationOptions, executeAdvancedTimelineAggregation, executeTimelineAggregation, fillAndMergeTimelineAggregationV2 } from "~/server/services/TimelineService"; import { Types } from "mongoose"; import { AIPlugin, AIPlugin_TTool } from "../Plugin"; - +import dayjs from 'dayjs'; const getEventsCountTool: AIPlugin_TTool<'getEventsCount'> = { type: 'function', @@ -66,7 +66,9 @@ export class AiEvents extends AIPlugin<['getEventsCount', 'getEventsTimeline']> const query: AdvancedTimelineAggregationOptions & { customMatch: Record } = { projectId: new Types.ObjectId(data.project_id) as any, model: EventModel, - from: data.from, to: data.to, slice: 'day', + from: dayjs(data.from).startOf('day').toISOString(), + to: dayjs(data.to).startOf('day').toISOString(), + slice: 'day', customMatch: {} } if (data.metadata) query.customMatch.metadata = data.metadata; diff --git a/dashboard/server/ai/functions/AI_Visits.ts b/dashboard/server/ai/functions/AI_Visits.ts index db636a8..0c228f6 100644 --- a/dashboard/server/ai/functions/AI_Visits.ts +++ b/dashboard/server/ai/functions/AI_Visits.ts @@ -2,7 +2,7 @@ import { VisitModel } from "@schema/metrics/VisitSchema"; import { AdvancedTimelineAggregationOptions, executeAdvancedTimelineAggregation, executeTimelineAggregation, fillAndMergeTimelineAggregationV2 } from "~/server/services/TimelineService"; import { Types } from "mongoose"; import { AIPlugin, AIPlugin_TTool } from "../Plugin"; - +import dayjs from 'dayjs'; const getVisitsCountsTool: AIPlugin_TTool<'getVisitsCount'> = { type: 'function', @@ -63,10 +63,13 @@ export class AiVisits extends AIPlugin<['getVisitsCount', 'getVisitsTimeline']> }, 'getVisitsTimeline': { handler: async (data: { project_id: string, from: string, to: string, website?: string, page?: string }) => { + const query: AdvancedTimelineAggregationOptions & { customMatch: Record } = { projectId: new Types.ObjectId(data.project_id) as any, model: VisitModel, - from: data.from, to: data.to, slice: 'day', + from: dayjs(data.from).startOf('day').toISOString(), + to: dayjs(data.to).startOf('day').toISOString(), + slice: 'day', customMatch: {} } diff --git a/dashboard/server/api/pay/webhook.post.ts b/dashboard/server/api/pay/webhook.post.ts index f163bd1..d9e1c28 100644 --- a/dashboard/server/api/pay/webhook.post.ts +++ b/dashboard/server/api/pay/webhook.post.ts @@ -140,10 +140,10 @@ async function onPaymentSuccess(event: Event.InvoicePaidEvent) { setTimeout(() => { if (PLAN.ID == 0) return; - EmailService.sendPurchaseEmail(user.email, project.name); + EmailService.sendPurchaseEmail(user.email, project.name); }, 1); - + return { ok: true }; diff --git a/dashboard/server/services/AiService.ts b/dashboard/server/services/AiService.ts index 1a09b4c..93155b6 100644 --- a/dashboard/server/services/AiService.ts +++ b/dashboard/server/services/AiService.ts @@ -77,7 +77,7 @@ export async function sendMessageOnChat(text: string, pid: string, initial_chat_ } else { const roleMessage: OpenAI.Chat.Completions.ChatCompletionMessageParam = { role: 'system', - content: + "Today is " + new Date().toISOString() + content: "Today ISO date: " + new Date().toISOString() } messages.push(roleMessage); await addMessageToChat(roleMessage, chat_id);