diff --git a/src/components/GenerateGuide/AIGuide.tsx b/src/components/GenerateGuide/AIGuide.tsx
index 2a6f774dc..4d434dacf 100644
--- a/src/components/GenerateGuide/AIGuide.tsx
+++ b/src/components/GenerateGuide/AIGuide.tsx
@@ -107,18 +107,20 @@ export function AIGuide(props: AIGuideProps) {
)}
{!guideSlug &&
}
- {!isAiGuideSuggestionsLoading && aiGuide && !isRegenerating && (
+ {aiGuide && !isRegenerating && (
)}
@@ -128,6 +130,7 @@ export function AIGuide(props: AIGuideProps) {
isGuideLoading={!aiGuide}
onUpgrade={() => setShowUpgradeModal(true)}
randomQuestions={randomQuestions}
+ isQuestionsLoading={isAiGuideSuggestionsLoading}
/>
);
@@ -137,10 +140,11 @@ type ListSuggestionsProps = {
title: string;
suggestions: string[];
depth: string;
+ isLoading: boolean;
};
export function ListSuggestions(props: ListSuggestionsProps) {
- const { title, suggestions, depth } = props;
+ const { title, suggestions, depth, isLoading } = props;
return (
@@ -148,21 +152,31 @@ export function ListSuggestions(props: ListSuggestionsProps) {
{title}
- {suggestions?.map((topic) => {
- const url = `/ai/guides?term=${encodeURIComponent(topic)}&depth=${depth}&id=&format=guide`;
+ {isLoading && (
+ <>
+ {[1, 2].map((i) => (
+
+ ))}
+ >
+ )}
+ {!isLoading &&
+ suggestions?.map((topic) => {
+ const url = `/ai/guides?term=${encodeURIComponent(topic)}&depth=${depth}&id=&format=guide`;
- return (
- -
-
- {topic}
-
-
- );
- })}
+ return (
+ -
+
+ {topic}
+
+
+ );
+ })}
);
diff --git a/src/components/GenerateGuide/AIGuideChat.tsx b/src/components/GenerateGuide/AIGuideChat.tsx
index 8aba43376..0207d0e4a 100644
--- a/src/components/GenerateGuide/AIGuideChat.tsx
+++ b/src/components/GenerateGuide/AIGuideChat.tsx
@@ -24,11 +24,18 @@ type AIGuideChatProps = {
guideSlug?: string;
isGuideLoading?: boolean;
onUpgrade?: () => void;
+ isQuestionsLoading?: boolean;
randomQuestions?: string[];
};
export function AIGuideChat(props: AIGuideChatProps) {
- const { guideSlug, isGuideLoading, onUpgrade, randomQuestions } = props;
+ const {
+ guideSlug,
+ isGuideLoading,
+ onUpgrade,
+ randomQuestions,
+ isQuestionsLoading,
+ } = props;
const scrollareaRef = useRef
(null);
const inputRef = useRef(null);
@@ -163,7 +170,18 @@ export function AIGuideChat(props: AIGuideChatProps) {
html="Hello, how can I help you today?"
isIntro
/>
- {randomQuestions &&
+ {isQuestionsLoading && (
+
+ {[1, 2, 3, 4].map((i) => (
+
+ ))}
+
+ )}
+ {!isQuestionsLoading &&
+ randomQuestions &&
randomQuestions.length > 0 &&
messages.length === 0 && (
<>
diff --git a/src/components/GenerateGuide/GenerateAIGuide.tsx b/src/components/GenerateGuide/GenerateAIGuide.tsx
index e8adab97e..8d511a33f 100644
--- a/src/components/GenerateGuide/GenerateAIGuide.tsx
+++ b/src/components/GenerateGuide/GenerateAIGuide.tsx
@@ -108,7 +108,7 @@ export function GenerateAIGuide(props: GenerateAIGuideProps) {
);
onGuideSlugChange?.(guideSlug);
- window.history.replaceState(null, '', `/ai/guides/${guideSlug}`);
+ window.history.replaceState(null, '', `/ai/guide/${guideSlug}`);
},
onLoadingChange: setIsLoading,
onError: setError,
diff --git a/src/pages/ai/guides/[slug].astro b/src/pages/ai/guide/[slug].astro
similarity index 92%
rename from src/pages/ai/guides/[slug].astro
rename to src/pages/ai/guide/[slug].astro
index 669ff36c5..9190b55b2 100644
--- a/src/pages/ai/guides/[slug].astro
+++ b/src/pages/ai/guide/[slug].astro
@@ -16,7 +16,7 @@ const { slug } = Astro.params as Params;
briefTitle='AI Tutor'
description='AI Tutor'
keywords={['ai', 'tutor', 'education', 'learning']}
- canonicalUrl={`/ai/document/${slug}`}
+ canonicalUrl={`/ai/guide/${slug}`}
>
diff --git a/src/pages/ai/guides/index.astro b/src/pages/ai/guide/index.astro
similarity index 95%
rename from src/pages/ai/guides/index.astro
rename to src/pages/ai/guide/index.astro
index 405ac8d4d..efb74dc60 100644
--- a/src/pages/ai/guides/index.astro
+++ b/src/pages/ai/guide/index.astro
@@ -11,7 +11,7 @@ import SkeletonLayout from '../../../layouts/SkeletonLayout.astro';
briefTitle='AI Tutor'
description='AI Tutor'
keywords={['ai', 'tutor', 'education', 'learning']}
- canonicalUrl='/ai/document'
+ canonicalUrl='/ai/guide'
noIndex={true}
>