diff --git a/src/components/AIChat/AIChat.tsx b/src/components/AIChat/AIChat.tsx
index 0fda90bab..0689b66bf 100644
--- a/src/components/AIChat/AIChat.tsx
+++ b/src/components/AIChat/AIChat.tsx
@@ -18,7 +18,6 @@ import { useMutation, useQuery } from '@tanstack/react-query';
import { queryClient } from '../../stores/query-client';
import { billingDetailsOptions } from '../../queries/billing';
import { useToast } from '../../hooks/use-toast';
-import { readStream } from '../../lib/ai';
import { markdownToHtml } from '../../lib/markdown';
import { ChatHistory } from './ChatHistory';
import { PersonalizedResponseForm } from './PersonalizedResponseForm';
@@ -443,7 +442,7 @@ export function AIChat(props: AIChatProps) {
- {isEmptyHistory && (
+ {isEmptyHistory && !isLoadingInfiniteQuery && (
diff --git a/src/components/Analytics/analytics.ts b/src/components/Analytics/analytics.ts
index 39c1a9137..e58034615 100644
--- a/src/components/Analytics/analytics.ts
+++ b/src/components/Analytics/analytics.ts
@@ -23,6 +23,8 @@ declare global {
window.fireEvent = (props) => {
const { action, category, label, value, callback } = props;
+ const eventId = `${Date.now()}-${Math.random().toString(36).slice(2, 8)}`;
+
if (['course', 'ai_tutor'].includes(category)) {
const url = new URL(import.meta.env.PUBLIC_API_URL);
url.pathname = '/api/_t';
@@ -30,6 +32,7 @@ window.fireEvent = (props) => {
url.searchParams.set('category', category);
url.searchParams.set('label', label ?? '');
url.searchParams.set('value', value ?? '');
+ url.searchParams.set('event_id', eventId);
httpPost(url.toString(), {}).catch(console.error);
}
@@ -49,6 +52,8 @@ window.fireEvent = (props) => {
event_category: category,
event_label: label,
value: value,
+ event_id: eventId,
+ source: 'client',
...(callback ? { event_callback: callback } : {}),
});
};
diff --git a/src/pages/[roadmapId]/ai.astro b/src/pages/[roadmapId]/ai.astro
index 8ebffb1c6..75e8c2215 100644
--- a/src/pages/[roadmapId]/ai.astro
+++ b/src/pages/[roadmapId]/ai.astro
@@ -3,14 +3,22 @@ import { CheckSubscriptionVerification } from '../../components/Billing/CheckSub
import { RoadmapAIChat } from '../../components/RoadmapAIChat/RoadmapAIChat';
import SkeletonLayout from '../../layouts/SkeletonLayout.astro';
import { AITutorLayout } from '../../components/AITutor/AITutorLayout';
-import { getRoadmapById } from '../../lib/roadmap';
-
-export const prerender = false;
+import { getRoadmapById, getRoadmapIds } from '../../lib/roadmap';
type Props = {
roadmapId: string;
};
+export const prerender = false;
+
+export async function getStaticPaths() {
+ const roadmapIds = await getRoadmapIds();
+
+ return roadmapIds.map((roadmapId) => ({
+ params: { roadmapId },
+ }));
+}
+
const { roadmapId } = Astro.params as Props;
const roadmapDetail = await getRoadmapById(roadmapId);