Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
121 commits
Select commit Hold shift + click to select a range
9a08482
devops: force deploy
gaboesquivel Apr 9, 2024
6758e45
devops: trigger automated build
gaboesquivel Apr 11, 2024
b1f3a0c
devops: trigger automated build
gaboesquivel Apr 11, 2024
34aa4a0
devops: trigger automated build
gaboesquivel Apr 11, 2024
78b49e6
devops: trigger automated build
gaboesquivel Apr 11, 2024
c5334b5
devops: trigger automated build
gaboesquivel Apr 11, 2024
cb71ca4
devops: trigger automated build
gaboesquivel Apr 11, 2024
d735ab2
devops: trigger automated build
gaboesquivel Apr 11, 2024
2d77927
impr(masterbots.ai): add return to browse on bot thread page view (#204)
sheriffjimoh May 6, 2024
db62b93
feat: ai gen 404 image for custom 404 error page (#210)
sheriffjimoh May 6, 2024
fbf1ba8
Merge branch 'develop' of github.com:bitcashorg/masterbots into develop
AndlerRL May 7, 2024
5ccb735
fix(masterbots.ai): terms page visibility and access
AndlerRL May 7, 2024
954c3fd
feat(masterbots.ai): consistent og image style design and dynamic met…
sheriffjimoh May 20, 2024
13fb902
fix(masterbots.ai): OG not redering (#224)
sheriffjimoh May 24, 2024
f422aa5
fix(masterbots.ai): share function (#225)
TopETH May 28, 2024
5ace035
feat(hasura): update user db schema for pro users (#227)
TopETH May 29, 2024
b38d1b0
feat(hasura): add Ai Model Tracker To Threads (#229)
TopETH Jun 20, 2024
234e779
[masterbots.ai] feat: multi AI models integration (#228)
Bran18 Jun 20, 2024
fd2c050
docs: site map diagram
AndlerRL Jun 21, 2024
576e49a
[masterbots.ai] fix: multi AI models guard (#235)
Bran18 Jun 26, 2024
4732d2f
chore(masterbots.ai): update payment terms & conditions (#233)
sheriffjimoh Jun 27, 2024
b43433e
feat(masterbots.ai): pro subscription payment + wizard (#226)
sheriffjimoh Jun 28, 2024
c48ef72
[masterbots.ai] fix: llama3 models (#236)
Bran18 Jun 28, 2024
a38d894
[masterbots.ai] impr(fix): ui tweaks (#237)
AnoukRImola Jul 1, 2024
dce0371
fix(masterbots.ai): payment feedbacks (#240)
sheriffjimoh Jul 11, 2024
bef3b8c
fix(masterbots.ai): update env variable (#244)
sheriffjimoh Jul 11, 2024
5d3cc8a
feat: sitemap (#238)
TopETH Jul 12, 2024
bc35b62
fix(masterbots.ai): show first question & answer in thread list (#246)
TopETH Aug 1, 2024
0073cd1
fix: subscription mobile responsive tweaks (#245)
sheriffjimoh Aug 1, 2024
a9ef61a
fix(impr): models enum table migrations (#247)
AndlerRL Aug 6, 2024
e31f8c2
fix(hasura): models_enum pk
AndlerRL Aug 12, 2024
244e278
fix(hasura): ci/cd default regional log bucket
AndlerRL Aug 12, 2024
888e08d
docs: bun to requirements (#250)
Nemunas Aug 14, 2024
b699518
feat: next auth, email/pw strategy (#249)
Bran18 Aug 14, 2024
1fd3f00
docs: mb sytem diagram v1.0a
AndlerRL Aug 15, 2024
ed6cfa6
feat(impr): next auth environment helper function (#251)
Bran18 Aug 15, 2024
0ff85c5
impr(masterbots.ai): sign up form + sign in session data
AndlerRL Aug 16, 2024
41a1218
docs: claude3 project knowledge docs
AndlerRL Aug 16, 2024
70b69d8
fix(masterbots.ai): devMode conditional
AndlerRL Aug 16, 2024
d43bb36
chore(masterbots.ai): rm console.log
AndlerRL Aug 16, 2024
5bab96c
Merge branch 'main' into develop
AndlerRL Aug 16, 2024
6f6d987
chore: upt default hardcoded gpt model
AndlerRL Aug 16, 2024
f2ff85a
fix: toSlug imports
AndlerRL Aug 17, 2024
4e05831
fix: typo
AndlerRL Aug 17, 2024
69f11d2
Merge branch 'main' into develop
AndlerRL Aug 17, 2024
50774a9
fix(hasura): seeds
AndlerRL Aug 19, 2024
eeabe20
chore(impr): MB seeds update and upgrade (#253)
AndlerRL Aug 22, 2024
bc786a7
fix: prompt row typo
AndlerRL Aug 22, 2024
e911dc1
chore(hasura): seeds update default thread publicity
AndlerRL Aug 24, 2024
09a8cb3
fix(masterbots.ai): adjust arrow direction in thread list (#255)
TopETH Sep 2, 2024
4447b2b
feat(impr): Vercel AI SDK Update (#256)
Bran18 Sep 5, 2024
70dbedf
Leandro/develop (#257)
leandrogavidia Sep 7, 2024
41b6aec
impr(masterbots): components folder structur (#259)
Bran18 Sep 9, 2024
834b102
fix(masterbots): google signIn (#260)
AndlerRL Sep 9, 2024
ad83c1d
fix(masterbots.ai): fix thread-component loop (#261)
Bran18 Sep 10, 2024
9a6333b
fix:(masterbots.ai) add useScroll hook (#263)
Bran18 Sep 12, 2024
abec687
feat(masterbots.ai): chat sidebar filtering (#264)
AndlerRL Sep 12, 2024
42c33fc
fix(masterbots.ai): bot button redirect change (#265)
AnoukRImola Sep 15, 2024
973fa71
wip(masterbots.ai): seo data impr (#267)
AndlerRL Sep 15, 2024
20c7a3b
feat: add chat publicity trigger (#258)
sheriffjimoh Sep 15, 2024
b86a2d1
feat(masterbots.ai): user messages ai refactor (#266)
Bran18 Sep 15, 2024
42d829e
wip: browse sidebar
AndlerRL Sep 15, 2024
b9aa09e
impr(masterbots.ai): browse sidebar (#270)
AndlerRL Sep 15, 2024
4940a30
chore: upt signup default profile pic
AndlerRL Sep 15, 2024
83642b2
chore: seeds upt (#269)
AndlerRL Sep 15, 2024
1f64926
Merge branch 'main' into develop
AndlerRL Sep 15, 2024
198af13
fix(hasura): thread param permission
AndlerRL Sep 15, 2024
9cc628f
fix(masterbots.ai): typo
AndlerRL Sep 15, 2024
b32e59d
fix(masterbots.ai): allow svg content-type
AndlerRL Sep 16, 2024
69ac378
fix: chat + browse layout
AndlerRL Sep 16, 2024
9bb504f
style: clean up
AndlerRL Sep 16, 2024
0d5ac44
Merge branch 'main' into develop
AndlerRL Sep 16, 2024
96e76f6
Seo data (#273)
luighis Sep 16, 2024
d86292f
impr(masterbots.ai): title impr prompt
AndlerRL Sep 23, 2024
469bb0b
impr(masterbots.ai): improve current features v2 (#274)
Bran18 Sep 25, 2024
14ee814
Masterbots/fix redirects (#275)
AnoukRImola Sep 27, 2024
2eb35f9
[masterbots.ai] feat: wordware api (#276)
Bran18 Oct 3, 2024
ab2a2a3
doc: mb system diagram upt
AndlerRL Oct 4, 2024
d4b5274
wip: icl calls integrations
AndlerRL Oct 5, 2024
9463de8
impr(masterbots.ai): permission for thread & user action mode (#281)
sheriffjimoh Oct 8, 2024
af10a55
feat(masterbots.ai): create password recovery (#282)
Bran18 Oct 10, 2024
1ed9365
[masterbots.ai] impr: WW API sanitize and keep alive (#284)
Bran18 Oct 14, 2024
544e598
wip(masterbots.ai): impr createImprovementPrompt
AndlerRL Oct 15, 2024
31a0d9c
style(masterbots.ai): chat loading states comments
AndlerRL Oct 15, 2024
07826f5
feat(masterbots.ai): add admin mode to approve thread (#283)
sheriffjimoh Oct 15, 2024
9d45428
impr(masterbots.ai): alpha metadata chatbot labels (#288)
AndlerRL Oct 23, 2024
1a67709
style(impr): cleanPrompt + followingQuestionsPrompt relocation & cleanup
AndlerRL Oct 24, 2024
d1da839
doc: map system (simplified)
AndlerRL Oct 24, 2024
0affecc
fix(masterbots.ai): sideBar updating URL (#286)
AnoukRImola Oct 24, 2024
8ac19ef
feat: thread options (#287)
sheriffjimoh Oct 28, 2024
01b623a
[masterbots.ai] feat: email verification (#289)
Bran18 Oct 28, 2024
3b4957f
feat(hasura): create social following table. (#292)
mledezma Oct 28, 2024
5cf5bef
chore(masterbots.ai): guard WordWare for prod routing
AndlerRL Oct 28, 2024
af490d7
Merge branch 'main' into develop
AndlerRL Oct 28, 2024
a290dbc
[masterbots.ai] fix: public/private tag bg on dark mode (#294)
sheriffjimoh Oct 29, 2024
72b1a89
fix(hasura): upt user permissions (#296)
sheriffjimoh Oct 30, 2024
99c1bdf
fix(hasura): build error (#297)
sheriffjimoh Oct 30, 2024
4100858
[masterbots.ai] feat: thread list display + components comments for a…
Bran18 Nov 6, 2024
c845fc9
[masterbots.ai] feat: chatbot search tool v0.1a (#295)
AndlerRL Nov 7, 2024
b753122
[masterbots.ai] feat: reorganize navigation menu for mobile view (#298)
AnoukRImola Nov 9, 2024
f808b94
[masterbots.ai] feat: UI + Logic Improvements (#301)
Bran18 Nov 9, 2024
4058ca9
[masterbots.ai] fix: restore desktop navigation link - browse section…
Bran18 Nov 12, 2024
19e906b
[masterbots.ai] fix(impr): browse and chat content search (#304)
Bran18 Nov 13, 2024
cf7fd91
[masterbots.ai] impr: seo sitemap (#306)
luighis Nov 13, 2024
9d5fa3d
[masterbots.ai] impr: ai tools (#302)
AndlerRL Nov 14, 2024
02adc39
[masterbots.ai] wip(impr): web search (#309)
AndlerRL Nov 22, 2024
c4a500c
feat: profile page (#300)
sheriffjimoh Nov 23, 2024
a0ca3b8
[masterbots.ai] fix: shallow routing for category & chatbots for cha…
sheriffjimoh Nov 28, 2024
8219716
[masterbots.ai] feat: update ChatChatbotDetails (#314)
Bran18 Nov 28, 2024
7deaff3
[masterbots.ai] feat: include custom settings options (#317)
Bran18 Nov 30, 2024
4f4143a
[masterbots.ai] feat: integrate drizzle ORM (#320)
Bran18 Dec 6, 2024
56b2eaf
Merge branch 'main' into develop
AndlerRL Dec 6, 2024
8af1880
chore: webSearch feature flag + use cloudinary upload preset
AndlerRL Dec 6, 2024
a000740
fix: responsive sidebar fix
AndlerRL Dec 6, 2024
04bc55f
fix: ts chk build
AndlerRL Dec 6, 2024
76ddeeb
fix: sidebar async call
AndlerRL Dec 6, 2024
b2c7f67
fix: ts build
AndlerRL Dec 6, 2024
ac3631a
chore: typo
AndlerRL Dec 6, 2024
4bc86d8
[masterbots.ai] fix: browse category navigation (#316)
sheriffjimoh Dec 10, 2024
619166f
fix: hasura thread delete + user dup permissions (#330)
AndlerRL Dec 10, 2024
5efbec9
Merge branch 'main' into develop
AndlerRL Dec 10, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 0 additions & 17 deletions apps/hasura/metadata/databases/masterbots/tables/public_user.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -141,23 +141,6 @@ select_permissions:
- username
filter: {}
comment: ""
- role: moderator
permission:
columns:
- date_joined
- email
- get_free_month
- is_blocked
- is_verified
- last_login
- pro_user_subscription_id
- profile_picture
- role
- slug
- user_id
- username
filter: {}
comment: ""
- role: user
permission:
columns:
Expand Down
4 changes: 2 additions & 2 deletions apps/masterbots.ai/app/(browse)/[category]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ export default async function BrowseCategoryPage({

return (
<div className="w-full max-w-screen-lg pb-10 mx-auto">
<BrowseCategoryTabs
{/* <BrowseCategoryTabs
initialCategory={params.category}
categories={categories}
/>
/> */}
<BrowseSearchInput />
<BrowseList />
</div>
Expand Down
33 changes: 20 additions & 13 deletions apps/masterbots.ai/components/layout/sidebar/sidebar-link.tsx
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import { Checkbox } from "@/components/ui/checkbox"
import { IconCaretRight } from '@/components/ui/icons'
import { useSidebar } from '@/lib/hooks/use-sidebar'
import { urlBuilders } from '@/lib/url'
import { cn } from '@/lib/utils'
import { Category, Chatbot } from 'mb-genql'
import { toSlug } from 'mb-lib'
Expand All @@ -20,7 +21,7 @@ interface SidebarLinkProps {
export default function SidebarLink({ category, isFilterMode, page }: SidebarLinkProps) {
const router = useRouter()
const pathname = usePathname()
const isBrowse = !pathname.includes('/c') && !pathname.includes('/u')
const isBrowse = !/^\/(?:c|u)(?:\/|$)/.test(pathname)
const { slug } = useParams()

const {
Expand Down Expand Up @@ -53,13 +54,17 @@ export default function SidebarLink({ category, isFilterMode, page }: SidebarLin
navigateTo({
page,
slug: typeof slug === 'string' ? slug : undefined,
categoryName: toSlug(category.name.toLowerCase())
categoryName: toSlug(category.name.toLowerCase()),
isBrowse
})

} else {
}
else {
setActiveChatbot(null)
navigateTo({
page,
slug: typeof slug === 'string' ? slug : undefined,
isBrowse
})
}
return newCategory
Expand Down Expand Up @@ -138,21 +143,22 @@ export default function SidebarLink({ category, isFilterMode, page }: SidebarLin

return (
<div className={cn('flex flex-col mb-2')}>
<a
href="#"
// href={page === 'profile' ? `/u/${slug}/t/${toSlug(category.name)}` :`/c/${toSlug(category.name)}`}
<button
role="menuitem"
aria-expanded={isActive}
aria-controls={`category-${category.name}`}
className={cn(
'flex items-center p-2 cursor-pointer',
'flex items-center p-2 w-full text-left',
isActive && 'bg-gray-200 dark:bg-mirage',
page === 'profile' && 'pl-6'
)}
onClick={(e) => {
e.preventDefault();
e.stopPropagation();
handleClickCategory(e);
}}
>
{categoryContent}
</a>
</button>
{childrenContent}
</div>
)
Expand All @@ -177,7 +183,7 @@ const ChatbotComponent: React.FC<ChatbotComponentProps> = React.memo(function Ch
}) {
const { selectedChatbots, toggleChatbotSelection, navigateTo } = useSidebar()
const pathname = usePathname()
const isBrowse = !pathname.includes('/c') && !pathname.includes('/u')
const isBrowse = !/^\/(?:c|u)(?:\/|$)/.test(pathname)
const { slug } = useParams()

const handleChatbotClick = useCallback((e: React.MouseEvent) => {
Expand All @@ -188,7 +194,8 @@ const ChatbotComponent: React.FC<ChatbotComponentProps> = React.memo(function Ch
page,
slug: slug as string,
categoryName: toSlug(category.name.toLowerCase()),
chatbotName: chatbot.name.toLowerCase()
chatbotName: chatbot.name.toLowerCase(),
isBrowse
})
}
}, [chatbot, setActiveChatbot, isFilterMode])
Expand All @@ -206,7 +213,7 @@ const ChatbotComponent: React.FC<ChatbotComponentProps> = React.memo(function Ch
className={cn(
'flex items-center p-2 w-full',
isActive && 'bg-blue-100 dark:bg-blue-900',
'hover:bg-gray-100 dark:hover:bg-gray-800'
'hover:bg-gray-100 dark:hover:bg-gray-800',
)}
>
{isFilterMode && (
Expand All @@ -228,7 +235,7 @@ const ChatbotComponent: React.FC<ChatbotComponentProps> = React.memo(function Ch
</div>
) : (
<Link
href={page === 'profile' ? `/u/${slug}/t/${toSlug(category.name)}/${chatbot.name.toLowerCase()}` : `/c/${toSlug(category.name)}/${chatbot.name.toLowerCase()}`}
href={page === 'profile' ? urlBuilders.userChatbotUrl({ slug: slug as string, category: category.name, chatbot: chatbot.name }) : `/c/${toSlug(category.name)}/${chatbot.name.toLowerCase()}`}
className={cn(
'flex items-center p-2 w-full',
isActive && 'bg-blue-100 dark:bg-blue-900',
Expand Down
7 changes: 1 addition & 6 deletions apps/masterbots.ai/components/layout/sidebar/sidebar-responsive.tsx
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,16 +1,11 @@
import { Sidebar } from '@/components/layout/sidebar/sidebar';
// import { ChatHistory } from '@/components/chat-history'

export function ResponsiveSidebar() {
return (
<Sidebar className="peer absolute inset-y-0 z-30 border-r bg-muted
transition-all
-translate-x-full duration-500 ease-in-out
data-[state=open]:translate-x-0 data-[state=closed]:lg:translate-x-0
w-[300px] lg:w-[250px] xl:w-[300px]">
{/* <SidebarCategoryGeneral /> */}
{/* <h3>Chat history</h3> */}
{/* <ChatHistory userId={session.user.id} /> */}
</Sidebar>
w-[300px] lg:w-[250px] xl:w-[300px]"/>
)
}
15 changes: 15 additions & 0 deletions apps/masterbots.ai/components/layout/sidebar/sidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,25 @@ import { SidebarHeader } from '@/components/layout/sidebar/sidebar-header'
import { useSidebar } from '@/lib/hooks/use-sidebar'
import { cn } from '@/lib/utils'
import React from 'react'
import { usePathname } from 'next/navigation'
import { useThread } from '@/lib/hooks/use-thread'

export function Sidebar({ className }: React.ComponentProps<'div'>) {
const { isSidebarOpen, isLoading } = useSidebar()
const prevPathRef = React.useRef(usePathname());
const pathname = usePathname();
const { setActiveThread, setIsOpenPopup } = useThread()
const rootAndChatRegex = /^\/(?:c)?$/;

React.useEffect(() => {
if (rootAndChatRegex.test(pathname)) {
setActiveThread(null);
setIsOpenPopup(false);
}
prevPathRef.current = pathname;
}, [pathname]);


if (isLoading) return null

return (
Expand Down
4 changes: 3 additions & 1 deletion apps/masterbots.ai/components/routes/browse/browse-list-item.tsx
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ import Image from 'next/image'
import { useRouter } from 'next/navigation'
import React from 'react'
import { ChatOptions } from '../chat/chat-options'
import { urlBuilders } from '@/lib/url'


let initialUrl: string | null = null

Expand Down Expand Up @@ -139,7 +141,7 @@ export default function BrowseListItem({
e.preventDefault()
e.stopPropagation()
if (thread?.user?.slug) {
router.push(`/u/${thread?.user?.slug}/t`)
router.push(urlBuilders.userProfileUrl({ userSlug: thread.user.slug }))
}
}

Expand Down
25 changes: 14 additions & 11 deletions apps/masterbots.ai/components/routes/browse/browse-list.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,12 @@ export default function BrowseList() {
const [filteredThreads, setFilteredThreads] = React.useState<Thread[]>([])
const [loading, setLoading] = React.useState<boolean>(false)
const [count, setCount] = React.useState<number>(0)
const { selectedCategories, selectedChatbots } = useSidebar()
const { selectedCategories, selectedChatbots, activeCategory, activeChatbot } = useSidebar()

const fetchThreads = async ({
categoriesId,
chatbotsId,
keyword
keyword,
}: {
categoriesId: number[]
chatbotsId: number[]
Expand All @@ -55,10 +55,17 @@ export default function BrowseList() {
setLoading(true) // ? Seting loading before fetch
try {
const threads = await getBrowseThreads({
categoriesId,
chatbotsId,
keyword,
limit: PAGE_SIZE
...(activeCategory !== null || activeChatbot !== null
? {
categoryId: activeCategory,
chatbotName: activeChatbot?.name,
}
: {
categoriesId,
chatbotsId,
keyword,
}),
limit: PAGE_SIZE,
})
setThreads(threads)
setFilteredThreads(threads)
Expand Down Expand Up @@ -108,12 +115,8 @@ export default function BrowseList() {
categoriesId: selectedCategories,
chatbotsId: selectedChatbots
})
}, [selectedCategories, selectedChatbots, activeCategory, activeChatbot])

console.log({
selectedCategories,
selectedChatbots
})
}, [selectedCategories, selectedChatbots])

// biome-ignore lint/correctness/useExhaustiveDependencies: <explanation>
React.useEffect(() => {
Expand Down
21 changes: 20 additions & 1 deletion apps/masterbots.ai/components/routes/chat/chat-accordion.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
//* Component for displaying a collapsible chat thread accordion

import { useThread } from '@/lib/hooks/use-thread'
import { urlBuilders } from '@/lib/url'
import { ChevronDown } from 'lucide-react'
import type { Thread } from 'mb-genql'
import { useParams, usePathname, useRouter } from 'next/navigation'
import React from 'react'

export const ChatAccordion = ({
Expand Down Expand Up @@ -42,8 +44,13 @@ export const ChatAccordion = ({
isOpenPopup
} = useThread()

const pathname = usePathname()
const params = useParams()
const router = useRouter();

//* Sets the initial open state based on defaultState prop
const initialState = defaultState
const profilePage = /^\/u\/[^/]+\/t(?:\/|$)/.test(pathname)

const [open, setOpen] = React.useState(initialState)
const isMainThread = !isOpenPopup
Expand All @@ -52,12 +59,24 @@ export const ChatAccordion = ({
const handleClick = (e: React.MouseEvent) => {
e.stopPropagation()

if (isMainThread && thread) {
if (isMainThread && thread && !profilePage) {
//* Main thread click - open modal
setActiveThread(thread)
setIsOpenPopup(true)
} else {
//* Sub-conversation click - toggle accordion
if (profilePage) {
setIsOpenPopup(false)
setActiveThread(null)
const category = thread?.chatbot?.categories[0]?.category?.name
const chatbot = thread?.chatbot?.name
const slug = params.slug;
if (!category || !chatbot || !slug) {
console.error('Missing required navigation parameters');
return;
}
router.push(urlBuilders.threadUrl({ slug: slug as string, category, chatbot, threadId: thread?.threadId }))
}
toggle()
}
}
Expand Down
21 changes: 1 addition & 20 deletions apps/masterbots.ai/components/routes/thread/thread-component.tsx
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,9 @@ import { useScroll } from '@/lib/hooks/use-scroll'
import { useThread } from '@/lib/hooks/use-thread'
import { useThreadVisibility } from '@/lib/hooks/use-thread-visibility'
import type { Thread } from 'mb-genql'
import { toSlug } from 'mb-lib'
import { redirect, useParams, usePathname } from 'next/navigation'
import { useRef } from 'react'
import { AdminModeApprove } from '../chat/admin-mode-approve'
import { ChatOptions } from '../chat/chat-options'

export default function ThreadComponent({
thread,
loadMore,
Expand All @@ -60,8 +57,6 @@ export default function ThreadComponent({
const contentRef = useRef<HTMLDivElement>(null)
const { isNewResponse } = useThread()
const { isAdminMode } = useThreadVisibility()
const pathname = usePathname()
const params = useParams()

const { isNearBottom, scrollToTop } = useScroll({
containerRef: contentRef,
Expand All @@ -74,22 +69,8 @@ export default function ThreadComponent({
})

const threadId = thread.threadId

const handleAccordionToggle = () => {

if (pathname.includes('u') && pathname.includes('t')) {
const category = thread?.chatbot?.categories[0]?.category?.name
const chatbot = thread?.chatbot?.name
const slug = params.slug;

if (!category || !chatbot || !slug) {
console.error('Missing required navigation parameters');
return scrollToTop();
}
redirect(`/u/${slug}/t/${toSlug(category)}/${toSlug(chatbot)}/${thread.threadId}`)
} else {
scrollToTop()
}
scrollToTop()
}
return (
<li ref={threadRef}>
Expand Down
Loading