mirror of
https://github.com/Litlyx/litlyx
synced 2025-12-10 15:58:38 +01:00
fix ai UI + add domain filter on visits
This commit is contained in:
@@ -107,9 +107,12 @@ const { isOpen, close, open } = useMenu();
|
|||||||
<DashboardDialogBarCard @click.stop="null" class="z-[36]"></DashboardDialogBarCard>
|
<DashboardDialogBarCard @click.stop="null" class="z-[36]"></DashboardDialogBarCard>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<LayoutTopNavigation></LayoutTopNavigation>
|
<LayoutTopNavigation class="flex"></LayoutTopNavigation>
|
||||||
|
|
||||||
|
<div class="h-full pb-[3rem]">
|
||||||
|
<slot></slot>
|
||||||
|
</div>
|
||||||
|
|
||||||
<slot></slot>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
@@ -14,7 +14,8 @@ const getVisitsCountsTool: AIPlugin_TTool<'getVisitsCount'> = {
|
|||||||
from: { type: 'string', description: 'ISO string of start date' },
|
from: { type: 'string', description: 'ISO string of start date' },
|
||||||
to: { type: 'string', description: 'ISO string of end date' },
|
to: { type: 'string', description: 'ISO string of end date' },
|
||||||
website: { type: 'string', description: 'The website of the visits' },
|
website: { type: 'string', description: 'The website of the visits' },
|
||||||
page: { type: 'string', description: 'The page of the visit' }
|
page: { type: 'string', description: 'The page of the visit' },
|
||||||
|
domain: { type: 'string', description: 'Used only to filter a specific domain' }
|
||||||
},
|
},
|
||||||
required: ['from', 'to']
|
required: ['from', 'to']
|
||||||
}
|
}
|
||||||
@@ -33,6 +34,7 @@ const getVisitsTimelineTool: AIPlugin_TTool<'getVisitsTimeline'> = {
|
|||||||
to: { type: 'string', description: 'ISO string of end date' },
|
to: { type: 'string', description: 'ISO string of end date' },
|
||||||
website: { type: 'string', description: 'The website of the visits' },
|
website: { type: 'string', description: 'The website of the visits' },
|
||||||
page: { type: 'string', description: 'The page of the visit' },
|
page: { type: 'string', description: 'The page of the visit' },
|
||||||
|
domain: { type: 'string', description: 'Used only to filter a specific domain' }
|
||||||
},
|
},
|
||||||
required: ['from', 'to']
|
required: ['from', 'to']
|
||||||
}
|
}
|
||||||
@@ -45,14 +47,15 @@ export class AiVisits extends AIPlugin<['getVisitsCount', 'getVisitsTimeline']>
|
|||||||
|
|
||||||
super({
|
super({
|
||||||
'getVisitsCount': {
|
'getVisitsCount': {
|
||||||
handler: async (data: { project_id: string, from: string, to: string, website?: string, page?: string }) => {
|
handler: async (data: { project_id: string, from: string, to: string, website?: string, page?: string, domain?: string }) => {
|
||||||
|
|
||||||
const query: any = {
|
const query: any = {
|
||||||
project_id: data.project_id,
|
project_id: data.project_id,
|
||||||
created_at: {
|
created_at: {
|
||||||
$gt: new Date(data.from),
|
$gt: new Date(data.from),
|
||||||
$lt: new Date(data.to),
|
$lt: new Date(data.to),
|
||||||
}
|
},
|
||||||
|
website: data.domain || { $ne: '_NODOMAIN_' }
|
||||||
}
|
}
|
||||||
|
|
||||||
if (data.website) query.website = data.website;
|
if (data.website) query.website = data.website;
|
||||||
@@ -67,7 +70,7 @@ export class AiVisits extends AIPlugin<['getVisitsCount', 'getVisitsTimeline']>
|
|||||||
tool: getVisitsCountsTool
|
tool: getVisitsCountsTool
|
||||||
},
|
},
|
||||||
'getVisitsTimeline': {
|
'getVisitsTimeline': {
|
||||||
handler: async (data: { project_id: string, from: string, to: string, time_offset: number, website?: string, page?: string }) => {
|
handler: async (data: { project_id: string, from: string, to: string, time_offset: number, website?: string, page?: string, domain?: string }) => {
|
||||||
|
|
||||||
const timelineData = await executeTimelineAggregation({
|
const timelineData = await executeTimelineAggregation({
|
||||||
projectId: new Types.ObjectId(data.project_id),
|
projectId: new Types.ObjectId(data.project_id),
|
||||||
@@ -75,7 +78,8 @@ export class AiVisits extends AIPlugin<['getVisitsCount', 'getVisitsTimeline']>
|
|||||||
from: data.from,
|
from: data.from,
|
||||||
to: data.to,
|
to: data.to,
|
||||||
slice: 'day',
|
slice: 'day',
|
||||||
timeOffset: data.time_offset
|
timeOffset: data.time_offset,
|
||||||
|
domain: data.domain || { $ne: '_NODOMAIN_' } as any
|
||||||
});
|
});
|
||||||
return { data: timelineData };
|
return { data: timelineData };
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user