refactor(problems): restructure bot parallel routing

This commit is contained in:
cfngc4594 2025-04-05 16:21:35 +08:00
parent 0d074a556d
commit 6c34fa0171
4 changed files with 16 additions and 49 deletions

View File

@ -0,0 +1,15 @@
interface BotLayoutProps {
children: React.ReactNode;
}
export default function BotLayout({
children,
}: BotLayoutProps) {
return (
<div className="flex flex-col h-full">
<div className="relative flex-1 border-x border-muted">
{children}
</div>
</div>
);
}

View File

@ -46,7 +46,7 @@ export default function AiBotPage() {
); );
return ( return (
<div className="h-full flex flex-col"> <div className="flex flex-col h-full bg-background">
<div className="flex-1 relative"> <div className="flex-1 relative">
{!messages.some((message) => message.role === "user" || message.role === "assistant") && ( {!messages.some((message) => message.role === "user" || message.role === "assistant") && (
<div className="absolute bottom-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 text-muted-foreground flex flex-col items-center gap-2"> <div className="absolute bottom-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 text-muted-foreground flex flex-col items-center gap-2">

View File

@ -1,16 +0,0 @@
import { Suspense } from "react";
import { Loading } from "@/components/loading";
interface AiBotLayoutProps {
children: React.ReactNode;
}
export default function AiBotLayout({
children,
}: AiBotLayoutProps) {
return (
<Suspense fallback={<Loading />}>
{children}
</Suspense>
);
}

View File

@ -1,32 +0,0 @@
import { BotIcon } from "lucide-react";
import { ScrollArea, ScrollBar } from "@/components/ui/scroll-area";
import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs";
interface AiLayoutProps {
bot: React.ReactNode;
}
export default function AiLayout({
bot,
}: AiLayoutProps) {
return (
<Tabs defaultValue="bot" className="h-full flex flex-col">
<ScrollArea className="h-9 flex-none bg-muted">
<TabsList>
<TabsTrigger value="bot">
<BotIcon
className="-ms-0.5 me-1.5 opacity-60"
size={16}
aria-hidden="true"
/>
Bot
</TabsTrigger>
</TabsList>
<ScrollBar orientation="horizontal" />
</ScrollArea>
<TabsContent value="bot" className="h-full mt-0">
{bot}
</TabsContent>
</Tabs>
);
}