diff --git a/apps/masterbots.ai/app/(browse)/[category]/[threadId]/page.tsx b/apps/masterbots.ai/app/(browse)/[category]/[threadId]/page.tsx
index d9ed8297..9c37b437 100644
--- a/apps/masterbots.ai/app/(browse)/[category]/[threadId]/page.tsx
+++ b/apps/masterbots.ai/app/(browse)/[category]/[threadId]/page.tsx
@@ -3,11 +3,12 @@ import { ThreadAccordionServer } from '@/components/shared/thread-accordion.serv
export { generateMbMetadata as generateMetadata } from '@/lib/metadata'
+// ? For site mapping, we should remove this route and make all redirections and link shares to the /b/ route.
+// ? It is only valid to have /[category] when navigating between categories on browse.
export default async function ThreadPage({ params }: ThreadPageProps) {
const thread = await getThread({
threadId: params.threadId
})
-
const messagePairs = await getMessagePairs(thread.threadId)
return
diff --git a/apps/masterbots.ai/app/b/[id]/[threadId]/page.tsx b/apps/masterbots.ai/app/b/[id]/[threadId]/page.tsx
index f75f4276..b8a3a5bf 100644
--- a/apps/masterbots.ai/app/b/[id]/[threadId]/page.tsx
+++ b/apps/masterbots.ai/app/b/[id]/[threadId]/page.tsx
@@ -1,12 +1,18 @@
-import { BrowseThread } from '@/components/browse-thread'
-import { ChatPageProps } from '@/app/chat/[chatbot]/[threadId]/page'
-import { getThread } from '@/app/actions'
+
+import { ThreadPageProps } from '@/app/(browse)/[category]/[threadId]/page'
+import { getMessagePairs, getThread } from '@/app/actions'
+import { ThreadAccordionServer } from '@/components/shared/thread-accordion.server'
export { generateMbMetadata as generateMetadata } from '@/lib/metadata'
-export default async function ChatPage({ params }: ChatPageProps) {
+// ? When a user clicks to a thread, the URL gets updated to this one.
+// ? When a user navigates within the bot page and click to a thread, the URL gets updated to this one.
+// * When sharing, the URL gets updated to this one.
+export default async function ChatPage({ params }: ThreadPageProps) {
const thread = await getThread({
threadId: params.threadId,
})
- return
+ const messagePairs = await getMessagePairs(thread.threadId)
+
+ return
}
diff --git a/apps/masterbots.ai/lib/metadata.ts b/apps/masterbots.ai/lib/metadata.ts
index 0f509c5b..5a634cd6 100644
--- a/apps/masterbots.ai/lib/metadata.ts
+++ b/apps/masterbots.ai/lib/metadata.ts
@@ -1,6 +1,6 @@
-import { getThread } from '@/services/hasura'
import type { Metadata } from 'next'
import { getThreadLink } from './threads'
+import { getThread } from '@/app/actions';
export async function generateMbMetadata({
params
@@ -8,13 +8,11 @@ export async function generateMbMetadata({
params: any;
}): Promise {
const threadId = params?.threadId
- const thread = await getThread({ threadId, jwt: '' })
+ const thread = await getThread({ threadId })
if (!thread) return
- const firstQuestion =
- thread.messages.find(m => m.role === 'user')?.content || 'not found'
- const firstResponse =
- thread.messages.find(m => m.role === 'assistant')?.content || 'not found'
+ const firstQuestion = thread.firstMessage.content || 'not found'
+ const firstResponse = thread.firstAnswer.content || 'not found'
const data = {
title: firstQuestion,