Spaces:
Sleeping
Sleeping
fix:wesbite UI
Browse files- frontend/app/globals.css +39 -23
- frontend/app/layout.tsx +7 -2
- frontend/app/page.tsx +27 -21
- frontend/components/Chat.tsx +41 -39
- frontend/components/VideoCard.tsx +21 -21
frontend/app/globals.css
CHANGED
|
@@ -2,24 +2,31 @@
|
|
| 2 |
@tailwind components;
|
| 3 |
@tailwind utilities;
|
| 4 |
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
|
|
|
| 8 |
|
| 9 |
-
body {
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
|
|
|
|
|
|
|
|
|
| 15 |
}
|
| 16 |
|
| 17 |
/* Thin, unobtrusive scrollbars inside scroll areas */
|
| 18 |
.scroll-slim::-webkit-scrollbar {
|
| 19 |
-
width:
|
| 20 |
}
|
| 21 |
.scroll-slim::-webkit-scrollbar-thumb {
|
| 22 |
-
@apply rounded-full bg-neutral-
|
|
|
|
|
|
|
|
|
|
| 23 |
}
|
| 24 |
|
| 25 |
@keyframes blink {
|
|
@@ -27,34 +34,43 @@ body {
|
|
| 27 |
50% { opacity: 1; }
|
| 28 |
}
|
| 29 |
.typing-dot {
|
| 30 |
-
animation: blink 1.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 31 |
}
|
| 32 |
|
| 33 |
/* Compact markdown styling for streamed answers inside chat bubbles */
|
| 34 |
.md > :first-child { margin-top: 0; }
|
| 35 |
.md > :last-child { margin-bottom: 0; }
|
| 36 |
.md h1, .md h2, .md h3 {
|
| 37 |
-
@apply mb-1 mt-3 font-semibold text-neutral-
|
| 38 |
}
|
| 39 |
.md h1 { @apply text-base; }
|
| 40 |
.md h2 { @apply text-sm; }
|
| 41 |
.md h3 { @apply text-sm; }
|
| 42 |
-
.md p { @apply my-
|
| 43 |
-
.md ul { @apply my-
|
| 44 |
-
.md ol { @apply my-
|
| 45 |
-
.md strong { @apply font-semibold text-neutral-
|
| 46 |
.md em { @apply italic; }
|
| 47 |
.md code {
|
| 48 |
-
@apply rounded bg-neutral-
|
| 49 |
}
|
| 50 |
-
.md hr { @apply my-
|
| 51 |
.md table {
|
| 52 |
-
@apply my-
|
| 53 |
}
|
| 54 |
.md th, .md td {
|
| 55 |
-
@apply border border-neutral-
|
| 56 |
}
|
| 57 |
-
.md th { @apply bg-neutral-50 font-semibold; }
|
| 58 |
.md blockquote {
|
| 59 |
-
@apply border-l-2 border-
|
| 60 |
}
|
|
|
|
| 2 |
@tailwind components;
|
| 3 |
@tailwind utilities;
|
| 4 |
|
| 5 |
+
@layer base {
|
| 6 |
+
:root {
|
| 7 |
+
--bg: #09090b; /* neutral-950 equivalent */
|
| 8 |
+
}
|
| 9 |
|
| 10 |
+
body {
|
| 11 |
+
background-color: var(--bg);
|
| 12 |
+
/* Deep animated radial gradient background for premium feel */
|
| 13 |
+
background-image:
|
| 14 |
+
radial-gradient(50vw 50vh at 100% 0%, rgba(99, 102, 241, 0.15), transparent 70%),
|
| 15 |
+
radial-gradient(50vw 50vh at 0% 100%, rgba(139, 92, 246, 0.1), transparent 70%);
|
| 16 |
+
background-attachment: fixed;
|
| 17 |
+
background-size: cover;
|
| 18 |
+
}
|
| 19 |
}
|
| 20 |
|
| 21 |
/* Thin, unobtrusive scrollbars inside scroll areas */
|
| 22 |
.scroll-slim::-webkit-scrollbar {
|
| 23 |
+
width: 6px;
|
| 24 |
}
|
| 25 |
.scroll-slim::-webkit-scrollbar-thumb {
|
| 26 |
+
@apply rounded-full bg-neutral-800;
|
| 27 |
+
}
|
| 28 |
+
.scroll-slim::-webkit-scrollbar-track {
|
| 29 |
+
@apply bg-transparent;
|
| 30 |
}
|
| 31 |
|
| 32 |
@keyframes blink {
|
|
|
|
| 34 |
50% { opacity: 1; }
|
| 35 |
}
|
| 36 |
.typing-dot {
|
| 37 |
+
animation: blink 1.4s infinite both;
|
| 38 |
+
}
|
| 39 |
+
|
| 40 |
+
/* Enter animations */
|
| 41 |
+
@keyframes slideUpFade {
|
| 42 |
+
0% { opacity: 0; transform: translateY(10px); }
|
| 43 |
+
100% { opacity: 1; transform: translateY(0); }
|
| 44 |
+
}
|
| 45 |
+
.animate-slide-up {
|
| 46 |
+
animation: slideUpFade 0.4s ease-out forwards;
|
| 47 |
}
|
| 48 |
|
| 49 |
/* Compact markdown styling for streamed answers inside chat bubbles */
|
| 50 |
.md > :first-child { margin-top: 0; }
|
| 51 |
.md > :last-child { margin-bottom: 0; }
|
| 52 |
.md h1, .md h2, .md h3 {
|
| 53 |
+
@apply mb-1 mt-3 font-semibold text-neutral-100;
|
| 54 |
}
|
| 55 |
.md h1 { @apply text-base; }
|
| 56 |
.md h2 { @apply text-sm; }
|
| 57 |
.md h3 { @apply text-sm; }
|
| 58 |
+
.md p { @apply my-2 leading-relaxed; }
|
| 59 |
+
.md ul { @apply my-2 list-disc space-y-1 pl-4; }
|
| 60 |
+
.md ol { @apply my-2 list-decimal space-y-1 pl-4; }
|
| 61 |
+
.md strong { @apply font-semibold text-neutral-50; }
|
| 62 |
.md em { @apply italic; }
|
| 63 |
.md code {
|
| 64 |
+
@apply rounded-md bg-neutral-800 px-1.5 py-0.5 text-[12px] font-mono text-indigo-200;
|
| 65 |
}
|
| 66 |
+
.md hr { @apply my-3 border-neutral-800; }
|
| 67 |
.md table {
|
| 68 |
+
@apply my-3 w-full border-collapse text-[12px];
|
| 69 |
}
|
| 70 |
.md th, .md td {
|
| 71 |
+
@apply border border-neutral-800 px-2.5 py-1.5 text-left align-top;
|
| 72 |
}
|
| 73 |
+
.md th { @apply bg-neutral-900/50 font-semibold; }
|
| 74 |
.md blockquote {
|
| 75 |
+
@apply border-l-2 border-indigo-500 pl-3 text-neutral-400 italic my-2;
|
| 76 |
}
|
frontend/app/layout.tsx
CHANGED
|
@@ -1,6 +1,9 @@
|
|
| 1 |
import type { Metadata } from "next";
|
|
|
|
| 2 |
import "./globals.css";
|
| 3 |
|
|
|
|
|
|
|
| 4 |
export const metadata: Metadata = {
|
| 5 |
title: "creator-rag",
|
| 6 |
description: "Compare two short-form videos and ask why one outperformed the other.",
|
|
@@ -10,8 +13,10 @@ export default function RootLayout({
|
|
| 10 |
children,
|
| 11 |
}: Readonly<{ children: React.ReactNode }>) {
|
| 12 |
return (
|
| 13 |
-
<html lang="en">
|
| 14 |
-
<body
|
|
|
|
|
|
|
| 15 |
</html>
|
| 16 |
);
|
| 17 |
}
|
|
|
|
| 1 |
import type { Metadata } from "next";
|
| 2 |
+
import { Inter } from "next/font/google";
|
| 3 |
import "./globals.css";
|
| 4 |
|
| 5 |
+
const inter = Inter({ subsets: ["latin"], variable: "--font-inter" });
|
| 6 |
+
|
| 7 |
export const metadata: Metadata = {
|
| 8 |
title: "creator-rag",
|
| 9 |
description: "Compare two short-form videos and ask why one outperformed the other.",
|
|
|
|
| 13 |
children,
|
| 14 |
}: Readonly<{ children: React.ReactNode }>) {
|
| 15 |
return (
|
| 16 |
+
<html lang="en" className="dark">
|
| 17 |
+
<body className={`${inter.variable} font-sans bg-neutral-950 text-neutral-50 antialiased selection:bg-indigo-500/30`}>
|
| 18 |
+
{children}
|
| 19 |
+
</body>
|
| 20 |
</html>
|
| 21 |
);
|
| 22 |
}
|
frontend/app/page.tsx
CHANGED
|
@@ -43,23 +43,22 @@ export default function Home() {
|
|
| 43 |
: null;
|
| 44 |
|
| 45 |
return (
|
| 46 |
-
<main className="mx-auto max-w-6xl px-4 py-
|
| 47 |
-
<header className="mb-
|
| 48 |
-
<div className="flex items-center
|
| 49 |
-
<span className="
|
| 50 |
-
▶
|
| 51 |
-
</span>
|
| 52 |
-
<h1 className="text-2xl font-bold tracking-tight">creator-rag</h1>
|
| 53 |
</div>
|
| 54 |
-
<
|
| 55 |
-
|
| 56 |
-
|
|
|
|
|
|
|
| 57 |
</p>
|
| 58 |
</header>
|
| 59 |
|
| 60 |
<form
|
| 61 |
onSubmit={onIngest}
|
| 62 |
-
className="mb-
|
| 63 |
>
|
| 64 |
<UrlInput
|
| 65 |
value={youtubeUrl}
|
|
@@ -76,19 +75,26 @@ export default function Home() {
|
|
| 76 |
<button
|
| 77 |
type="submit"
|
| 78 |
disabled={loading || !youtubeUrl || !instagramUrl}
|
| 79 |
-
className="rounded-
|
| 80 |
>
|
| 81 |
-
{loading ?
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 82 |
</button>
|
| 83 |
</form>
|
| 84 |
|
| 85 |
{error && (
|
| 86 |
-
<div className="mb-
|
| 87 |
{error}
|
| 88 |
</div>
|
| 89 |
)}
|
| 90 |
|
| 91 |
-
<div className="grid gap-6 lg:grid-cols-[1fr_1fr_minmax(
|
| 92 |
{videos.map((v) => (
|
| 93 |
<VideoCard key={v.video_id} video={v} isWinner={v.video_id === winnerId} />
|
| 94 |
))}
|
|
@@ -96,13 +102,13 @@ export default function Home() {
|
|
| 96 |
Array.from({ length: Math.max(0, 2 - videos.length) }).map((_, i) => (
|
| 97 |
<div
|
| 98 |
key={`ph-${i}`}
|
| 99 |
-
className="flex min-h-[
|
| 100 |
>
|
| 101 |
-
|
| 102 |
</div>
|
| 103 |
))}
|
| 104 |
|
| 105 |
-
<div className="h-[
|
| 106 |
<Chat enabled={ready} />
|
| 107 |
</div>
|
| 108 |
</div>
|
|
@@ -122,13 +128,13 @@ function UrlInput({
|
|
| 122 |
icon: string;
|
| 123 |
}) {
|
| 124 |
return (
|
| 125 |
-
<div className="flex items-center gap-
|
| 126 |
-
<span className="text-neutral-
|
| 127 |
<input
|
| 128 |
value={value}
|
| 129 |
onChange={(e) => onChange(e.target.value)}
|
| 130 |
placeholder={placeholder}
|
| 131 |
-
className="w-full bg-transparent py-
|
| 132 |
/>
|
| 133 |
</div>
|
| 134 |
);
|
|
|
|
| 43 |
: null;
|
| 44 |
|
| 45 |
return (
|
| 46 |
+
<main className="mx-auto max-w-6xl px-4 py-12 animate-slide-up">
|
| 47 |
+
<header className="mb-12 flex flex-col items-center text-center">
|
| 48 |
+
<div className="mb-4 flex h-14 w-14 items-center justify-center rounded-2xl bg-gradient-to-br from-indigo-500 to-purple-600 shadow-lg shadow-indigo-500/20">
|
| 49 |
+
<span className="text-2xl text-white">▶</span>
|
|
|
|
|
|
|
|
|
|
| 50 |
</div>
|
| 51 |
+
<h1 className="text-4xl font-extrabold tracking-tight text-white sm:text-5xl">
|
| 52 |
+
creator<span className="text-indigo-400">-rag</span>
|
| 53 |
+
</h1>
|
| 54 |
+
<p className="mt-4 max-w-xl text-lg text-neutral-400">
|
| 55 |
+
Compare a YouTube video and an Instagram Reel — and discover the deeper reasons why one outperformed the other.
|
| 56 |
</p>
|
| 57 |
</header>
|
| 58 |
|
| 59 |
<form
|
| 60 |
onSubmit={onIngest}
|
| 61 |
+
className="mx-auto mb-12 grid max-w-4xl gap-4 rounded-3xl border border-white/10 bg-white/5 p-4 shadow-xl backdrop-blur-xl sm:grid-cols-[1fr_1fr_auto]"
|
| 62 |
>
|
| 63 |
<UrlInput
|
| 64 |
value={youtubeUrl}
|
|
|
|
| 75 |
<button
|
| 76 |
type="submit"
|
| 77 |
disabled={loading || !youtubeUrl || !instagramUrl}
|
| 78 |
+
className="group relative flex items-center justify-center overflow-hidden rounded-2xl bg-indigo-600 px-6 py-3.5 text-sm font-semibold text-white shadow-lg transition-all hover:scale-[1.02] hover:bg-indigo-500 hover:shadow-indigo-500/25 disabled:pointer-events-none disabled:opacity-50"
|
| 79 |
>
|
| 80 |
+
{loading ? (
|
| 81 |
+
<span className="flex items-center gap-2">
|
| 82 |
+
<span className="h-4 w-4 animate-spin rounded-full border-2 border-white/30 border-t-white"></span>
|
| 83 |
+
Ingesting…
|
| 84 |
+
</span>
|
| 85 |
+
) : (
|
| 86 |
+
"Ingest Pair"
|
| 87 |
+
)}
|
| 88 |
</button>
|
| 89 |
</form>
|
| 90 |
|
| 91 |
{error && (
|
| 92 |
+
<div className="mx-auto mb-10 max-w-3xl rounded-2xl border border-red-500/20 bg-red-500/10 px-6 py-4 text-center text-sm font-medium text-red-400 backdrop-blur-md">
|
| 93 |
{error}
|
| 94 |
</div>
|
| 95 |
)}
|
| 96 |
|
| 97 |
+
<div className="grid gap-4 lg:gap-6 lg:grid-cols-[1fr_1fr_minmax(320px,1.2fr)]">
|
| 98 |
{videos.map((v) => (
|
| 99 |
<VideoCard key={v.video_id} video={v} isWinner={v.video_id === winnerId} />
|
| 100 |
))}
|
|
|
|
| 102 |
Array.from({ length: Math.max(0, 2 - videos.length) }).map((_, i) => (
|
| 103 |
<div
|
| 104 |
key={`ph-${i}`}
|
| 105 |
+
className="flex min-h-[250px] items-center justify-center rounded-[1.25rem] border border-dashed border-white/10 bg-white/5 text-sm font-medium text-neutral-500 backdrop-blur-sm"
|
| 106 |
>
|
| 107 |
+
Awaiting ingest...
|
| 108 |
</div>
|
| 109 |
))}
|
| 110 |
|
| 111 |
+
<div className="h-[450px] lg:h-[500px]">
|
| 112 |
<Chat enabled={ready} />
|
| 113 |
</div>
|
| 114 |
</div>
|
|
|
|
| 128 |
icon: string;
|
| 129 |
}) {
|
| 130 |
return (
|
| 131 |
+
<div className="flex items-center gap-3 rounded-2xl border border-white/10 bg-black/20 px-4 transition-all focus-within:border-indigo-500/50 focus-within:bg-black/40 focus-within:ring-4 focus-within:ring-indigo-500/10 hover:border-white/20">
|
| 132 |
+
<span className="text-neutral-500">{icon}</span>
|
| 133 |
<input
|
| 134 |
value={value}
|
| 135 |
onChange={(e) => onChange(e.target.value)}
|
| 136 |
placeholder={placeholder}
|
| 137 |
+
className="w-full bg-transparent py-3.5 text-sm font-medium text-white placeholder-neutral-500 outline-none"
|
| 138 |
/>
|
| 139 |
</div>
|
| 140 |
);
|
frontend/components/Chat.tsx
CHANGED
|
@@ -20,9 +20,9 @@ const SUGGESTIONS = [
|
|
| 20 |
];
|
| 21 |
|
| 22 |
const INTENT_STYLE: Record<string, string> = {
|
| 23 |
-
quantitative: "bg-emerald-
|
| 24 |
-
qualitative: "bg-sky-
|
| 25 |
-
hybrid: "bg-violet-
|
| 26 |
};
|
| 27 |
|
| 28 |
export default function Chat({ enabled }: { enabled: boolean }) {
|
|
@@ -73,24 +73,24 @@ export default function Chat({ enabled }: { enabled: boolean }) {
|
|
| 73 |
}
|
| 74 |
|
| 75 |
return (
|
| 76 |
-
<div className="flex h-full flex-col overflow-hidden rounded-
|
| 77 |
-
<div className="flex items-center gap-
|
| 78 |
-
<span className="flex h-
|
| 79 |
✦
|
| 80 |
</span>
|
| 81 |
-
<span className="text-sm font-semibold">Ask about the comparison</span>
|
| 82 |
</div>
|
| 83 |
|
| 84 |
-
<div ref={scrollRef} className="scroll-slim flex-1 space-y-
|
| 85 |
{messages.length === 0 && (
|
| 86 |
-
<div className="space-y-
|
| 87 |
-
<p className="text-xs font-
|
| 88 |
{SUGGESTIONS.map((s) => (
|
| 89 |
<button
|
| 90 |
key={s}
|
| 91 |
onClick={() => send(s)}
|
| 92 |
disabled={!enabled || busy}
|
| 93 |
-
className="block w-full rounded-
|
| 94 |
>
|
| 95 |
{s}
|
| 96 |
</button>
|
|
@@ -99,12 +99,12 @@ export default function Chat({ enabled }: { enabled: boolean }) {
|
|
| 99 |
)}
|
| 100 |
|
| 101 |
{messages.map((m, i) => (
|
| 102 |
-
<div key={i} className={m.role === "user" ? "text-right" : "text-left"}>
|
| 103 |
<div
|
| 104 |
-
className={`inline-block max-w-[
|
| 105 |
m.role === "user"
|
| 106 |
-
? "whitespace-pre-wrap rounded-br-
|
| 107 |
-
: "rounded-bl-
|
| 108 |
}`}
|
| 109 |
>
|
| 110 |
{m.role === "assistant" && m.content ? (
|
|
@@ -118,18 +118,18 @@ export default function Chat({ enabled }: { enabled: boolean }) {
|
|
| 118 |
)}
|
| 119 |
{m.role === "assistant" && busy && !m.content && !m.error ? (
|
| 120 |
<span className="inline-flex gap-1">
|
| 121 |
-
<span className="typing-dot">
|
| 122 |
-
<span className="typing-dot" style={{ animationDelay: "0.2s" }}>
|
| 123 |
-
<span className="typing-dot" style={{ animationDelay: "0.4s" }}>
|
| 124 |
</span>
|
| 125 |
) : null}
|
| 126 |
</div>
|
| 127 |
|
| 128 |
{m.role === "assistant" && m.intent && (
|
| 129 |
-
<div className="mt-
|
| 130 |
<span
|
| 131 |
-
className={`rounded-full px-2 py-0.5 text-[10px] font-
|
| 132 |
-
INTENT_STYLE[m.intent] ?? "bg-neutral-
|
| 133 |
}`}
|
| 134 |
>
|
| 135 |
{m.intent}
|
|
@@ -138,11 +138,11 @@ export default function Chat({ enabled }: { enabled: boolean }) {
|
|
| 138 |
)}
|
| 139 |
|
| 140 |
{m.role === "assistant" && m.citations && m.citations.length > 0 && (
|
| 141 |
-
<div className="mt-
|
| 142 |
{m.citations.map((c) => (
|
| 143 |
<span
|
| 144 |
key={c.chunk_id}
|
| 145 |
-
className="rounded-
|
| 146 |
>
|
| 147 |
Video {c.video_id} · chunk {c.chunk_id} · {c.modality}
|
| 148 |
</span>
|
|
@@ -151,7 +151,7 @@ export default function Chat({ enabled }: { enabled: boolean }) {
|
|
| 151 |
)}
|
| 152 |
|
| 153 |
{m.role === "assistant" && m.error && (
|
| 154 |
-
<div className="mt-
|
| 155 |
⚠️ {m.error}
|
| 156 |
</div>
|
| 157 |
)}
|
|
@@ -164,22 +164,24 @@ export default function Chat({ enabled }: { enabled: boolean }) {
|
|
| 164 |
e.preventDefault();
|
| 165 |
send(input);
|
| 166 |
}}
|
| 167 |
-
className="
|
| 168 |
>
|
| 169 |
-
<
|
| 170 |
-
|
| 171 |
-
|
| 172 |
-
|
| 173 |
-
|
| 174 |
-
|
| 175 |
-
|
| 176 |
-
|
| 177 |
-
|
| 178 |
-
|
| 179 |
-
|
| 180 |
-
|
| 181 |
-
|
| 182 |
-
|
|
|
|
|
|
|
| 183 |
</form>
|
| 184 |
</div>
|
| 185 |
);
|
|
|
|
| 20 |
];
|
| 21 |
|
| 22 |
const INTENT_STYLE: Record<string, string> = {
|
| 23 |
+
quantitative: "bg-emerald-500/10 text-emerald-400 border border-emerald-500/20",
|
| 24 |
+
qualitative: "bg-sky-500/10 text-sky-400 border border-sky-500/20",
|
| 25 |
+
hybrid: "bg-violet-500/10 text-violet-400 border border-violet-500/20",
|
| 26 |
};
|
| 27 |
|
| 28 |
export default function Chat({ enabled }: { enabled: boolean }) {
|
|
|
|
| 73 |
}
|
| 74 |
|
| 75 |
return (
|
| 76 |
+
<div className="flex h-full flex-col overflow-hidden rounded-[1.25rem] border border-white/10 bg-black/40 shadow-xl backdrop-blur-xl">
|
| 77 |
+
<div className="flex items-center gap-3 border-b border-white/10 bg-white/5 px-5 py-4 backdrop-blur-md">
|
| 78 |
+
<span className="flex h-8 w-8 items-center justify-center rounded-xl bg-indigo-500/20 text-xs text-indigo-300 shadow-inner">
|
| 79 |
✦
|
| 80 |
</span>
|
| 81 |
+
<span className="text-sm font-semibold text-neutral-200">Ask about the comparison</span>
|
| 82 |
</div>
|
| 83 |
|
| 84 |
+
<div ref={scrollRef} className="scroll-slim flex-1 space-y-6 overflow-y-auto p-5">
|
| 85 |
{messages.length === 0 && (
|
| 86 |
+
<div className="space-y-3 animate-slide-up">
|
| 87 |
+
<p className="text-xs font-semibold uppercase tracking-widest text-neutral-500">Suggested Questions</p>
|
| 88 |
{SUGGESTIONS.map((s) => (
|
| 89 |
<button
|
| 90 |
key={s}
|
| 91 |
onClick={() => send(s)}
|
| 92 |
disabled={!enabled || busy}
|
| 93 |
+
className="block w-full rounded-2xl border border-white/5 bg-white/5 px-4 py-3 text-left text-sm text-neutral-300 transition-all hover:border-indigo-500/30 hover:bg-indigo-500/10 hover:text-indigo-200 disabled:opacity-40 disabled:pointer-events-none"
|
| 94 |
>
|
| 95 |
{s}
|
| 96 |
</button>
|
|
|
|
| 99 |
)}
|
| 100 |
|
| 101 |
{messages.map((m, i) => (
|
| 102 |
+
<div key={i} className={`animate-slide-up ${m.role === "user" ? "text-right" : "text-left"}`}>
|
| 103 |
<div
|
| 104 |
+
className={`inline-block max-w-[85%] rounded-3xl px-5 py-3 text-sm leading-relaxed shadow-lg ${
|
| 105 |
m.role === "user"
|
| 106 |
+
? "whitespace-pre-wrap rounded-br-sm bg-gradient-to-r from-indigo-600 to-purple-600 text-white"
|
| 107 |
+
: "rounded-bl-sm bg-white/10 text-neutral-200 border border-white/5 backdrop-blur-md"
|
| 108 |
}`}
|
| 109 |
>
|
| 110 |
{m.role === "assistant" && m.content ? (
|
|
|
|
| 118 |
)}
|
| 119 |
{m.role === "assistant" && busy && !m.content && !m.error ? (
|
| 120 |
<span className="inline-flex gap-1">
|
| 121 |
+
<span className="typing-dot bg-neutral-400 h-1.5 w-1.5 rounded-full block"></span>
|
| 122 |
+
<span className="typing-dot bg-neutral-400 h-1.5 w-1.5 rounded-full block" style={{ animationDelay: "0.2s" }}></span>
|
| 123 |
+
<span className="typing-dot bg-neutral-400 h-1.5 w-1.5 rounded-full block" style={{ animationDelay: "0.4s" }}></span>
|
| 124 |
</span>
|
| 125 |
) : null}
|
| 126 |
</div>
|
| 127 |
|
| 128 |
{m.role === "assistant" && m.intent && (
|
| 129 |
+
<div className="mt-2">
|
| 130 |
<span
|
| 131 |
+
className={`inline-block rounded-full px-2.5 py-0.5 text-[10px] font-bold uppercase tracking-widest ${
|
| 132 |
+
INTENT_STYLE[m.intent] ?? "bg-neutral-800 text-neutral-400 border border-neutral-700"
|
| 133 |
}`}
|
| 134 |
>
|
| 135 |
{m.intent}
|
|
|
|
| 138 |
)}
|
| 139 |
|
| 140 |
{m.role === "assistant" && m.citations && m.citations.length > 0 && (
|
| 141 |
+
<div className="mt-2 flex flex-wrap gap-1.5">
|
| 142 |
{m.citations.map((c) => (
|
| 143 |
<span
|
| 144 |
key={c.chunk_id}
|
| 145 |
+
className="rounded-lg bg-black/30 px-2 py-1 text-[10px] font-medium text-neutral-400 border border-white/5"
|
| 146 |
>
|
| 147 |
Video {c.video_id} · chunk {c.chunk_id} · {c.modality}
|
| 148 |
</span>
|
|
|
|
| 151 |
)}
|
| 152 |
|
| 153 |
{m.role === "assistant" && m.error && (
|
| 154 |
+
<div className="mt-2 inline-block rounded-2xl border border-red-500/30 bg-red-500/10 px-4 py-2.5 text-left text-xs text-red-400">
|
| 155 |
⚠️ {m.error}
|
| 156 |
</div>
|
| 157 |
)}
|
|
|
|
| 164 |
e.preventDefault();
|
| 165 |
send(input);
|
| 166 |
}}
|
| 167 |
+
className="border-t border-white/10 bg-white/5 p-4 backdrop-blur-md"
|
| 168 |
>
|
| 169 |
+
<div className="flex gap-3">
|
| 170 |
+
<input
|
| 171 |
+
value={input}
|
| 172 |
+
onChange={(e) => setInput(e.target.value)}
|
| 173 |
+
disabled={!enabled || busy}
|
| 174 |
+
placeholder={enabled ? "Ask a question…" : "Ingest two videos first"}
|
| 175 |
+
className="flex-1 rounded-2xl border border-white/10 bg-black/40 px-4 py-3 text-sm text-neutral-100 placeholder-neutral-500 outline-none transition-all focus:border-indigo-500/50 focus:bg-black/60 focus:ring-4 focus:ring-indigo-500/10 disabled:opacity-50"
|
| 176 |
+
/>
|
| 177 |
+
<button
|
| 178 |
+
type="submit"
|
| 179 |
+
disabled={!enabled || busy || !input.trim()}
|
| 180 |
+
className="flex items-center justify-center rounded-2xl bg-indigo-600 px-6 py-3 text-sm font-semibold text-white shadow-lg transition-all hover:scale-[1.02] hover:bg-indigo-500 hover:shadow-indigo-500/25 disabled:pointer-events-none disabled:opacity-40"
|
| 181 |
+
>
|
| 182 |
+
Send
|
| 183 |
+
</button>
|
| 184 |
+
</div>
|
| 185 |
</form>
|
| 186 |
</div>
|
| 187 |
);
|
frontend/components/VideoCard.tsx
CHANGED
|
@@ -6,8 +6,8 @@ function fmt(n: number | null): string {
|
|
| 6 |
}
|
| 7 |
|
| 8 |
const SOURCE_STYLE: Record<string, string> = {
|
| 9 |
-
youtube: "bg-red-
|
| 10 |
-
instagram: "bg-fuchsia-
|
| 11 |
};
|
| 12 |
|
| 13 |
export default function VideoCard({
|
|
@@ -20,37 +20,37 @@ export default function VideoCard({
|
|
| 20 |
const er =
|
| 21 |
video.engagement_rate === null ? "—" : `${video.engagement_rate.toFixed(2)}%`;
|
| 22 |
const sourceClass =
|
| 23 |
-
SOURCE_STYLE[video.source] ?? "bg-neutral-
|
| 24 |
|
| 25 |
return (
|
| 26 |
<div
|
| 27 |
-
className={`relative flex flex-col rounded-
|
| 28 |
isWinner
|
| 29 |
-
? "border-indigo-
|
| 30 |
-
: "border-
|
| 31 |
}`}
|
| 32 |
>
|
| 33 |
{isWinner && (
|
| 34 |
-
<span className="absolute -top-
|
| 35 |
★ Higher engagement
|
| 36 |
</span>
|
| 37 |
)}
|
| 38 |
|
| 39 |
<div className="mb-3 flex items-center justify-between">
|
| 40 |
-
<span className="rounded-full bg-
|
| 41 |
Video {video.video_id}
|
| 42 |
</span>
|
| 43 |
<span
|
| 44 |
-
className={`rounded-full px-2 py-0.5 text-[10px] font-
|
| 45 |
>
|
| 46 |
{video.source}
|
| 47 |
</span>
|
| 48 |
</div>
|
| 49 |
|
| 50 |
-
<h3 className="mb-1 line-clamp-2 text-sm font-semibold leading-snug text-neutral-
|
| 51 |
{video.title || video.caption || video.url}
|
| 52 |
</h3>
|
| 53 |
-
<p className="mb-4 text-xs text-neutral-500">
|
| 54 |
{video.creator ? `@${video.creator}` : "unknown creator"}
|
| 55 |
{video.follower_count !== null
|
| 56 |
? ` · ${fmt(video.follower_count)} followers`
|
|
@@ -58,14 +58,14 @@ export default function VideoCard({
|
|
| 58 |
</p>
|
| 59 |
|
| 60 |
<div
|
| 61 |
-
className={`mb-4 rounded-xl p-4 text-center text-white ${
|
| 62 |
isWinner
|
| 63 |
-
? "bg-gradient-to-br from-indigo-
|
| 64 |
-
: "bg-
|
| 65 |
}`}
|
| 66 |
>
|
| 67 |
-
<div className="text-
|
| 68 |
-
<div className="text-[10px] uppercase tracking-widest
|
| 69 |
engagement rate
|
| 70 |
</div>
|
| 71 |
</div>
|
|
@@ -77,11 +77,11 @@ export default function VideoCard({
|
|
| 77 |
</dl>
|
| 78 |
|
| 79 |
{video.hashtags.length > 0 && (
|
| 80 |
-
<div className="mt-auto flex flex-wrap gap-
|
| 81 |
{video.hashtags.slice(0, 5).map((h) => (
|
| 82 |
<span
|
| 83 |
key={h}
|
| 84 |
-
className="rounded-
|
| 85 |
>
|
| 86 |
#{h}
|
| 87 |
</span>
|
|
@@ -94,9 +94,9 @@ export default function VideoCard({
|
|
| 94 |
|
| 95 |
function Stat({ label, value }: { label: string; value: string }) {
|
| 96 |
return (
|
| 97 |
-
<div className="rounded-
|
| 98 |
-
<div className="font-
|
| 99 |
-
<div className="text-[10px] uppercase tracking-
|
| 100 |
{label}
|
| 101 |
</div>
|
| 102 |
</div>
|
|
|
|
| 6 |
}
|
| 7 |
|
| 8 |
const SOURCE_STYLE: Record<string, string> = {
|
| 9 |
+
youtube: "bg-red-500/10 text-red-400 ring-red-500/30",
|
| 10 |
+
instagram: "bg-fuchsia-500/10 text-fuchsia-400 ring-fuchsia-500/30",
|
| 11 |
};
|
| 12 |
|
| 13 |
export default function VideoCard({
|
|
|
|
| 20 |
const er =
|
| 21 |
video.engagement_rate === null ? "—" : `${video.engagement_rate.toFixed(2)}%`;
|
| 22 |
const sourceClass =
|
| 23 |
+
SOURCE_STYLE[video.source] ?? "bg-neutral-800 text-neutral-400 ring-neutral-700";
|
| 24 |
|
| 25 |
return (
|
| 26 |
<div
|
| 27 |
+
className={`relative flex flex-col rounded-[1.25rem] border bg-white/5 p-4 backdrop-blur-xl transition-all duration-300 hover:-translate-y-1 hover:shadow-2xl hover:shadow-indigo-500/10 ${
|
| 28 |
isWinner
|
| 29 |
+
? "border-indigo-500/50 shadow-lg shadow-indigo-500/20 ring-1 ring-indigo-500/50"
|
| 30 |
+
: "border-white/10"
|
| 31 |
}`}
|
| 32 |
>
|
| 33 |
{isWinner && (
|
| 34 |
+
<span className="absolute -top-3 left-4 rounded-full bg-gradient-to-r from-indigo-500 to-purple-500 px-2.5 py-0.5 text-[10px] font-bold uppercase tracking-widest text-white shadow-lg shadow-indigo-500/40">
|
| 35 |
★ Higher engagement
|
| 36 |
</span>
|
| 37 |
)}
|
| 38 |
|
| 39 |
<div className="mb-3 flex items-center justify-between">
|
| 40 |
+
<span className="rounded-full bg-black/40 px-2.5 py-1 text-xs font-semibold text-neutral-300">
|
| 41 |
Video {video.video_id}
|
| 42 |
</span>
|
| 43 |
<span
|
| 44 |
+
className={`rounded-full px-2.5 py-0.5 text-[10px] font-bold uppercase tracking-widest ring-1 ${sourceClass}`}
|
| 45 |
>
|
| 46 |
{video.source}
|
| 47 |
</span>
|
| 48 |
</div>
|
| 49 |
|
| 50 |
+
<h3 className="mb-1 line-clamp-2 text-sm font-semibold leading-snug text-neutral-100">
|
| 51 |
{video.title || video.caption || video.url}
|
| 52 |
</h3>
|
| 53 |
+
<p className="mb-4 text-xs font-medium text-neutral-500">
|
| 54 |
{video.creator ? `@${video.creator}` : "unknown creator"}
|
| 55 |
{video.follower_count !== null
|
| 56 |
? ` · ${fmt(video.follower_count)} followers`
|
|
|
|
| 58 |
</p>
|
| 59 |
|
| 60 |
<div
|
| 61 |
+
className={`mb-4 rounded-xl p-4 text-center text-white transition-all ${
|
| 62 |
isWinner
|
| 63 |
+
? "bg-gradient-to-br from-indigo-500 to-purple-600 shadow-inner"
|
| 64 |
+
: "bg-black/30 border border-white/5"
|
| 65 |
}`}
|
| 66 |
>
|
| 67 |
+
<div className="text-4xl font-extrabold tracking-tight">{er}</div>
|
| 68 |
+
<div className="mt-1 text-[10px] font-semibold uppercase tracking-widest text-white/70">
|
| 69 |
engagement rate
|
| 70 |
</div>
|
| 71 |
</div>
|
|
|
|
| 77 |
</dl>
|
| 78 |
|
| 79 |
{video.hashtags.length > 0 && (
|
| 80 |
+
<div className="mt-auto flex flex-wrap gap-2 pt-2 border-t border-white/5">
|
| 81 |
{video.hashtags.slice(0, 5).map((h) => (
|
| 82 |
<span
|
| 83 |
key={h}
|
| 84 |
+
className="rounded-lg bg-black/20 px-2 py-1 text-[10px] font-medium text-neutral-400 hover:text-neutral-300 transition-colors"
|
| 85 |
>
|
| 86 |
#{h}
|
| 87 |
</span>
|
|
|
|
| 94 |
|
| 95 |
function Stat({ label, value }: { label: string; value: string }) {
|
| 96 |
return (
|
| 97 |
+
<div className="rounded-xl bg-black/20 py-2.5 border border-white/5">
|
| 98 |
+
<div className="font-bold text-neutral-200">{value}</div>
|
| 99 |
+
<div className="mt-0.5 text-[10px] font-medium uppercase tracking-widest text-neutral-500">
|
| 100 |
{label}
|
| 101 |
</div>
|
| 102 |
</div>
|