ai: Refac B/F.
Browse files- app/api/chat/route.ts +2 -0
- app/assistant.tsx +125 -84
- app/globals.css +33 -62
- app/globals.css.orig +131 -0
- components/assistant-ui/threadlist-sidebar.tsx +64 -87
- config.ts +3 -1
app/api/chat/route.ts
CHANGED
|
@@ -20,6 +20,8 @@ export async function POST(req: Request) {
|
|
| 20 |
apiKey: config.api.key
|
| 21 |
}).chat(config.api.model),
|
| 22 |
messages: convertToModelMessages(messages),
|
|
|
|
|
|
|
| 23 |
});
|
| 24 |
|
| 25 |
return result.toUIMessageStreamResponse();
|
|
|
|
| 20 |
apiKey: config.api.key
|
| 21 |
}).chat(config.api.model),
|
| 22 |
messages: convertToModelMessages(messages),
|
| 23 |
+
maxRetries: config.api.maxRetries,
|
| 24 |
+
abortSignal: AbortSignal.timeout(config.api.timeout)
|
| 25 |
});
|
| 26 |
|
| 27 |
return result.toUIMessageStreamResponse();
|
app/assistant.tsx
CHANGED
|
@@ -1,85 +1,126 @@
|
|
| 1 |
-
//
|
| 2 |
-
// SPDX-FileCopyrightText: Hadad <hadad@linuxmail.org>
|
| 3 |
-
// SPDX-License-Identifier: MIT
|
| 4 |
-
//
|
| 5 |
-
|
| 6 |
-
"use client";
|
| 7 |
-
|
| 8 |
-
import { AssistantRuntimeProvider } from "@assistant-ui/react";
|
| 9 |
-
import {
|
| 10 |
-
useChatRuntime,
|
| 11 |
-
AssistantChatTransport,
|
| 12 |
-
} from "@assistant-ui/react-ai-sdk";
|
| 13 |
-
import { Thread } from "@/components/assistant-ui/thread";
|
| 14 |
-
import {
|
| 15 |
-
SidebarInset,
|
| 16 |
-
SidebarProvider,
|
| 17 |
-
SidebarTrigger,
|
| 18 |
-
} from "@/components/ui/sidebar";
|
| 19 |
-
import { ThreadListSidebar } from "@/components/assistant-ui/threadlist-sidebar";
|
| 20 |
-
import { Separator } from "@/components/ui/separator";
|
| 21 |
-
import {
|
| 22 |
-
Breadcrumb,
|
| 23 |
-
BreadcrumbItem,
|
| 24 |
-
BreadcrumbList,
|
| 25 |
-
BreadcrumbPage,
|
| 26 |
-
} from "@/components/ui/breadcrumb";
|
| 27 |
-
|
| 28 |
-
export const Assistant = () => {
|
| 29 |
-
const runtime = useChatRuntime({
|
| 30 |
-
transport: new AssistantChatTransport({
|
| 31 |
-
api: "/api/chat",
|
| 32 |
-
}),
|
| 33 |
-
});
|
| 34 |
-
|
| 35 |
-
return (
|
| 36 |
-
<AssistantRuntimeProvider runtime={runtime}>
|
| 37 |
-
<SidebarProvider>
|
| 38 |
-
<div className="flex h-dvh w-full pr-0.5">
|
| 39 |
-
<ThreadListSidebar />
|
| 40 |
-
|
| 41 |
-
|
| 42 |
-
|
| 43 |
-
<
|
| 44 |
-
|
| 45 |
-
|
| 46 |
-
|
| 47 |
-
|
| 48 |
-
|
| 49 |
-
|
| 50 |
-
|
| 51 |
-
|
| 52 |
-
|
| 53 |
-
|
| 54 |
-
|
| 55 |
-
|
| 56 |
-
|
| 57 |
-
|
| 58 |
-
|
| 59 |
-
|
| 60 |
-
|
| 61 |
-
|
| 62 |
-
|
| 63 |
-
|
| 64 |
-
|
| 65 |
-
|
| 66 |
-
|
| 67 |
-
|
| 68 |
-
|
| 69 |
-
|
| 70 |
-
|
| 71 |
-
|
| 72 |
-
|
| 73 |
-
|
| 74 |
-
|
| 75 |
-
|
| 76 |
-
|
| 77 |
-
|
| 78 |
-
|
| 79 |
-
|
| 80 |
-
|
| 81 |
-
|
| 82 |
-
|
| 83 |
-
|
| 84 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 85 |
};
|
|
|
|
| 1 |
+
//
|
| 2 |
+
// SPDX-FileCopyrightText: Hadad <hadad@linuxmail.org>
|
| 3 |
+
// SPDX-License-Identifier: MIT
|
| 4 |
+
//
|
| 5 |
+
|
| 6 |
+
"use client";
|
| 7 |
+
|
| 8 |
+
import { AssistantRuntimeProvider } from "@assistant-ui/react";
|
| 9 |
+
import {
|
| 10 |
+
useChatRuntime,
|
| 11 |
+
AssistantChatTransport,
|
| 12 |
+
} from "@assistant-ui/react-ai-sdk";
|
| 13 |
+
import { Thread } from "@/components/assistant-ui/thread";
|
| 14 |
+
import {
|
| 15 |
+
SidebarInset,
|
| 16 |
+
SidebarProvider,
|
| 17 |
+
SidebarTrigger,
|
| 18 |
+
} from "@/components/ui/sidebar";
|
| 19 |
+
import { ThreadListSidebar } from "@/components/assistant-ui/threadlist-sidebar";
|
| 20 |
+
import { Separator } from "@/components/ui/separator";
|
| 21 |
+
import {
|
| 22 |
+
Breadcrumb,
|
| 23 |
+
BreadcrumbItem,
|
| 24 |
+
BreadcrumbList,
|
| 25 |
+
BreadcrumbPage,
|
| 26 |
+
} from "@/components/ui/breadcrumb";
|
| 27 |
+
|
| 28 |
+
export const Assistant = () => {
|
| 29 |
+
const runtime = useChatRuntime({
|
| 30 |
+
transport: new AssistantChatTransport({
|
| 31 |
+
api: "/api/chat",
|
| 32 |
+
}),
|
| 33 |
+
});
|
| 34 |
+
|
| 35 |
+
return (
|
| 36 |
+
<AssistantRuntimeProvider runtime={runtime}>
|
| 37 |
+
<SidebarProvider>
|
| 38 |
+
<div className="flex h-dvh w-full pr-0.5">
|
| 39 |
+
<ThreadListSidebar />
|
| 40 |
+
|
| 41 |
+
<SidebarInset>
|
| 42 |
+
<header className="flex h-16 shrink-0 items-center gap-2 px-4">
|
| 43 |
+
<SidebarTrigger />
|
| 44 |
+
|
| 45 |
+
<Breadcrumb>
|
| 46 |
+
<BreadcrumbList>
|
| 47 |
+
<BreadcrumbItem>
|
| 48 |
+
<BreadcrumbPage />
|
| 49 |
+
</BreadcrumbItem>
|
| 50 |
+
</BreadcrumbList>
|
| 51 |
+
</Breadcrumb>
|
| 52 |
+
|
| 53 |
+
<div className="ml-auto flex items-center gap-4">
|
| 54 |
+
<a
|
| 55 |
+
href="https://huggingface.co/spaces/umint/ai/discussions"
|
| 56 |
+
target="_blank"
|
| 57 |
+
rel="noopener noreferrer"
|
| 58 |
+
className="inline-flex items-center hover:opacity-70 transition-opacity"
|
| 59 |
+
title="Changelogs"
|
| 60 |
+
>
|
| 61 |
+
<svg
|
| 62 |
+
width="15"
|
| 63 |
+
height="15"
|
| 64 |
+
viewBox="0 0 24 24"
|
| 65 |
+
fill="none"
|
| 66 |
+
stroke="currentColor"
|
| 67 |
+
strokeWidth="2"
|
| 68 |
+
strokeLinecap="round"
|
| 69 |
+
strokeLinejoin="round"
|
| 70 |
+
>
|
| 71 |
+
<circle cx="12" cy="12" r="10" />
|
| 72 |
+
<line x1="12" y1="16" x2="12" y2="12" />
|
| 73 |
+
<line x1="12" y1="8" x2="12.01" y2="8" />
|
| 74 |
+
</svg>
|
| 75 |
+
</a>
|
| 76 |
+
|
| 77 |
+
<a
|
| 78 |
+
href="https://linkedin.com/in/hadadrjt"
|
| 79 |
+
target="_blank"
|
| 80 |
+
rel="noopener noreferrer"
|
| 81 |
+
className="inline-flex items-center hover:opacity-70 transition-opacity"
|
| 82 |
+
title="LinkedIn"
|
| 83 |
+
>
|
| 84 |
+
<svg
|
| 85 |
+
width="14"
|
| 86 |
+
height="14"
|
| 87 |
+
viewBox="0 0 24 24"
|
| 88 |
+
fill="currentColor"
|
| 89 |
+
>
|
| 90 |
+
<path d="M20.447 20.452h-3.554v-5.569c0-1.328-.027-3.037-1.852-3.037-1.853 0-2.136 1.445-2.136 2.939v5.667H9.351V9h3.414v1.561h.046c.477-.9 1.637-1.85 3.37-1.85 3.601 0 4.267 2.37 4.267 5.455v6.286zM5.337 7.433c-1.144 0-2.063-.926-2.063-2.065 0-1.138.92-2.063 2.063-2.063 1.14 0 2.064.925 2.064 2.063 0 1.139-.925 2.065-2.064 2.065zm1.782 13.019H3.555V9h3.564v11.452zM22.225 0H1.771C.792 0 0 .774 0 1.729v20.542C0 23.227.792 24 1.771 24h20.451C23.2 24 24 23.227 24 22.271V1.729C24 .774 23.2 0 22.222 0h.003z"
|
| 91 |
+
/>
|
| 92 |
+
</svg>
|
| 93 |
+
</a>
|
| 94 |
+
|
| 95 |
+
<a
|
| 96 |
+
href="https://ko-fi.com/hadad"
|
| 97 |
+
target="_blank"
|
| 98 |
+
rel="noopener noreferrer"
|
| 99 |
+
className="inline-flex items-center hover:opacity-70 transition-opacity"
|
| 100 |
+
title="Donate"
|
| 101 |
+
>
|
| 102 |
+
<svg
|
| 103 |
+
width="15"
|
| 104 |
+
height="15"
|
| 105 |
+
viewBox="0 0 24 24"
|
| 106 |
+
fill="none"
|
| 107 |
+
stroke="currentColor"
|
| 108 |
+
strokeWidth="2"
|
| 109 |
+
strokeLinecap="round"
|
| 110 |
+
strokeLinejoin="round"
|
| 111 |
+
>
|
| 112 |
+
<path d="M20.84 4.61a5.5 5.5 0 0 0-7.78 0L12 5.67l-1.06-1.06a5.5 5.5 0 0 0-7.78 7.78l1.06 1.06L12 21.23l7.78-7.78 1.06-1.06a5.5 5.5 0 0 0 0-7.78z" />
|
| 113 |
+
</svg>
|
| 114 |
+
</a>
|
| 115 |
+
</div>
|
| 116 |
+
</header>
|
| 117 |
+
|
| 118 |
+
<div className="flex-1 overflow-hidden">
|
| 119 |
+
<Thread />
|
| 120 |
+
</div>
|
| 121 |
+
</SidebarInset>
|
| 122 |
+
</div>
|
| 123 |
+
</SidebarProvider>
|
| 124 |
+
</AssistantRuntimeProvider>
|
| 125 |
+
);
|
| 126 |
};
|
app/globals.css
CHANGED
|
@@ -1,3 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
@import "tailwindcss";
|
| 2 |
@import "tw-animate-css";
|
| 3 |
|
|
@@ -45,71 +50,41 @@
|
|
| 45 |
|
| 46 |
:root {
|
| 47 |
--radius: 0.625rem;
|
| 48 |
-
--background: oklch(
|
| 49 |
-
--foreground: oklch(0.141 0.005 285.823);
|
| 50 |
-
--card: oklch(1 0 0);
|
| 51 |
-
--card-foreground: oklch(0.141 0.005 285.823);
|
| 52 |
-
--popover: oklch(1 0 0);
|
| 53 |
-
--popover-foreground: oklch(0.141 0.005 285.823);
|
| 54 |
-
--primary: oklch(0.21 0.006 285.885);
|
| 55 |
-
--primary-foreground: oklch(0.985 0 0);
|
| 56 |
-
--secondary: oklch(0.967 0.001 286.375);
|
| 57 |
-
--secondary-foreground: oklch(0.21 0.006 285.885);
|
| 58 |
-
--muted: oklch(0.967 0.001 286.375);
|
| 59 |
-
--muted-foreground: oklch(0.552 0.016 285.938);
|
| 60 |
-
--accent: oklch(0.967 0.001 286.375);
|
| 61 |
-
--accent-foreground: oklch(0.21 0.006 285.885);
|
| 62 |
-
--destructive: oklch(0.577 0.245 27.325);
|
| 63 |
-
--border: oklch(0.92 0.004 286.32);
|
| 64 |
-
--input: oklch(0.92 0.004 286.32);
|
| 65 |
-
--ring: oklch(0.705 0.015 286.067);
|
| 66 |
-
--chart-1: oklch(0.646 0.222 41.116);
|
| 67 |
-
--chart-2: oklch(0.6 0.118 184.704);
|
| 68 |
-
--chart-3: oklch(0.398 0.07 227.392);
|
| 69 |
-
--chart-4: oklch(0.828 0.189 84.429);
|
| 70 |
-
--chart-5: oklch(0.769 0.188 70.08);
|
| 71 |
-
--sidebar: oklch(0.985 0 0);
|
| 72 |
-
--sidebar-foreground: oklch(0.141 0.005 285.823);
|
| 73 |
-
--sidebar-primary: oklch(0.21 0.006 285.885);
|
| 74 |
-
--sidebar-primary-foreground: oklch(0.985 0 0);
|
| 75 |
-
--sidebar-accent: oklch(0.967 0.001 286.375);
|
| 76 |
-
--sidebar-accent-foreground: oklch(0.21 0.006 285.885);
|
| 77 |
-
--sidebar-border: oklch(0.92 0.004 286.32);
|
| 78 |
-
--sidebar-ring: oklch(0.705 0.015 286.067);
|
| 79 |
-
}
|
| 80 |
-
|
| 81 |
-
.dark {
|
| 82 |
-
--background: oklch(0.141 0.005 285.823);
|
| 83 |
--foreground: oklch(0.985 0 0);
|
| 84 |
-
--card: oklch(0.
|
| 85 |
--card-foreground: oklch(0.985 0 0);
|
| 86 |
-
--popover: oklch(0.
|
| 87 |
--popover-foreground: oklch(0.985 0 0);
|
| 88 |
-
--primary: oklch(0.
|
| 89 |
-
--primary-foreground: oklch(0.
|
| 90 |
-
--secondary: oklch(0.
|
| 91 |
--secondary-foreground: oklch(0.985 0 0);
|
| 92 |
-
--muted: oklch(0.
|
| 93 |
-
--muted-foreground: oklch(0.
|
| 94 |
-
--accent: oklch(0.
|
| 95 |
--accent-foreground: oklch(0.985 0 0);
|
| 96 |
-
--destructive: oklch(0.
|
| 97 |
-
--border: oklch(
|
| 98 |
-
--input: oklch(
|
| 99 |
-
--ring: oklch(0.
|
| 100 |
-
--chart-1: oklch(0.
|
| 101 |
-
--chart-2: oklch(0.
|
| 102 |
-
--chart-3: oklch(0.
|
| 103 |
-
--chart-4: oklch(0.
|
| 104 |
-
--chart-5: oklch(0.
|
| 105 |
-
--sidebar: oklch(0.
|
| 106 |
-
--sidebar-foreground: oklch(0.
|
| 107 |
-
--sidebar-primary: oklch(0.
|
| 108 |
--sidebar-primary-foreground: oklch(0.985 0 0);
|
| 109 |
-
--sidebar-accent: oklch(0.
|
| 110 |
--sidebar-accent-foreground: oklch(0.985 0 0);
|
| 111 |
-
--sidebar-border: oklch(
|
| 112 |
-
--sidebar-ring: oklch(0.
|
|
|
|
|
|
|
|
|
|
|
|
|
| 113 |
}
|
| 114 |
|
| 115 |
@layer base {
|
|
@@ -118,10 +93,6 @@
|
|
| 118 |
}
|
| 119 |
|
| 120 |
:root {
|
| 121 |
-
color-scheme: light;
|
| 122 |
-
}
|
| 123 |
-
|
| 124 |
-
:root.dark {
|
| 125 |
color-scheme: dark;
|
| 126 |
}
|
| 127 |
|
|
|
|
| 1 |
+
/*
|
| 2 |
+
* SPDX-FileCopyrightText: Hadad <hadad@linuxmail.org>
|
| 3 |
+
* SPDX-License-Identifier: MIT
|
| 4 |
+
*/
|
| 5 |
+
|
| 6 |
@import "tailwindcss";
|
| 7 |
@import "tw-animate-css";
|
| 8 |
|
|
|
|
| 50 |
|
| 51 |
:root {
|
| 52 |
--radius: 0.625rem;
|
| 53 |
+
--background: oklch(0.263 0 0);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 54 |
--foreground: oklch(0.985 0 0);
|
| 55 |
+
--card: oklch(0.3 0.01 286);
|
| 56 |
--card-foreground: oklch(0.985 0 0);
|
| 57 |
+
--popover: oklch(0.3 0.01 286);
|
| 58 |
--popover-foreground: oklch(0.985 0 0);
|
| 59 |
+
--primary: oklch(0.65 0.25 264);
|
| 60 |
+
--primary-foreground: oklch(0.985 0 0);
|
| 61 |
+
--secondary: oklch(0.5 0.15 200);
|
| 62 |
--secondary-foreground: oklch(0.985 0 0);
|
| 63 |
+
--muted: oklch(0.35 0.01 286);
|
| 64 |
+
--muted-foreground: oklch(0.7 0.02 286);
|
| 65 |
+
--accent: oklch(0.7 0.19 162);
|
| 66 |
--accent-foreground: oklch(0.985 0 0);
|
| 67 |
+
--destructive: oklch(0.7 0.19 22);
|
| 68 |
+
--border: oklch(0.4 0.02 286);
|
| 69 |
+
--input: oklch(0.45 0.02 286);
|
| 70 |
+
--ring: oklch(0.65 0.25 264);
|
| 71 |
+
--chart-1: oklch(0.65 0.25 264);
|
| 72 |
+
--chart-2: oklch(0.7 0.19 162);
|
| 73 |
+
--chart-3: oklch(0.77 0.19 70);
|
| 74 |
+
--chart-4: oklch(0.63 0.27 304);
|
| 75 |
+
--chart-5: oklch(0.65 0.25 16);
|
| 76 |
+
--sidebar: oklch(0.3052 0 0);
|
| 77 |
+
--sidebar-foreground: oklch(0.95 0 0);
|
| 78 |
+
--sidebar-primary: oklch(0.65 0.25 264);
|
| 79 |
--sidebar-primary-foreground: oklch(0.985 0 0);
|
| 80 |
+
--sidebar-accent: oklch(0.40 0.02 286);
|
| 81 |
--sidebar-accent-foreground: oklch(0.985 0 0);
|
| 82 |
+
--sidebar-border: oklch(0.45 0.03 286);
|
| 83 |
+
--sidebar-ring: oklch(0.65 0.25 264);
|
| 84 |
+
}
|
| 85 |
+
|
| 86 |
+
:root.dark {
|
| 87 |
+
color-scheme: dark;
|
| 88 |
}
|
| 89 |
|
| 90 |
@layer base {
|
|
|
|
| 93 |
}
|
| 94 |
|
| 95 |
:root {
|
|
|
|
|
|
|
|
|
|
|
|
|
| 96 |
color-scheme: dark;
|
| 97 |
}
|
| 98 |
|
app/globals.css.orig
ADDED
|
@@ -0,0 +1,131 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
@import "tailwindcss";
|
| 2 |
+
@import "tw-animate-css";
|
| 3 |
+
|
| 4 |
+
@custom-variant dark (&:is(.dark *));
|
| 5 |
+
|
| 6 |
+
@theme inline {
|
| 7 |
+
--color-background: var(--background);
|
| 8 |
+
--color-foreground: var(--foreground);
|
| 9 |
+
--font-sans: var(--font-geist-sans);
|
| 10 |
+
--font-mono: var(--font-geist-mono);
|
| 11 |
+
--color-sidebar-ring: var(--sidebar-ring);
|
| 12 |
+
--color-sidebar-border: var(--sidebar-border);
|
| 13 |
+
--color-sidebar-accent-foreground: var(--sidebar-accent-foreground);
|
| 14 |
+
--color-sidebar-accent: var(--sidebar-accent);
|
| 15 |
+
--color-sidebar-primary-foreground: var(--sidebar-primary-foreground);
|
| 16 |
+
--color-sidebar-primary: var(--sidebar-primary);
|
| 17 |
+
--color-sidebar-foreground: var(--sidebar-foreground);
|
| 18 |
+
--color-sidebar: var(--sidebar);
|
| 19 |
+
--color-chart-5: var(--chart-5);
|
| 20 |
+
--color-chart-4: var(--chart-4);
|
| 21 |
+
--color-chart-3: var(--chart-3);
|
| 22 |
+
--color-chart-2: var(--chart-2);
|
| 23 |
+
--color-chart-1: var(--chart-1);
|
| 24 |
+
--color-ring: var(--ring);
|
| 25 |
+
--color-input: var(--input);
|
| 26 |
+
--color-border: var(--border);
|
| 27 |
+
--color-destructive: var(--destructive);
|
| 28 |
+
--color-accent-foreground: var(--accent-foreground);
|
| 29 |
+
--color-accent: var(--accent);
|
| 30 |
+
--color-muted-foreground: var(--muted-foreground);
|
| 31 |
+
--color-muted: var(--muted);
|
| 32 |
+
--color-secondary-foreground: var(--secondary-foreground);
|
| 33 |
+
--color-secondary: var(--secondary);
|
| 34 |
+
--color-primary-foreground: var(--primary-foreground);
|
| 35 |
+
--color-primary: var(--primary);
|
| 36 |
+
--color-popover-foreground: var(--popover-foreground);
|
| 37 |
+
--color-popover: var(--popover);
|
| 38 |
+
--color-card-foreground: var(--card-foreground);
|
| 39 |
+
--color-card: var(--card);
|
| 40 |
+
--radius-sm: calc(var(--radius) - 4px);
|
| 41 |
+
--radius-md: calc(var(--radius) - 2px);
|
| 42 |
+
--radius-lg: var(--radius);
|
| 43 |
+
--radius-xl: calc(var(--radius) + 4px);
|
| 44 |
+
}
|
| 45 |
+
|
| 46 |
+
:root {
|
| 47 |
+
--radius: 0.625rem;
|
| 48 |
+
--background: oklch(1 0 0);
|
| 49 |
+
--foreground: oklch(0.141 0.005 285.823);
|
| 50 |
+
--card: oklch(1 0 0);
|
| 51 |
+
--card-foreground: oklch(0.141 0.005 285.823);
|
| 52 |
+
--popover: oklch(1 0 0);
|
| 53 |
+
--popover-foreground: oklch(0.141 0.005 285.823);
|
| 54 |
+
--primary: oklch(0.21 0.006 285.885);
|
| 55 |
+
--primary-foreground: oklch(0.985 0 0);
|
| 56 |
+
--secondary: oklch(0.967 0.001 286.375);
|
| 57 |
+
--secondary-foreground: oklch(0.21 0.006 285.885);
|
| 58 |
+
--muted: oklch(0.967 0.001 286.375);
|
| 59 |
+
--muted-foreground: oklch(0.552 0.016 285.938);
|
| 60 |
+
--accent: oklch(0.967 0.001 286.375);
|
| 61 |
+
--accent-foreground: oklch(0.21 0.006 285.885);
|
| 62 |
+
--destructive: oklch(0.577 0.245 27.325);
|
| 63 |
+
--border: oklch(0.92 0.004 286.32);
|
| 64 |
+
--input: oklch(0.92 0.004 286.32);
|
| 65 |
+
--ring: oklch(0.705 0.015 286.067);
|
| 66 |
+
--chart-1: oklch(0.646 0.222 41.116);
|
| 67 |
+
--chart-2: oklch(0.6 0.118 184.704);
|
| 68 |
+
--chart-3: oklch(0.398 0.07 227.392);
|
| 69 |
+
--chart-4: oklch(0.828 0.189 84.429);
|
| 70 |
+
--chart-5: oklch(0.769 0.188 70.08);
|
| 71 |
+
--sidebar: oklch(0.985 0 0);
|
| 72 |
+
--sidebar-foreground: oklch(0.141 0.005 285.823);
|
| 73 |
+
--sidebar-primary: oklch(0.21 0.006 285.885);
|
| 74 |
+
--sidebar-primary-foreground: oklch(0.985 0 0);
|
| 75 |
+
--sidebar-accent: oklch(0.967 0.001 286.375);
|
| 76 |
+
--sidebar-accent-foreground: oklch(0.21 0.006 285.885);
|
| 77 |
+
--sidebar-border: oklch(0.92 0.004 286.32);
|
| 78 |
+
--sidebar-ring: oklch(0.705 0.015 286.067);
|
| 79 |
+
}
|
| 80 |
+
|
| 81 |
+
.dark {
|
| 82 |
+
--background: oklch(0.141 0.005 285.823);
|
| 83 |
+
--foreground: oklch(0.985 0 0);
|
| 84 |
+
--card: oklch(0.21 0.006 285.885);
|
| 85 |
+
--card-foreground: oklch(0.985 0 0);
|
| 86 |
+
--popover: oklch(0.21 0.006 285.885);
|
| 87 |
+
--popover-foreground: oklch(0.985 0 0);
|
| 88 |
+
--primary: oklch(0.92 0.004 286.32);
|
| 89 |
+
--primary-foreground: oklch(0.21 0.006 285.885);
|
| 90 |
+
--secondary: oklch(0.274 0.006 286.033);
|
| 91 |
+
--secondary-foreground: oklch(0.985 0 0);
|
| 92 |
+
--muted: oklch(0.274 0.006 286.033);
|
| 93 |
+
--muted-foreground: oklch(0.705 0.015 286.067);
|
| 94 |
+
--accent: oklch(0.274 0.006 286.033);
|
| 95 |
+
--accent-foreground: oklch(0.985 0 0);
|
| 96 |
+
--destructive: oklch(0.704 0.191 22.216);
|
| 97 |
+
--border: oklch(1 0 0 / 10%);
|
| 98 |
+
--input: oklch(1 0 0 / 15%);
|
| 99 |
+
--ring: oklch(0.552 0.016 285.938);
|
| 100 |
+
--chart-1: oklch(0.488 0.243 264.376);
|
| 101 |
+
--chart-2: oklch(0.696 0.17 162.48);
|
| 102 |
+
--chart-3: oklch(0.769 0.188 70.08);
|
| 103 |
+
--chart-4: oklch(0.627 0.265 303.9);
|
| 104 |
+
--chart-5: oklch(0.645 0.246 16.439);
|
| 105 |
+
--sidebar: oklch(0.21 0.006 285.885);
|
| 106 |
+
--sidebar-foreground: oklch(0.985 0 0);
|
| 107 |
+
--sidebar-primary: oklch(0.488 0.243 264.376);
|
| 108 |
+
--sidebar-primary-foreground: oklch(0.985 0 0);
|
| 109 |
+
--sidebar-accent: oklch(0.274 0.006 286.033);
|
| 110 |
+
--sidebar-accent-foreground: oklch(0.985 0 0);
|
| 111 |
+
--sidebar-border: oklch(1 0 0 / 10%);
|
| 112 |
+
--sidebar-ring: oklch(0.552 0.016 285.938);
|
| 113 |
+
}
|
| 114 |
+
|
| 115 |
+
@layer base {
|
| 116 |
+
* {
|
| 117 |
+
@apply border-border outline-ring/50;
|
| 118 |
+
}
|
| 119 |
+
|
| 120 |
+
:root {
|
| 121 |
+
color-scheme: light;
|
| 122 |
+
}
|
| 123 |
+
|
| 124 |
+
:root.dark {
|
| 125 |
+
color-scheme: dark;
|
| 126 |
+
}
|
| 127 |
+
|
| 128 |
+
body {
|
| 129 |
+
@apply bg-background text-foreground;
|
| 130 |
+
}
|
| 131 |
+
}
|
components/assistant-ui/threadlist-sidebar.tsx
CHANGED
|
@@ -3,92 +3,69 @@
|
|
| 3 |
// SPDX-License-Identifier: MIT
|
| 4 |
//
|
| 5 |
|
| 6 |
-
import * as React from "react";
|
| 7 |
-
import
|
| 8 |
-
import
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
} from "@/components/ui/
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
|
| 37 |
-
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
|
| 41 |
-
|
| 42 |
-
</span>
|
| 43 |
-
</div>
|
| 44 |
-
</Link>
|
| 45 |
-
</SidebarMenuButton>
|
| 46 |
-
</SidebarMenuItem>
|
| 47 |
-
</SidebarMenu>
|
| 48 |
-
</div>
|
| 49 |
-
</SidebarHeader>
|
| 50 |
-
<SidebarContent className="aui-sidebar-content px-2">
|
| 51 |
-
<ThreadList />
|
| 52 |
-
</SidebarContent>
|
| 53 |
-
<SidebarRail />
|
| 54 |
-
<SidebarFooter className="aui-sidebar-footer border-t">
|
| 55 |
-
<SidebarMenu>
|
| 56 |
-
<SidebarMenuItem>
|
| 57 |
-
<SidebarMenuButton size="lg" asChild>
|
| 58 |
-
<Link
|
| 59 |
-
href="https://umint-openwebui.hf.space"
|
| 60 |
-
target="_blank"
|
| 61 |
-
rel="noopener noreferrer"
|
| 62 |
-
>
|
| 63 |
-
<div className="aui-sidebar-footer-heading flex flex-col gap-0.5 leading-none">
|
| 64 |
-
<span className="aui-sidebar-footer-title font-semibold inline-flex items-center gap-1">
|
| 65 |
Switch to the full version
|
| 66 |
-
<svg
|
| 67 |
-
width="7.5"
|
| 68 |
-
height="7.5"
|
| 69 |
-
viewBox="0 0 12 12"
|
| 70 |
-
fill="none"
|
| 71 |
-
xmlns="http://www.w3.org/2000/svg"
|
| 72 |
-
className="inline-block"
|
| 73 |
-
>
|
| 74 |
-
<path
|
| 75 |
-
d="M3.5 1.5L8.5 1.5L8.5 6.5M8.5 1.5L1.5 8.5L8.5 1.5Z"
|
| 76 |
-
stroke="currentColor"
|
| 77 |
-
strokeWidth="1.5"
|
| 78 |
-
strokeLinecap="round"
|
| 79 |
-
strokeLinejoin="round"
|
| 80 |
-
/>
|
| 81 |
-
</svg>
|
| 82 |
-
</span>
|
| 83 |
-
|
| 84 |
-
|
| 85 |
-
|
| 86 |
-
</
|
| 87 |
-
</
|
| 88 |
-
</SidebarMenuButton>
|
| 89 |
-
</SidebarMenuItem>
|
| 90 |
-
</SidebarMenu>
|
| 91 |
-
</SidebarFooter>
|
| 92 |
-
</Sidebar>
|
| 93 |
-
);
|
| 94 |
}
|
|
|
|
| 3 |
// SPDX-License-Identifier: MIT
|
| 4 |
//
|
| 5 |
|
| 6 |
+
import * as React from "react";
|
| 7 |
+
import Link from "next/link";
|
| 8 |
+
import {
|
| 9 |
+
Sidebar,
|
| 10 |
+
SidebarContent,
|
| 11 |
+
SidebarFooter,
|
| 12 |
+
SidebarHeader,
|
| 13 |
+
SidebarMenu,
|
| 14 |
+
SidebarMenuButton,
|
| 15 |
+
SidebarMenuItem,
|
| 16 |
+
SidebarRail,
|
| 17 |
+
} from "@/components/ui/sidebar";
|
| 18 |
+
import { ThreadList } from "@/components/assistant-ui/thread-list";
|
| 19 |
+
|
| 20 |
+
export function ThreadListSidebar({
|
| 21 |
+
...props
|
| 22 |
+
}: React.ComponentProps<typeof Sidebar>) {
|
| 23 |
+
return (
|
| 24 |
+
<Sidebar {...props}>
|
| 25 |
+
<SidebarHeader className="aui-sidebar-header h-0.2">
|
| 26 |
+
</SidebarHeader>
|
| 27 |
+
<SidebarContent className="aui-sidebar-content px-2">
|
| 28 |
+
<ThreadList />
|
| 29 |
+
</SidebarContent>
|
| 30 |
+
<SidebarRail />
|
| 31 |
+
<SidebarFooter className="aui-sidebar-footer">
|
| 32 |
+
<SidebarMenu>
|
| 33 |
+
<SidebarMenuItem>
|
| 34 |
+
<SidebarMenuButton size="lg">
|
| 35 |
+
<div className="aui-sidebar-footer-heading flex flex-col gap-0.5 leading-none w-full">
|
| 36 |
+
<Link
|
| 37 |
+
href="https://umint-openwebui.hf.space"
|
| 38 |
+
target="_blank"
|
| 39 |
+
rel="noopener noreferrer"
|
| 40 |
+
>
|
| 41 |
+
<span className="aui-sidebar-footer-title font-semibold inline-flex items-center gap-1">
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 42 |
Switch to the full version
|
| 43 |
+
<svg
|
| 44 |
+
width="7.5"
|
| 45 |
+
height="7.5"
|
| 46 |
+
viewBox="0 0 12 12"
|
| 47 |
+
fill="none"
|
| 48 |
+
xmlns="http://www.w3.org/2000/svg"
|
| 49 |
+
className="inline-block"
|
| 50 |
+
>
|
| 51 |
+
<path
|
| 52 |
+
d="M3.5 1.5L8.5 1.5L8.5 6.5M8.5 1.5L1.5 8.5L8.5 1.5Z"
|
| 53 |
+
stroke="currentColor"
|
| 54 |
+
strokeWidth="1.5"
|
| 55 |
+
strokeLinecap="round"
|
| 56 |
+
strokeLinejoin="round"
|
| 57 |
+
/>
|
| 58 |
+
</svg>
|
| 59 |
+
</span>
|
| 60 |
+
</Link>
|
| 61 |
+
<span className="text-[8.5px] text-muted-foreground leading-tight">
|
| 62 |
+
for a more advanced experience, rich in features, and access to a more complete set of premium AI models
|
| 63 |
+
</span>
|
| 64 |
+
</div>
|
| 65 |
+
</SidebarMenuButton>
|
| 66 |
+
</SidebarMenuItem>
|
| 67 |
+
</SidebarMenu>
|
| 68 |
+
</SidebarFooter>
|
| 69 |
+
</Sidebar>
|
| 70 |
+
);
|
| 71 |
}
|
config.ts
CHANGED
|
@@ -7,6 +7,8 @@ export default {
|
|
| 7 |
api: {
|
| 8 |
baseUrl: process.env.OPENAI_API_BASE_URL, // /v1
|
| 9 |
key: process.env.OPENAI_API_KEY,
|
| 10 |
-
model: "openai/gpt-5-chat-latest"
|
|
|
|
|
|
|
| 11 |
}
|
| 12 |
};
|
|
|
|
| 7 |
api: {
|
| 8 |
baseUrl: process.env.OPENAI_API_BASE_URL, // /v1
|
| 9 |
key: process.env.OPENAI_API_KEY,
|
| 10 |
+
model: "openai/gpt-5-chat-latest",
|
| 11 |
+
maxRetries: 5,
|
| 12 |
+
timeout: 20000 // 20 seconds
|
| 13 |
}
|
| 14 |
};
|