feature: new changes!
This commit is contained in:
22
packages/backend/drizzle/0000_wild_joseph.sql
Normal file
22
packages/backend/drizzle/0000_wild_joseph.sql
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
CREATE TABLE "feedback" (
|
||||||
|
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
|
||||||
|
"tv_show_name" text NOT NULL,
|
||||||
|
"stars" integer NOT NULL,
|
||||||
|
"feedback" text DEFAULT '' NOT NULL,
|
||||||
|
"created_at" timestamp DEFAULT now() NOT NULL
|
||||||
|
);
|
||||||
|
--> statement-breakpoint
|
||||||
|
CREATE TABLE "recommendations" (
|
||||||
|
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
|
||||||
|
"title" text NOT NULL,
|
||||||
|
"main_prompt" text NOT NULL,
|
||||||
|
"liked_shows" text DEFAULT '' NOT NULL,
|
||||||
|
"disliked_shows" text DEFAULT '' NOT NULL,
|
||||||
|
"themes" text DEFAULT '' NOT NULL,
|
||||||
|
"brainstorm_count" integer DEFAULT 100 NOT NULL,
|
||||||
|
"recommendations" jsonb,
|
||||||
|
"status" text DEFAULT 'pending' NOT NULL,
|
||||||
|
"created_at" timestamp DEFAULT now() NOT NULL
|
||||||
|
);
|
||||||
|
--> statement-breakpoint
|
||||||
|
CREATE UNIQUE INDEX "feedback_tv_show_name_idx" ON "feedback" USING btree ("tv_show_name");
|
||||||
161
packages/backend/drizzle/meta/0000_snapshot.json
Normal file
161
packages/backend/drizzle/meta/0000_snapshot.json
Normal file
@@ -0,0 +1,161 @@
|
|||||||
|
{
|
||||||
|
"id": "4ca81e42-26b0-46f5-988e-957360067861",
|
||||||
|
"prevId": "00000000-0000-0000-0000-000000000000",
|
||||||
|
"version": "7",
|
||||||
|
"dialect": "postgresql",
|
||||||
|
"tables": {
|
||||||
|
"public.feedback": {
|
||||||
|
"name": "feedback",
|
||||||
|
"schema": "",
|
||||||
|
"columns": {
|
||||||
|
"id": {
|
||||||
|
"name": "id",
|
||||||
|
"type": "uuid",
|
||||||
|
"primaryKey": true,
|
||||||
|
"notNull": true,
|
||||||
|
"default": "gen_random_uuid()"
|
||||||
|
},
|
||||||
|
"tv_show_name": {
|
||||||
|
"name": "tv_show_name",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
"stars": {
|
||||||
|
"name": "stars",
|
||||||
|
"type": "integer",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
"feedback": {
|
||||||
|
"name": "feedback",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true,
|
||||||
|
"default": "''"
|
||||||
|
},
|
||||||
|
"created_at": {
|
||||||
|
"name": "created_at",
|
||||||
|
"type": "timestamp",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true,
|
||||||
|
"default": "now()"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"indexes": {
|
||||||
|
"feedback_tv_show_name_idx": {
|
||||||
|
"name": "feedback_tv_show_name_idx",
|
||||||
|
"columns": [
|
||||||
|
{
|
||||||
|
"expression": "tv_show_name",
|
||||||
|
"isExpression": false,
|
||||||
|
"asc": true,
|
||||||
|
"nulls": "last"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"isUnique": true,
|
||||||
|
"concurrently": false,
|
||||||
|
"method": "btree",
|
||||||
|
"with": {}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"foreignKeys": {},
|
||||||
|
"compositePrimaryKeys": {},
|
||||||
|
"uniqueConstraints": {},
|
||||||
|
"policies": {},
|
||||||
|
"checkConstraints": {},
|
||||||
|
"isRLSEnabled": false
|
||||||
|
},
|
||||||
|
"public.recommendations": {
|
||||||
|
"name": "recommendations",
|
||||||
|
"schema": "",
|
||||||
|
"columns": {
|
||||||
|
"id": {
|
||||||
|
"name": "id",
|
||||||
|
"type": "uuid",
|
||||||
|
"primaryKey": true,
|
||||||
|
"notNull": true,
|
||||||
|
"default": "gen_random_uuid()"
|
||||||
|
},
|
||||||
|
"title": {
|
||||||
|
"name": "title",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
"main_prompt": {
|
||||||
|
"name": "main_prompt",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
"liked_shows": {
|
||||||
|
"name": "liked_shows",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true,
|
||||||
|
"default": "''"
|
||||||
|
},
|
||||||
|
"disliked_shows": {
|
||||||
|
"name": "disliked_shows",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true,
|
||||||
|
"default": "''"
|
||||||
|
},
|
||||||
|
"themes": {
|
||||||
|
"name": "themes",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true,
|
||||||
|
"default": "''"
|
||||||
|
},
|
||||||
|
"brainstorm_count": {
|
||||||
|
"name": "brainstorm_count",
|
||||||
|
"type": "integer",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true,
|
||||||
|
"default": 100
|
||||||
|
},
|
||||||
|
"recommendations": {
|
||||||
|
"name": "recommendations",
|
||||||
|
"type": "jsonb",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
"status": {
|
||||||
|
"name": "status",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true,
|
||||||
|
"default": "'pending'"
|
||||||
|
},
|
||||||
|
"created_at": {
|
||||||
|
"name": "created_at",
|
||||||
|
"type": "timestamp",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true,
|
||||||
|
"default": "now()"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"indexes": {},
|
||||||
|
"foreignKeys": {},
|
||||||
|
"compositePrimaryKeys": {},
|
||||||
|
"uniqueConstraints": {},
|
||||||
|
"policies": {},
|
||||||
|
"checkConstraints": {},
|
||||||
|
"isRLSEnabled": false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"enums": {},
|
||||||
|
"schemas": {},
|
||||||
|
"sequences": {},
|
||||||
|
"roles": {},
|
||||||
|
"policies": {},
|
||||||
|
"views": {},
|
||||||
|
"_meta": {
|
||||||
|
"columns": {},
|
||||||
|
"schemas": {},
|
||||||
|
"tables": {}
|
||||||
|
}
|
||||||
|
}
|
||||||
13
packages/backend/drizzle/meta/_journal.json
Normal file
13
packages/backend/drizzle/meta/_journal.json
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
{
|
||||||
|
"version": "7",
|
||||||
|
"dialect": "postgresql",
|
||||||
|
"entries": [
|
||||||
|
{
|
||||||
|
"idx": 0,
|
||||||
|
"version": "7",
|
||||||
|
"when": 1774479321371,
|
||||||
|
"tag": "0000_wild_joseph",
|
||||||
|
"breakpoints": true
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
import { openai } from '../agent.js';
|
import { openai } from '../agent.js';
|
||||||
import type { InterpreterOutput, RetrievalOutput } from '../types/agents.js';
|
import type { InterpreterOutput, RetrievalOutput } from '../types/agents.js';
|
||||||
|
|
||||||
export async function runRetrieval(input: InterpreterOutput): Promise<RetrievalOutput> {
|
export async function runRetrieval(input: InterpreterOutput, brainstormCount = 100): Promise<RetrievalOutput> {
|
||||||
const response = await openai.chat.completions.create({
|
const response = await openai.chat.completions.create({
|
||||||
model: 'gpt-5.4',
|
model: 'gpt-5.4',
|
||||||
temperature: 0.9,
|
temperature: 0.9,
|
||||||
@@ -10,7 +10,7 @@ export async function runRetrieval(input: InterpreterOutput): Promise<RetrievalO
|
|||||||
messages: [
|
messages: [
|
||||||
{
|
{
|
||||||
role: 'system',
|
role: 'system',
|
||||||
content: `You are a TV show candidate generator. Your goal is to brainstorm a LARGE, DIVERSE pool of 60–80 TV show candidates that match the user's structured preferences.
|
content: `You are a TV show candidate generator. Your goal is to brainstorm a LARGE, DIVERSE pool of ${brainstormCount} TV show candidates that match the user's structured preferences.
|
||||||
|
|
||||||
Your output MUST be valid JSON matching this schema:
|
Your output MUST be valid JSON matching this schema:
|
||||||
{
|
{
|
||||||
@@ -25,7 +25,7 @@ Rules:
|
|||||||
- Each "reason" should briefly explain why the show matches the preferences
|
- Each "reason" should briefly explain why the show matches the preferences
|
||||||
- Avoid duplicates
|
- Avoid duplicates
|
||||||
- Include shows from different decades, countries, and networks
|
- Include shows from different decades, countries, and networks
|
||||||
- Aim for 60–80 candidates minimum`,
|
- Aim for ${brainstormCount} candidates minimum`,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
role: 'user',
|
role: 'user',
|
||||||
|
|||||||
28
packages/backend/src/agents/titleGenerator.ts
Normal file
28
packages/backend/src/agents/titleGenerator.ts
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
import { openai } from '../agent.js';
|
||||||
|
import type { InterpreterOutput } from '../types/agents.js';
|
||||||
|
|
||||||
|
export async function generateTitle(interpreter: InterpreterOutput): Promise<string> {
|
||||||
|
const response = await openai.chat.completions.create({
|
||||||
|
model: 'gpt-4o-mini',
|
||||||
|
temperature: 0.7,
|
||||||
|
service_tier: 'flex',
|
||||||
|
messages: [
|
||||||
|
{
|
||||||
|
role: 'system',
|
||||||
|
content: `Generate a concise 5-8 word title for a TV show recommendation session.
|
||||||
|
Capture the essence of the user's taste — genre, tone, key themes.
|
||||||
|
Respond with ONLY the title. No quotes, no trailing punctuation.
|
||||||
|
Examples: "Dark Crime Dramas With Moral Ambiguity", "Cozy British Mysteries With Quirky Detectives"`,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
role: 'user',
|
||||||
|
content: `Liked: ${JSON.stringify(interpreter.liked)}
|
||||||
|
Themes: ${JSON.stringify(interpreter.themes)}
|
||||||
|
Tone: ${JSON.stringify(interpreter.tone)}
|
||||||
|
Character preferences: ${JSON.stringify(interpreter.character_preferences)}`,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
});
|
||||||
|
|
||||||
|
return (response.choices[0]?.message?.content ?? '').trim() || 'My Recommendation Session';
|
||||||
|
}
|
||||||
@@ -8,6 +8,7 @@ export const recommendations = pgTable('recommendations', {
|
|||||||
liked_shows: text('liked_shows').notNull().default(''),
|
liked_shows: text('liked_shows').notNull().default(''),
|
||||||
disliked_shows: text('disliked_shows').notNull().default(''),
|
disliked_shows: text('disliked_shows').notNull().default(''),
|
||||||
themes: text('themes').notNull().default(''),
|
themes: text('themes').notNull().default(''),
|
||||||
|
brainstorm_count: integer('brainstorm_count').notNull().default(100),
|
||||||
recommendations: jsonb('recommendations').$type<CuratorOutput[]>(),
|
recommendations: jsonb('recommendations').$type<CuratorOutput[]>(),
|
||||||
status: text('status').notNull().default('pending'),
|
status: text('status').notNull().default('pending'),
|
||||||
created_at: timestamp('created_at').defaultNow().notNull(),
|
created_at: timestamp('created_at').defaultNow().notNull(),
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import { runRetrieval } from '../agents/retrieval.js';
|
|||||||
import { runRanking } from '../agents/ranking.js';
|
import { runRanking } from '../agents/ranking.js';
|
||||||
import { runCurator } from '../agents/curator.js';
|
import { runCurator } from '../agents/curator.js';
|
||||||
import type { CuratorOutput, SSEEvent } from '../types/agents.js';
|
import type { CuratorOutput, SSEEvent } from '../types/agents.js';
|
||||||
|
import { generateTitle } from '../agents/titleGenerator.js';
|
||||||
|
|
||||||
/* -- Agent pipeline --
|
/* -- Agent pipeline --
|
||||||
[1] Interpreter -> gets user input, transforms into structured data
|
[1] Interpreter -> gets user input, transforms into structured data
|
||||||
@@ -69,7 +70,7 @@ export async function runPipeline(
|
|||||||
log(rec.id, 'Retrieval: start');
|
log(rec.id, 'Retrieval: start');
|
||||||
sseWrite({ stage: 'retrieval', status: 'start' });
|
sseWrite({ stage: 'retrieval', status: 'start' });
|
||||||
const t1 = Date.now();
|
const t1 = Date.now();
|
||||||
const retrievalOutput = await runRetrieval(interpreterOutput);
|
const retrievalOutput = await runRetrieval(interpreterOutput, rec.brainstorm_count);
|
||||||
log(rec.id, `Retrieval: done (${Date.now() - t1}ms) — ${retrievalOutput.candidates.length} candidates`, {
|
log(rec.id, `Retrieval: done (${Date.now() - t1}ms) — ${retrievalOutput.candidates.length} candidates`, {
|
||||||
titles: retrievalOutput.candidates.map((c) => c.title),
|
titles: retrievalOutput.candidates.map((c) => c.title),
|
||||||
});
|
});
|
||||||
@@ -98,11 +99,21 @@ export async function runPipeline(
|
|||||||
log(rec.id, `Curator: done (${Date.now() - t3}ms) — ${curatorOutput.length} shows curated`);
|
log(rec.id, `Curator: done (${Date.now() - t3}ms) — ${curatorOutput.length} shows curated`);
|
||||||
sseWrite({ stage: 'curator', status: 'done', data: curatorOutput });
|
sseWrite({ stage: 'curator', status: 'done', data: curatorOutput });
|
||||||
|
|
||||||
|
// Generate AI title
|
||||||
|
let aiTitle: string = rec.title;
|
||||||
|
try {
|
||||||
|
log(rec.id, 'Title generation: start');
|
||||||
|
aiTitle = await generateTitle(interpreterOutput);
|
||||||
|
log(rec.id, `Title generation: done — "${aiTitle}"`);
|
||||||
|
} catch (err) {
|
||||||
|
log(rec.id, `Title generation failed, keeping initial title: ${String(err)}`);
|
||||||
|
}
|
||||||
|
|
||||||
// Save results to DB
|
// Save results to DB
|
||||||
log(rec.id, 'Saving results to DB');
|
log(rec.id, 'Saving results to DB');
|
||||||
await db
|
await db
|
||||||
.update(recommendations)
|
.update(recommendations)
|
||||||
.set({ recommendations: curatorOutput, status: 'done' })
|
.set({ recommendations: curatorOutput, status: 'done', title: aiTitle })
|
||||||
.where(eq(recommendations.id, rec.id));
|
.where(eq(recommendations.id, rec.id));
|
||||||
|
|
||||||
sseWrite({ stage: 'complete', status: 'done' });
|
sseWrite({ stage: 'complete', status: 'done' });
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ export default async function recommendationsRoute(fastify: FastifyInstance) {
|
|||||||
liked_shows?: string;
|
liked_shows?: string;
|
||||||
disliked_shows?: string;
|
disliked_shows?: string;
|
||||||
themes?: string;
|
themes?: string;
|
||||||
|
brainstorm_count?: number;
|
||||||
};
|
};
|
||||||
|
|
||||||
const title = (body.main_prompt ?? '')
|
const title = (body.main_prompt ?? '')
|
||||||
@@ -21,6 +22,9 @@ export default async function recommendationsRoute(fastify: FastifyInstance) {
|
|||||||
.slice(0, 5)
|
.slice(0, 5)
|
||||||
.join(' ');
|
.join(' ');
|
||||||
|
|
||||||
|
const rawCount = Number(body.brainstorm_count ?? 100);
|
||||||
|
const brainstorm_count = Number.isFinite(rawCount) ? Math.min(200, Math.max(50, rawCount)) : 100;
|
||||||
|
|
||||||
const [rec] = await db
|
const [rec] = await db
|
||||||
.insert(recommendations)
|
.insert(recommendations)
|
||||||
.values({
|
.values({
|
||||||
@@ -29,6 +33,7 @@ export default async function recommendationsRoute(fastify: FastifyInstance) {
|
|||||||
liked_shows: body.liked_shows ?? '',
|
liked_shows: body.liked_shows ?? '',
|
||||||
disliked_shows: body.disliked_shows ?? '',
|
disliked_shows: body.disliked_shows ?? '',
|
||||||
themes: body.themes ?? '',
|
themes: body.themes ?? '',
|
||||||
|
brainstorm_count,
|
||||||
status: 'pending',
|
status: 'pending',
|
||||||
})
|
})
|
||||||
.returning({ id: recommendations.id });
|
.returning({ id: recommendations.id });
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ export function createRecommendation(body: {
|
|||||||
liked_shows: string;
|
liked_shows: string;
|
||||||
disliked_shows: string;
|
disliked_shows: string;
|
||||||
themes: string;
|
themes: string;
|
||||||
|
brainstorm_count?: number;
|
||||||
}): Promise<{ id: string }> {
|
}): Promise<{ id: string }> {
|
||||||
return request('/recommendations', {
|
return request('/recommendations', {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
|
|||||||
@@ -1,12 +1,15 @@
|
|||||||
import { Router, Route } from 'preact-router';
|
import { Router, Route } from 'preact-router';
|
||||||
import { Home } from './pages/Home.js';
|
import { Home } from './pages/Home.js';
|
||||||
import { Recom } from './pages/Recom.js';
|
import { Recom } from './pages/Recom.js';
|
||||||
|
import { RecommendationsProvider } from './context/RecommendationsContext.js';
|
||||||
|
|
||||||
export function App() {
|
export function App() {
|
||||||
return (
|
return (
|
||||||
<Router>
|
<RecommendationsProvider>
|
||||||
<Route path="/" component={Home} />
|
<Router>
|
||||||
<Route path="/recom/:id" component={Recom} />
|
<Route path="/" component={Home} />
|
||||||
</Router>
|
<Route path="/recom/:id" component={Recom} />
|
||||||
|
</Router>
|
||||||
|
</RecommendationsProvider>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
151
packages/frontend/src/components/Cards.css
Normal file
151
packages/frontend/src/components/Cards.css
Normal file
@@ -0,0 +1,151 @@
|
|||||||
|
/* ── Cards ─────────────────────────────────────────────── */
|
||||||
|
|
||||||
|
.cards-grid {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 12px;
|
||||||
|
margin-bottom: 32px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.card {
|
||||||
|
background: var(--bg-surface);
|
||||||
|
border: 1px solid var(--border);
|
||||||
|
border-radius: var(--radius);
|
||||||
|
padding: 16px;
|
||||||
|
transition: border-color 0.15s;
|
||||||
|
}
|
||||||
|
|
||||||
|
.card:hover {
|
||||||
|
border-color: var(--bg-surface-3);
|
||||||
|
}
|
||||||
|
|
||||||
|
.card-header {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 10px;
|
||||||
|
margin-bottom: 8px;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
}
|
||||||
|
|
||||||
|
.badge {
|
||||||
|
font-size: 11px;
|
||||||
|
font-weight: 600;
|
||||||
|
padding: 2px 8px;
|
||||||
|
border-radius: 100px;
|
||||||
|
text-transform: uppercase;
|
||||||
|
letter-spacing: 0.04em;
|
||||||
|
flex-shrink: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.badge-green {
|
||||||
|
background: rgba(34, 197, 94, 0.15);
|
||||||
|
color: #4ade80;
|
||||||
|
}
|
||||||
|
|
||||||
|
.badge-blue {
|
||||||
|
background: rgba(59, 130, 246, 0.15);
|
||||||
|
color: #60a5fa;
|
||||||
|
}
|
||||||
|
|
||||||
|
.badge-yellow {
|
||||||
|
background: rgba(234, 179, 8, 0.15);
|
||||||
|
color: #facc15;
|
||||||
|
}
|
||||||
|
|
||||||
|
.badge-red {
|
||||||
|
background: rgba(239, 68, 68, 0.15);
|
||||||
|
color: #f87171;
|
||||||
|
}
|
||||||
|
|
||||||
|
.card-title {
|
||||||
|
font-size: 16px;
|
||||||
|
font-weight: 600;
|
||||||
|
color: var(--text);
|
||||||
|
}
|
||||||
|
|
||||||
|
.card-explanation {
|
||||||
|
font-size: 13px;
|
||||||
|
color: var(--text-muted);
|
||||||
|
line-height: 1.5;
|
||||||
|
margin-bottom: 12px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.card-feedback {
|
||||||
|
border-top: 1px solid var(--border);
|
||||||
|
padding-top: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.star-rating {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 2px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.star-btn {
|
||||||
|
background: none;
|
||||||
|
border: none;
|
||||||
|
cursor: pointer;
|
||||||
|
font-size: 18px;
|
||||||
|
color: var(--text-dim);
|
||||||
|
padding: 0 2px;
|
||||||
|
transition: color 0.1s, transform 0.1s;
|
||||||
|
}
|
||||||
|
|
||||||
|
.star-btn:hover,
|
||||||
|
.star-btn.star-active {
|
||||||
|
color: var(--yellow);
|
||||||
|
}
|
||||||
|
|
||||||
|
.star-btn:hover {
|
||||||
|
transform: scale(1.1);
|
||||||
|
}
|
||||||
|
|
||||||
|
.feedback-saved {
|
||||||
|
margin-left: 8px;
|
||||||
|
font-size: 12px;
|
||||||
|
color: var(--green);
|
||||||
|
font-weight: 500;
|
||||||
|
}
|
||||||
|
|
||||||
|
.comment-area {
|
||||||
|
margin-top: 8px;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 6px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.comment-input {
|
||||||
|
font-size: 13px;
|
||||||
|
resize: vertical;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ── Rerank Button ──────────────────────────────────────── */
|
||||||
|
|
||||||
|
.rerank-section {
|
||||||
|
padding: 16px 0 32px;
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-rerank {
|
||||||
|
padding: 12px 28px;
|
||||||
|
background: var(--bg-surface-2);
|
||||||
|
color: var(--text);
|
||||||
|
border: 1px solid var(--border);
|
||||||
|
border-radius: var(--radius);
|
||||||
|
font-size: 14px;
|
||||||
|
font-weight: 600;
|
||||||
|
cursor: pointer;
|
||||||
|
transition: background 0.15s, border-color 0.15s;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-rerank:hover:not(:disabled) {
|
||||||
|
background: var(--bg-surface-3);
|
||||||
|
border-color: var(--accent);
|
||||||
|
color: var(--accent);
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-rerank:disabled {
|
||||||
|
opacity: 0.4;
|
||||||
|
cursor: not-allowed;
|
||||||
|
}
|
||||||
105
packages/frontend/src/components/Modal.css
Normal file
105
packages/frontend/src/components/Modal.css
Normal file
@@ -0,0 +1,105 @@
|
|||||||
|
/* ── Modal ──────────────────────────────────────────────── */
|
||||||
|
|
||||||
|
.modal-backdrop {
|
||||||
|
position: fixed;
|
||||||
|
inset: 0;
|
||||||
|
background: rgba(0, 0, 0, 0.6);
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
z-index: 100;
|
||||||
|
backdrop-filter: blur(2px);
|
||||||
|
}
|
||||||
|
|
||||||
|
.modal {
|
||||||
|
background: var(--bg-surface);
|
||||||
|
border: 1px solid var(--border);
|
||||||
|
border-radius: 12px;
|
||||||
|
width: 650px;
|
||||||
|
max-width: 96vw;
|
||||||
|
max-height: 90vh;
|
||||||
|
overflow-y: auto;
|
||||||
|
box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
|
||||||
|
}
|
||||||
|
|
||||||
|
.modal-header {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: space-between;
|
||||||
|
padding: 20px 20px 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.modal-header h2 {
|
||||||
|
font-size: 18px;
|
||||||
|
font-weight: 700;
|
||||||
|
}
|
||||||
|
|
||||||
|
.modal-close {
|
||||||
|
background: none;
|
||||||
|
border: none;
|
||||||
|
font-size: 22px;
|
||||||
|
color: var(--text-muted);
|
||||||
|
cursor: pointer;
|
||||||
|
line-height: 1;
|
||||||
|
padding: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.modal-close:hover {
|
||||||
|
color: var(--text);
|
||||||
|
}
|
||||||
|
|
||||||
|
.modal-form {
|
||||||
|
padding: 20px;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 16px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.form-group {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 6px;
|
||||||
|
flex: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
.form-group label {
|
||||||
|
font-size: 13px;
|
||||||
|
font-weight: 500;
|
||||||
|
color: var(--text-muted);
|
||||||
|
}
|
||||||
|
|
||||||
|
.form-input,
|
||||||
|
.form-textarea {
|
||||||
|
background: var(--bg-surface-2);
|
||||||
|
border: 1px solid var(--border);
|
||||||
|
border-radius: var(--radius-sm);
|
||||||
|
color: var(--text);
|
||||||
|
font-size: 14px;
|
||||||
|
padding: 10px 12px;
|
||||||
|
outline: none;
|
||||||
|
transition: border-color 0.15s;
|
||||||
|
font-family: inherit;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.form-input[type="range"] {
|
||||||
|
padding: 0;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
.form-input:focus,
|
||||||
|
.form-textarea:focus {
|
||||||
|
border-color: var(--accent);
|
||||||
|
}
|
||||||
|
|
||||||
|
.form-textarea {
|
||||||
|
resize: vertical;
|
||||||
|
min-height: 80px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.modal-actions {
|
||||||
|
display: flex;
|
||||||
|
justify-content: flex-end;
|
||||||
|
gap: 10px;
|
||||||
|
padding-top: 4px;
|
||||||
|
}
|
||||||
@@ -1,4 +1,5 @@
|
|||||||
import { useState } from 'preact/hooks';
|
import { useState } from 'preact/hooks';
|
||||||
|
import './Modal.css';
|
||||||
|
|
||||||
interface NewRecommendationModalProps {
|
interface NewRecommendationModalProps {
|
||||||
onClose: () => void;
|
onClose: () => void;
|
||||||
@@ -7,6 +8,7 @@ interface NewRecommendationModalProps {
|
|||||||
liked_shows: string;
|
liked_shows: string;
|
||||||
disliked_shows: string;
|
disliked_shows: string;
|
||||||
themes: string;
|
themes: string;
|
||||||
|
brainstorm_count?: number;
|
||||||
}) => Promise<void>;
|
}) => Promise<void>;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -15,6 +17,7 @@ export function NewRecommendationModal({ onClose, onSubmit }: NewRecommendationM
|
|||||||
const [likedShows, setLikedShows] = useState('');
|
const [likedShows, setLikedShows] = useState('');
|
||||||
const [dislikedShows, setDislikedShows] = useState('');
|
const [dislikedShows, setDislikedShows] = useState('');
|
||||||
const [themes, setThemes] = useState('');
|
const [themes, setThemes] = useState('');
|
||||||
|
const [brainstormCount, setBrainstormCount] = useState(100);
|
||||||
const [loading, setLoading] = useState(false);
|
const [loading, setLoading] = useState(false);
|
||||||
|
|
||||||
const handleSubmit = async (e: Event) => {
|
const handleSubmit = async (e: Event) => {
|
||||||
@@ -27,6 +30,7 @@ export function NewRecommendationModal({ onClose, onSubmit }: NewRecommendationM
|
|||||||
liked_shows: likedShows.trim(),
|
liked_shows: likedShows.trim(),
|
||||||
disliked_shows: dislikedShows.trim(),
|
disliked_shows: dislikedShows.trim(),
|
||||||
themes: themes.trim(),
|
themes: themes.trim(),
|
||||||
|
brainstorm_count: brainstormCount,
|
||||||
});
|
});
|
||||||
onClose();
|
onClose();
|
||||||
} finally {
|
} finally {
|
||||||
@@ -62,30 +66,28 @@ export function NewRecommendationModal({ onClose, onSubmit }: NewRecommendationM
|
|||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-row">
|
<div class="form-group">
|
||||||
<div class="form-group">
|
<label for="liked-shows">Shows you liked</label>
|
||||||
<label for="liked-shows">Shows you liked</label>
|
<input
|
||||||
<input
|
id="liked-shows"
|
||||||
id="liked-shows"
|
type="text"
|
||||||
type="text"
|
class="form-input"
|
||||||
class="form-input"
|
placeholder="e.g. Breaking Bad, The Wire"
|
||||||
placeholder="e.g. Breaking Bad, The Wire"
|
value={likedShows}
|
||||||
value={likedShows}
|
onInput={(e) => setLikedShows((e.target as HTMLInputElement).value)}
|
||||||
onInput={(e) => setLikedShows((e.target as HTMLInputElement).value)}
|
/>
|
||||||
/>
|
</div>
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="disliked-shows">Shows you disliked</label>
|
<label for="disliked-shows">Shows you disliked</label>
|
||||||
<input
|
<input
|
||||||
id="disliked-shows"
|
id="disliked-shows"
|
||||||
type="text"
|
type="text"
|
||||||
class="form-input"
|
class="form-input"
|
||||||
placeholder="e.g. Game of Thrones"
|
placeholder="e.g. Game of Thrones"
|
||||||
value={dislikedShows}
|
value={dislikedShows}
|
||||||
onInput={(e) => setDislikedShows((e.target as HTMLInputElement).value)}
|
onInput={(e) => setDislikedShows((e.target as HTMLInputElement).value)}
|
||||||
/>
|
/>
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
@@ -100,6 +102,20 @@ export function NewRecommendationModal({ onClose, onSubmit }: NewRecommendationM
|
|||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="brainstorm-count">Shows to brainstorm ({brainstormCount})</label>
|
||||||
|
<input
|
||||||
|
id="brainstorm-count"
|
||||||
|
type="range"
|
||||||
|
class="form-input"
|
||||||
|
min={50}
|
||||||
|
max={200}
|
||||||
|
step={10}
|
||||||
|
value={brainstormCount}
|
||||||
|
onInput={(e) => setBrainstormCount(Number((e.target as HTMLInputElement).value))}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="modal-actions">
|
<div class="modal-actions">
|
||||||
<button type="button" class="btn-secondary" onClick={onClose} disabled={loading}>
|
<button type="button" class="btn-secondary" onClick={onClose} disabled={loading}>
|
||||||
Cancel
|
Cancel
|
||||||
|
|||||||
86
packages/frontend/src/components/PipelineProgress.css
Normal file
86
packages/frontend/src/components/PipelineProgress.css
Normal file
@@ -0,0 +1,86 @@
|
|||||||
|
/* ── Pipeline Progress ──────────────────────────────────── */
|
||||||
|
|
||||||
|
.pipeline-progress {
|
||||||
|
padding: 40px 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pipeline-title {
|
||||||
|
font-size: 18px;
|
||||||
|
font-weight: 600;
|
||||||
|
color: var(--text);
|
||||||
|
margin-bottom: 24px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pipeline-steps {
|
||||||
|
list-style: none;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 12px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pipeline-step {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 12px;
|
||||||
|
padding: 12px 16px;
|
||||||
|
background: var(--bg-surface);
|
||||||
|
border: 1px solid var(--border);
|
||||||
|
border-radius: var(--radius);
|
||||||
|
font-size: 14px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pipeline-step--running {
|
||||||
|
border-color: var(--accent);
|
||||||
|
background: var(--accent-dim);
|
||||||
|
}
|
||||||
|
|
||||||
|
.pipeline-step--done {
|
||||||
|
border-color: rgba(34, 197, 94, 0.3);
|
||||||
|
background: rgba(34, 197, 94, 0.05);
|
||||||
|
}
|
||||||
|
|
||||||
|
.pipeline-step--error {
|
||||||
|
border-color: rgba(239, 68, 68, 0.3);
|
||||||
|
background: rgba(239, 68, 68, 0.05);
|
||||||
|
}
|
||||||
|
|
||||||
|
.stage-icon {
|
||||||
|
font-size: 16px;
|
||||||
|
width: 20px;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.stage-done {
|
||||||
|
color: var(--green);
|
||||||
|
}
|
||||||
|
|
||||||
|
.stage-error {
|
||||||
|
color: var(--red);
|
||||||
|
}
|
||||||
|
|
||||||
|
.stage-running {
|
||||||
|
color: var(--accent);
|
||||||
|
}
|
||||||
|
|
||||||
|
.stage-pending {
|
||||||
|
color: var(--text-dim);
|
||||||
|
}
|
||||||
|
|
||||||
|
.spinner {
|
||||||
|
display: inline-block;
|
||||||
|
animation: spin 1s linear infinite;
|
||||||
|
}
|
||||||
|
|
||||||
|
@keyframes spin {
|
||||||
|
from {
|
||||||
|
transform: rotate(0deg);
|
||||||
|
}
|
||||||
|
|
||||||
|
to {
|
||||||
|
transform: rotate(360deg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.pipeline-step-label {
|
||||||
|
font-weight: 500;
|
||||||
|
}
|
||||||
@@ -1,3 +1,4 @@
|
|||||||
|
import './PipelineProgress.css';
|
||||||
import type { StageMap, StageStatus } from '../types/index.js';
|
import type { StageMap, StageStatus } from '../types/index.js';
|
||||||
|
|
||||||
const STAGES: { key: keyof StageMap; label: string }[] = [
|
const STAGES: { key: keyof StageMap; label: string }[] = [
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
import { useState } from 'preact/hooks';
|
import { useState } from 'preact/hooks';
|
||||||
|
import './Cards.css';
|
||||||
import type { CuratorOutput, CuratorCategory } from '../types/index.js';
|
import type { CuratorOutput, CuratorCategory } from '../types/index.js';
|
||||||
|
|
||||||
interface RecommendationCardProps {
|
interface RecommendationCardProps {
|
||||||
|
|||||||
124
packages/frontend/src/components/Sidebar.css
Normal file
124
packages/frontend/src/components/Sidebar.css
Normal file
@@ -0,0 +1,124 @@
|
|||||||
|
/* ── Sidebar ────────────────────────────────────────────── */
|
||||||
|
|
||||||
|
.sidebar {
|
||||||
|
width: var(--sidebar-width);
|
||||||
|
background: var(--bg-surface);
|
||||||
|
border-right: 1px solid var(--border);
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
overflow: hidden;
|
||||||
|
flex-shrink: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sidebar-header {
|
||||||
|
padding: 20px 16px 12px;
|
||||||
|
border-bottom: 1px solid var(--border);
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sidebar-title {
|
||||||
|
font-size: 24px;
|
||||||
|
font-weight: 700;
|
||||||
|
color: var(--text);
|
||||||
|
letter-spacing: -0.3px;
|
||||||
|
text-decoration: none;
|
||||||
|
display: inline-block;
|
||||||
|
transition: color 0.15s ease;
|
||||||
|
padding-bottom: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sidebar-title:hover {
|
||||||
|
color: var(--accent);
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-new {
|
||||||
|
margin: 12px;
|
||||||
|
padding: 10px 14px;
|
||||||
|
background: var(--accent);
|
||||||
|
color: #fff;
|
||||||
|
border: none;
|
||||||
|
border-radius: var(--radius);
|
||||||
|
font-size: 13px;
|
||||||
|
font-weight: 600;
|
||||||
|
cursor: pointer;
|
||||||
|
transition: background 0.15s;
|
||||||
|
text-align: left;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-new:hover {
|
||||||
|
background: var(--accent-hover);
|
||||||
|
}
|
||||||
|
|
||||||
|
.sidebar-section-label {
|
||||||
|
padding: 8px 16px 4px;
|
||||||
|
font-size: 11px;
|
||||||
|
font-weight: 600;
|
||||||
|
letter-spacing: 0.06em;
|
||||||
|
text-transform: uppercase;
|
||||||
|
color: var(--text-dim);
|
||||||
|
}
|
||||||
|
|
||||||
|
.sidebar-list {
|
||||||
|
list-style: none;
|
||||||
|
overflow-y: auto;
|
||||||
|
flex: 1;
|
||||||
|
padding: 4px 8px 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sidebar-empty {
|
||||||
|
padding: 8px;
|
||||||
|
color: var(--text-dim);
|
||||||
|
font-size: 13px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sidebar-item {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 8px;
|
||||||
|
padding: 8px 10px;
|
||||||
|
border-radius: var(--radius-sm);
|
||||||
|
cursor: pointer;
|
||||||
|
color: var(--text-muted);
|
||||||
|
font-size: 13px;
|
||||||
|
transition: background 0.1s, color 0.1s;
|
||||||
|
user-select: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sidebar-item:hover {
|
||||||
|
background: var(--bg-surface-2);
|
||||||
|
color: var(--text);
|
||||||
|
}
|
||||||
|
|
||||||
|
.sidebar-item.selected {
|
||||||
|
background: var(--accent-dim);
|
||||||
|
color: var(--text);
|
||||||
|
}
|
||||||
|
|
||||||
|
.sidebar-icon {
|
||||||
|
font-size: 12px;
|
||||||
|
width: 16px;
|
||||||
|
text-align: center;
|
||||||
|
flex-shrink: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.status-done {
|
||||||
|
color: var(--green);
|
||||||
|
}
|
||||||
|
|
||||||
|
.status-error {
|
||||||
|
color: var(--red);
|
||||||
|
}
|
||||||
|
|
||||||
|
.status-running {
|
||||||
|
color: var(--accent);
|
||||||
|
}
|
||||||
|
|
||||||
|
.status-pending {
|
||||||
|
color: var(--text-dim);
|
||||||
|
}
|
||||||
|
|
||||||
|
.sidebar-item-title {
|
||||||
|
overflow: hidden;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
@@ -1,3 +1,4 @@
|
|||||||
|
import './Sidebar.css';
|
||||||
import type { RecommendationSummary } from '../types/index.js';
|
import type { RecommendationSummary } from '../types/index.js';
|
||||||
|
|
||||||
interface SidebarProps {
|
interface SidebarProps {
|
||||||
@@ -29,7 +30,7 @@ export function Sidebar({ list, selectedId, onSelect, onNewClick }: SidebarProps
|
|||||||
return (
|
return (
|
||||||
<aside class="sidebar">
|
<aside class="sidebar">
|
||||||
<div class="sidebar-header">
|
<div class="sidebar-header">
|
||||||
<span class="sidebar-title">Recommender</span>
|
<a href="/" class="sidebar-title">Recommender</a>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<button class="btn-new" onClick={onNewClick}>
|
<button class="btn-new" onClick={onNewClick}>
|
||||||
|
|||||||
18
packages/frontend/src/context/RecommendationsContext.tsx
Normal file
18
packages/frontend/src/context/RecommendationsContext.tsx
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
import { createContext } from 'preact';
|
||||||
|
import { useContext } from 'preact/hooks';
|
||||||
|
import { useRecommendations } from '../hooks/useRecommendations.js';
|
||||||
|
import type { ComponentChildren } from 'preact';
|
||||||
|
|
||||||
|
type Value = ReturnType<typeof useRecommendations>;
|
||||||
|
|
||||||
|
const Ctx = createContext<Value | null>(null);
|
||||||
|
|
||||||
|
export function RecommendationsProvider({ children }: { children: ComponentChildren }) {
|
||||||
|
return <Ctx.Provider value={useRecommendations()}>{children}</Ctx.Provider>;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function useRecommendationsContext(): Value {
|
||||||
|
const ctx = useContext(Ctx);
|
||||||
|
if (!ctx) throw new Error('Must be inside RecommendationsProvider');
|
||||||
|
return ctx;
|
||||||
|
}
|
||||||
@@ -34,6 +34,7 @@ export function useRecommendations() {
|
|||||||
liked_shows: string;
|
liked_shows: string;
|
||||||
disliked_shows: string;
|
disliked_shows: string;
|
||||||
themes: string;
|
themes: string;
|
||||||
|
brainstorm_count?: number;
|
||||||
}) => {
|
}) => {
|
||||||
const { id } = await createRecommendation(body);
|
const { id } = await createRecommendation(body);
|
||||||
await refreshList();
|
await refreshList();
|
||||||
|
|||||||
@@ -54,123 +54,7 @@ body,
|
|||||||
padding: 32px;
|
padding: 32px;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ── Sidebar ────────────────────────────────────────────── */
|
/* ── Shared content areas ───────────────────────────────── */
|
||||||
|
|
||||||
.sidebar {
|
|
||||||
width: var(--sidebar-width);
|
|
||||||
background: var(--bg-surface);
|
|
||||||
border-right: 1px solid var(--border);
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
overflow: hidden;
|
|
||||||
flex-shrink: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.sidebar-header {
|
|
||||||
padding: 20px 16px 12px;
|
|
||||||
border-bottom: 1px solid var(--border);
|
|
||||||
}
|
|
||||||
|
|
||||||
.sidebar-title {
|
|
||||||
font-size: 16px;
|
|
||||||
font-weight: 700;
|
|
||||||
color: var(--text);
|
|
||||||
letter-spacing: -0.3px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.btn-new {
|
|
||||||
margin: 12px;
|
|
||||||
padding: 10px 14px;
|
|
||||||
background: var(--accent);
|
|
||||||
color: #fff;
|
|
||||||
border: none;
|
|
||||||
border-radius: var(--radius);
|
|
||||||
font-size: 13px;
|
|
||||||
font-weight: 600;
|
|
||||||
cursor: pointer;
|
|
||||||
transition: background 0.15s;
|
|
||||||
text-align: left;
|
|
||||||
}
|
|
||||||
|
|
||||||
.btn-new:hover {
|
|
||||||
background: var(--accent-hover);
|
|
||||||
}
|
|
||||||
|
|
||||||
.sidebar-section-label {
|
|
||||||
padding: 8px 16px 4px;
|
|
||||||
font-size: 11px;
|
|
||||||
font-weight: 600;
|
|
||||||
letter-spacing: 0.06em;
|
|
||||||
text-transform: uppercase;
|
|
||||||
color: var(--text-dim);
|
|
||||||
}
|
|
||||||
|
|
||||||
.sidebar-list {
|
|
||||||
list-style: none;
|
|
||||||
overflow-y: auto;
|
|
||||||
flex: 1;
|
|
||||||
padding: 4px 8px 8px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.sidebar-empty {
|
|
||||||
padding: 8px;
|
|
||||||
color: var(--text-dim);
|
|
||||||
font-size: 13px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.sidebar-item {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
gap: 8px;
|
|
||||||
padding: 8px 10px;
|
|
||||||
border-radius: var(--radius-sm);
|
|
||||||
cursor: pointer;
|
|
||||||
color: var(--text-muted);
|
|
||||||
font-size: 13px;
|
|
||||||
transition: background 0.1s, color 0.1s;
|
|
||||||
user-select: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
.sidebar-item:hover {
|
|
||||||
background: var(--bg-surface-2);
|
|
||||||
color: var(--text);
|
|
||||||
}
|
|
||||||
|
|
||||||
.sidebar-item.selected {
|
|
||||||
background: var(--accent-dim);
|
|
||||||
color: var(--text);
|
|
||||||
}
|
|
||||||
|
|
||||||
.sidebar-icon {
|
|
||||||
font-size: 12px;
|
|
||||||
width: 16px;
|
|
||||||
text-align: center;
|
|
||||||
flex-shrink: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.status-done {
|
|
||||||
color: var(--green);
|
|
||||||
}
|
|
||||||
|
|
||||||
.status-error {
|
|
||||||
color: var(--red);
|
|
||||||
}
|
|
||||||
|
|
||||||
.status-running {
|
|
||||||
color: var(--accent);
|
|
||||||
}
|
|
||||||
|
|
||||||
.status-pending {
|
|
||||||
color: var(--text-dim);
|
|
||||||
}
|
|
||||||
|
|
||||||
.sidebar-item-title {
|
|
||||||
overflow: hidden;
|
|
||||||
text-overflow: ellipsis;
|
|
||||||
white-space: nowrap;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* ── Main content areas ─────────────────────────────────── */
|
|
||||||
|
|
||||||
.empty-state {
|
.empty-state {
|
||||||
display: flex;
|
display: flex;
|
||||||
@@ -189,270 +73,6 @@ body,
|
|||||||
color: var(--text);
|
color: var(--text);
|
||||||
}
|
}
|
||||||
|
|
||||||
.content-area {
|
|
||||||
max-width: 860px;
|
|
||||||
margin: 0 auto;
|
|
||||||
}
|
|
||||||
|
|
||||||
.rec-title {
|
|
||||||
font-size: 20px;
|
|
||||||
font-weight: 700;
|
|
||||||
color: var(--text);
|
|
||||||
margin-bottom: 24px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.error-state {
|
|
||||||
color: var(--text-muted);
|
|
||||||
}
|
|
||||||
|
|
||||||
.error-state h2 {
|
|
||||||
color: var(--red);
|
|
||||||
margin-bottom: 8px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.error-state p {
|
|
||||||
margin-bottom: 16px;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* ── Pipeline Progress ──────────────────────────────────── */
|
|
||||||
|
|
||||||
.pipeline-progress {
|
|
||||||
padding: 40px 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.pipeline-title {
|
|
||||||
font-size: 18px;
|
|
||||||
font-weight: 600;
|
|
||||||
color: var(--text);
|
|
||||||
margin-bottom: 24px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.pipeline-steps {
|
|
||||||
list-style: none;
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
gap: 12px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.pipeline-step {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
gap: 12px;
|
|
||||||
padding: 12px 16px;
|
|
||||||
background: var(--bg-surface);
|
|
||||||
border: 1px solid var(--border);
|
|
||||||
border-radius: var(--radius);
|
|
||||||
font-size: 14px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.pipeline-step--running {
|
|
||||||
border-color: var(--accent);
|
|
||||||
background: var(--accent-dim);
|
|
||||||
}
|
|
||||||
|
|
||||||
.pipeline-step--done {
|
|
||||||
border-color: rgba(34, 197, 94, 0.3);
|
|
||||||
background: rgba(34, 197, 94, 0.05);
|
|
||||||
}
|
|
||||||
|
|
||||||
.pipeline-step--error {
|
|
||||||
border-color: rgba(239, 68, 68, 0.3);
|
|
||||||
background: rgba(239, 68, 68, 0.05);
|
|
||||||
}
|
|
||||||
|
|
||||||
.stage-icon {
|
|
||||||
font-size: 16px;
|
|
||||||
width: 20px;
|
|
||||||
text-align: center;
|
|
||||||
}
|
|
||||||
|
|
||||||
.stage-done {
|
|
||||||
color: var(--green);
|
|
||||||
}
|
|
||||||
|
|
||||||
.stage-error {
|
|
||||||
color: var(--red);
|
|
||||||
}
|
|
||||||
|
|
||||||
.stage-running {
|
|
||||||
color: var(--accent);
|
|
||||||
}
|
|
||||||
|
|
||||||
.stage-pending {
|
|
||||||
color: var(--text-dim);
|
|
||||||
}
|
|
||||||
|
|
||||||
.spinner {
|
|
||||||
display: inline-block;
|
|
||||||
animation: spin 1s linear infinite;
|
|
||||||
}
|
|
||||||
|
|
||||||
@keyframes spin {
|
|
||||||
from {
|
|
||||||
transform: rotate(0deg);
|
|
||||||
}
|
|
||||||
|
|
||||||
to {
|
|
||||||
transform: rotate(360deg);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.pipeline-step-label {
|
|
||||||
font-weight: 500;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* ── Cards ─────────────────────────────────────────────── */
|
|
||||||
|
|
||||||
.cards-grid {
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
gap: 12px;
|
|
||||||
margin-bottom: 32px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.card {
|
|
||||||
background: var(--bg-surface);
|
|
||||||
border: 1px solid var(--border);
|
|
||||||
border-radius: var(--radius);
|
|
||||||
padding: 16px;
|
|
||||||
transition: border-color 0.15s;
|
|
||||||
}
|
|
||||||
|
|
||||||
.card:hover {
|
|
||||||
border-color: var(--bg-surface-3);
|
|
||||||
}
|
|
||||||
|
|
||||||
.card-header {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
gap: 10px;
|
|
||||||
margin-bottom: 8px;
|
|
||||||
flex-wrap: wrap;
|
|
||||||
}
|
|
||||||
|
|
||||||
.badge {
|
|
||||||
font-size: 11px;
|
|
||||||
font-weight: 600;
|
|
||||||
padding: 2px 8px;
|
|
||||||
border-radius: 100px;
|
|
||||||
text-transform: uppercase;
|
|
||||||
letter-spacing: 0.04em;
|
|
||||||
flex-shrink: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.badge-green {
|
|
||||||
background: rgba(34, 197, 94, 0.15);
|
|
||||||
color: #4ade80;
|
|
||||||
}
|
|
||||||
|
|
||||||
.badge-blue {
|
|
||||||
background: rgba(59, 130, 246, 0.15);
|
|
||||||
color: #60a5fa;
|
|
||||||
}
|
|
||||||
|
|
||||||
.badge-yellow {
|
|
||||||
background: rgba(234, 179, 8, 0.15);
|
|
||||||
color: #facc15;
|
|
||||||
}
|
|
||||||
|
|
||||||
.badge-red {
|
|
||||||
background: rgba(239, 68, 68, 0.15);
|
|
||||||
color: #f87171;
|
|
||||||
}
|
|
||||||
|
|
||||||
.card-title {
|
|
||||||
font-size: 16px;
|
|
||||||
font-weight: 600;
|
|
||||||
color: var(--text);
|
|
||||||
}
|
|
||||||
|
|
||||||
.card-explanation {
|
|
||||||
font-size: 13px;
|
|
||||||
color: var(--text-muted);
|
|
||||||
line-height: 1.5;
|
|
||||||
margin-bottom: 12px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.card-feedback {
|
|
||||||
border-top: 1px solid var(--border);
|
|
||||||
padding-top: 10px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.star-rating {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
gap: 2px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.star-btn {
|
|
||||||
background: none;
|
|
||||||
border: none;
|
|
||||||
cursor: pointer;
|
|
||||||
font-size: 18px;
|
|
||||||
color: var(--text-dim);
|
|
||||||
padding: 0 2px;
|
|
||||||
transition: color 0.1s, transform 0.1s;
|
|
||||||
}
|
|
||||||
|
|
||||||
.star-btn:hover,
|
|
||||||
.star-btn.star-active {
|
|
||||||
color: var(--yellow);
|
|
||||||
}
|
|
||||||
|
|
||||||
.star-btn:hover {
|
|
||||||
transform: scale(1.1);
|
|
||||||
}
|
|
||||||
|
|
||||||
.feedback-saved {
|
|
||||||
margin-left: 8px;
|
|
||||||
font-size: 12px;
|
|
||||||
color: var(--green);
|
|
||||||
font-weight: 500;
|
|
||||||
}
|
|
||||||
|
|
||||||
.comment-area {
|
|
||||||
margin-top: 8px;
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
gap: 6px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.comment-input {
|
|
||||||
font-size: 13px;
|
|
||||||
resize: vertical;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* ── Rerank Button ──────────────────────────────────────── */
|
|
||||||
|
|
||||||
.rerank-section {
|
|
||||||
padding: 16px 0 32px;
|
|
||||||
display: flex;
|
|
||||||
justify-content: center;
|
|
||||||
}
|
|
||||||
|
|
||||||
.btn-rerank {
|
|
||||||
padding: 12px 28px;
|
|
||||||
background: var(--bg-surface-2);
|
|
||||||
color: var(--text);
|
|
||||||
border: 1px solid var(--border);
|
|
||||||
border-radius: var(--radius);
|
|
||||||
font-size: 14px;
|
|
||||||
font-weight: 600;
|
|
||||||
cursor: pointer;
|
|
||||||
transition: background 0.15s, border-color 0.15s;
|
|
||||||
}
|
|
||||||
|
|
||||||
.btn-rerank:hover:not(:disabled) {
|
|
||||||
background: var(--bg-surface-3);
|
|
||||||
border-color: var(--accent);
|
|
||||||
color: var(--accent);
|
|
||||||
}
|
|
||||||
|
|
||||||
.btn-rerank:disabled {
|
|
||||||
opacity: 0.4;
|
|
||||||
cursor: not-allowed;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* ── Buttons ────────────────────────────────────────────── */
|
/* ── Buttons ────────────────────────────────────────────── */
|
||||||
|
|
||||||
.btn-primary {
|
.btn-primary {
|
||||||
@@ -496,230 +116,3 @@ body,
|
|||||||
.btn-secondary:hover:not(:disabled) {
|
.btn-secondary:hover:not(:disabled) {
|
||||||
background: var(--bg-surface-3);
|
background: var(--bg-surface-3);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ── Modal ──────────────────────────────────────────────── */
|
|
||||||
|
|
||||||
.modal-backdrop {
|
|
||||||
position: fixed;
|
|
||||||
inset: 0;
|
|
||||||
background: rgba(0, 0, 0, 0.6);
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: center;
|
|
||||||
z-index: 100;
|
|
||||||
backdrop-filter: blur(2px);
|
|
||||||
}
|
|
||||||
|
|
||||||
.modal {
|
|
||||||
background: var(--bg-surface);
|
|
||||||
border: 1px solid var(--border);
|
|
||||||
border-radius: 12px;
|
|
||||||
width: 540px;
|
|
||||||
max-width: 96vw;
|
|
||||||
max-height: 90vh;
|
|
||||||
overflow-y: auto;
|
|
||||||
box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
|
|
||||||
}
|
|
||||||
|
|
||||||
.modal-header {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: space-between;
|
|
||||||
padding: 20px 20px 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.modal-header h2 {
|
|
||||||
font-size: 18px;
|
|
||||||
font-weight: 700;
|
|
||||||
}
|
|
||||||
|
|
||||||
.modal-close {
|
|
||||||
background: none;
|
|
||||||
border: none;
|
|
||||||
font-size: 22px;
|
|
||||||
color: var(--text-muted);
|
|
||||||
cursor: pointer;
|
|
||||||
line-height: 1;
|
|
||||||
padding: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.modal-close:hover {
|
|
||||||
color: var(--text);
|
|
||||||
}
|
|
||||||
|
|
||||||
.modal-form {
|
|
||||||
padding: 20px;
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
gap: 16px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.form-group {
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
gap: 6px;
|
|
||||||
flex: 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
.form-group label {
|
|
||||||
font-size: 13px;
|
|
||||||
font-weight: 500;
|
|
||||||
color: var(--text-muted);
|
|
||||||
}
|
|
||||||
|
|
||||||
.form-row {
|
|
||||||
display: flex;
|
|
||||||
gap: 12px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.form-input,
|
|
||||||
.form-textarea {
|
|
||||||
background: var(--bg-surface-2);
|
|
||||||
border: 1px solid var(--border);
|
|
||||||
border-radius: var(--radius-sm);
|
|
||||||
color: var(--text);
|
|
||||||
font-size: 14px;
|
|
||||||
padding: 10px 12px;
|
|
||||||
outline: none;
|
|
||||||
transition: border-color 0.15s;
|
|
||||||
font-family: inherit;
|
|
||||||
width: 100%;
|
|
||||||
}
|
|
||||||
|
|
||||||
.form-input:focus,
|
|
||||||
.form-textarea:focus {
|
|
||||||
border-color: var(--accent);
|
|
||||||
}
|
|
||||||
|
|
||||||
.form-textarea {
|
|
||||||
resize: vertical;
|
|
||||||
min-height: 80px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.modal-actions {
|
|
||||||
display: flex;
|
|
||||||
justify-content: flex-end;
|
|
||||||
gap: 10px;
|
|
||||||
padding-top: 4px;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* ── Landing page ───────────────────────────────────────── */
|
|
||||||
|
|
||||||
.landing-layout {
|
|
||||||
display: flex;
|
|
||||||
height: 100vh;
|
|
||||||
position: relative;
|
|
||||||
overflow: hidden;
|
|
||||||
}
|
|
||||||
|
|
||||||
.landing-bg {
|
|
||||||
position: absolute;
|
|
||||||
inset: -6px;
|
|
||||||
/* overflow slightly to hide blur edges */
|
|
||||||
background: url('/wallpaper.png') center / cover no-repeat;
|
|
||||||
filter: blur(3px) brightness(0.35);
|
|
||||||
z-index: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.landing-layout .sidebar {
|
|
||||||
position: relative;
|
|
||||||
z-index: 1;
|
|
||||||
background: rgba(26, 29, 39, 0.85);
|
|
||||||
backdrop-filter: blur(8px);
|
|
||||||
}
|
|
||||||
|
|
||||||
.landing-main {
|
|
||||||
flex: 1;
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: center;
|
|
||||||
gap: 28px;
|
|
||||||
text-align: center;
|
|
||||||
position: relative;
|
|
||||||
z-index: 1;
|
|
||||||
padding: 40px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.landing-title {
|
|
||||||
font-size: 5rem;
|
|
||||||
font-weight: 800;
|
|
||||||
color: #fff;
|
|
||||||
letter-spacing: -2px;
|
|
||||||
line-height: 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
.landing-tagline {
|
|
||||||
font-size: 1.4rem;
|
|
||||||
color: rgba(255, 255, 255, 0.6);
|
|
||||||
font-weight: 400;
|
|
||||||
}
|
|
||||||
|
|
||||||
.btn-gradient {
|
|
||||||
padding: 18px 52px;
|
|
||||||
font-size: 1.15rem;
|
|
||||||
font-weight: 700;
|
|
||||||
color: #fff;
|
|
||||||
border: none;
|
|
||||||
border-radius: 14px;
|
|
||||||
cursor: pointer;
|
|
||||||
background: linear-gradient(135deg, #e040fb, #7c4dff, #2979ff, #00b0ff, #e040fb);
|
|
||||||
background-size: 300% 300%;
|
|
||||||
animation: gradient-flow 5s ease infinite;
|
|
||||||
box-shadow: 0 4px 32px rgba(99, 102, 241, 0.4);
|
|
||||||
transition: transform 0.15s, box-shadow 0.15s;
|
|
||||||
letter-spacing: 0.02em;
|
|
||||||
}
|
|
||||||
|
|
||||||
.btn-gradient:hover {
|
|
||||||
transform: translateY(-2px);
|
|
||||||
box-shadow: 0 8px 40px rgba(99, 102, 241, 0.55);
|
|
||||||
}
|
|
||||||
|
|
||||||
@keyframes gradient-flow {
|
|
||||||
0% {
|
|
||||||
background-position: 0% 50%;
|
|
||||||
}
|
|
||||||
|
|
||||||
50% {
|
|
||||||
background-position: 100% 50%;
|
|
||||||
}
|
|
||||||
|
|
||||||
100% {
|
|
||||||
background-position: 0% 50%;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* ── Recom page ─────────────────────────────────────────── */
|
|
||||||
|
|
||||||
.recom-page {
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
height: 100vh;
|
|
||||||
overflow: hidden;
|
|
||||||
}
|
|
||||||
|
|
||||||
.recom-nav {
|
|
||||||
flex-shrink: 0;
|
|
||||||
padding: 12px 24px;
|
|
||||||
border-bottom: 1px solid var(--border);
|
|
||||||
background: var(--bg-surface);
|
|
||||||
}
|
|
||||||
|
|
||||||
.recom-back {
|
|
||||||
color: var(--text-muted);
|
|
||||||
text-decoration: none;
|
|
||||||
font-size: 14px;
|
|
||||||
font-weight: 500;
|
|
||||||
transition: color 0.15s;
|
|
||||||
}
|
|
||||||
|
|
||||||
.recom-back:hover {
|
|
||||||
color: var(--text);
|
|
||||||
}
|
|
||||||
|
|
||||||
.recom-content {
|
|
||||||
flex: 1;
|
|
||||||
overflow-y: auto;
|
|
||||||
padding: 32px;
|
|
||||||
}
|
|
||||||
73
packages/frontend/src/pages/Home.css
Normal file
73
packages/frontend/src/pages/Home.css
Normal file
@@ -0,0 +1,73 @@
|
|||||||
|
/* ── Landing page ───────────────────────────────────────── */
|
||||||
|
|
||||||
|
.landing-layout {
|
||||||
|
display: flex;
|
||||||
|
height: 100vh;
|
||||||
|
position: relative;
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
.landing-bg {
|
||||||
|
position: absolute;
|
||||||
|
inset: -6px;
|
||||||
|
/* overflow slightly to hide blur edges */
|
||||||
|
background: url('/wallpaper.png') center / cover no-repeat;
|
||||||
|
filter: blur(3px) brightness(0.35);
|
||||||
|
z-index: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.landing-layout .sidebar {
|
||||||
|
position: relative;
|
||||||
|
z-index: 1;
|
||||||
|
background: rgba(26, 29, 39, 0.85);
|
||||||
|
backdrop-filter: blur(8px);
|
||||||
|
}
|
||||||
|
|
||||||
|
.landing-main {
|
||||||
|
flex: 1;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
gap: 28px;
|
||||||
|
text-align: center;
|
||||||
|
position: relative;
|
||||||
|
z-index: 1;
|
||||||
|
padding: 40px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.landing-title {
|
||||||
|
font-size: 5rem;
|
||||||
|
font-weight: 800;
|
||||||
|
color: #fff;
|
||||||
|
letter-spacing: -2px;
|
||||||
|
line-height: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
.landing-tagline {
|
||||||
|
font-size: 1.4rem;
|
||||||
|
color: rgba(255, 255, 255, 0.6);
|
||||||
|
font-weight: 400;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-gradient {
|
||||||
|
padding: 16px 42px;
|
||||||
|
font-size: 1.20rem;
|
||||||
|
font-weight: 700;
|
||||||
|
color: rgba(255, 255, 255, 0.9);
|
||||||
|
border: 1px solid rgba(255, 255, 255, 0.1);
|
||||||
|
border-radius: 12px;
|
||||||
|
cursor: pointer;
|
||||||
|
background: linear-gradient(135deg, rgba(113, 88, 226, 0.8), rgba(61, 59, 243, 0.8));
|
||||||
|
backdrop-filter: blur(6px);
|
||||||
|
box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2), inset 0 1px 1px rgba(255, 255, 255, 0.1);
|
||||||
|
transition: all 0.6s cubic-bezier(0.25, 0.8, 0.25, 1);
|
||||||
|
letter-spacing: 0.02em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-gradient:hover {
|
||||||
|
transform: translateY(-2px);
|
||||||
|
color: #fff;
|
||||||
|
background: linear-gradient(135deg, rgba(113, 88, 226, 0.95), rgba(41, 121, 255, 0.95));
|
||||||
|
box-shadow: 0 8px 24px rgba(113, 88, 226, 0.3), inset 0 1px 2px rgba(255, 255, 255, 0.2);
|
||||||
|
}
|
||||||
@@ -1,11 +1,12 @@
|
|||||||
import { useState } from 'preact/hooks';
|
import { useState } from 'preact/hooks';
|
||||||
|
import './Home.css';
|
||||||
import { route } from 'preact-router';
|
import { route } from 'preact-router';
|
||||||
import { Sidebar } from '../components/Sidebar.js';
|
import { Sidebar } from '../components/Sidebar.js';
|
||||||
import { NewRecommendationModal } from '../components/NewRecommendationModal.js';
|
import { NewRecommendationModal } from '../components/NewRecommendationModal.js';
|
||||||
import { useRecommendations } from '../hooks/useRecommendations.js';
|
import { useRecommendationsContext } from '../context/RecommendationsContext.js';
|
||||||
|
|
||||||
export function Home() {
|
export function Home() {
|
||||||
const { list, createNew } = useRecommendations();
|
const { list, createNew } = useRecommendationsContext();
|
||||||
const [showModal, setShowModal] = useState(false);
|
const [showModal, setShowModal] = useState(false);
|
||||||
|
|
||||||
const handleSelect = (id: string) => route(`/recom/${id}`);
|
const handleSelect = (id: string) => route(`/recom/${id}`);
|
||||||
@@ -15,6 +16,7 @@ export function Home() {
|
|||||||
liked_shows: string;
|
liked_shows: string;
|
||||||
disliked_shows: string;
|
disliked_shows: string;
|
||||||
themes: string;
|
themes: string;
|
||||||
|
brainstorm_count?: number;
|
||||||
}) => {
|
}) => {
|
||||||
const id = await createNew(body);
|
const id = await createNew(body);
|
||||||
route(`/recom/${id}`);
|
route(`/recom/${id}`);
|
||||||
|
|||||||
30
packages/frontend/src/pages/Recom.css
Normal file
30
packages/frontend/src/pages/Recom.css
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
/* ── Recom page ─────────────────────────────────────────── */
|
||||||
|
|
||||||
|
.recom-content {
|
||||||
|
min-height: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.content-area {
|
||||||
|
max-width: 860px;
|
||||||
|
margin: 0 auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.rec-title {
|
||||||
|
font-size: 20px;
|
||||||
|
font-weight: 700;
|
||||||
|
color: var(--text);
|
||||||
|
margin-bottom: 24px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.error-state {
|
||||||
|
color: var(--text-muted);
|
||||||
|
}
|
||||||
|
|
||||||
|
.error-state h2 {
|
||||||
|
color: var(--red);
|
||||||
|
margin-bottom: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.error-state p {
|
||||||
|
margin-bottom: 16px;
|
||||||
|
}
|
||||||
@@ -1,8 +1,11 @@
|
|||||||
import { useState, useCallback, useEffect } from 'preact/hooks';
|
import { useState, useCallback, useEffect } from 'preact/hooks';
|
||||||
|
import './Recom.css';
|
||||||
import { route } from 'preact-router';
|
import { route } from 'preact-router';
|
||||||
import { PipelineProgress } from '../components/PipelineProgress.js';
|
import { PipelineProgress } from '../components/PipelineProgress.js';
|
||||||
import { RecommendationCard } from '../components/RecommendationCard.js';
|
import { RecommendationCard } from '../components/RecommendationCard.js';
|
||||||
import { useRecommendations } from '../hooks/useRecommendations.js';
|
import { Sidebar } from '../components/Sidebar.js';
|
||||||
|
import { NewRecommendationModal } from '../components/NewRecommendationModal.js';
|
||||||
|
import { useRecommendationsContext } from '../context/RecommendationsContext.js';
|
||||||
import { useSSE } from '../hooks/useSSE.js';
|
import { useSSE } from '../hooks/useSSE.js';
|
||||||
import { getRecommendation } from '../api/client.js';
|
import { getRecommendation } from '../api/client.js';
|
||||||
import type { Recommendation, SSEEvent, StageMap, PipelineStage } from '../types/index.js';
|
import type { Recommendation, SSEEvent, StageMap, PipelineStage } from '../types/index.js';
|
||||||
@@ -22,11 +25,12 @@ const DEFAULT_STAGES: StageMap = {
|
|||||||
const STAGE_ORDER: (keyof StageMap)[] = ['interpreter', 'retrieval', 'ranking', 'curator'];
|
const STAGE_ORDER: (keyof StageMap)[] = ['interpreter', 'retrieval', 'ranking', 'curator'];
|
||||||
|
|
||||||
export function Recom({ id }: RecomProps) {
|
export function Recom({ id }: RecomProps) {
|
||||||
const { feedback, submitFeedback, rerank, updateStatus, refreshList } = useRecommendations();
|
const { list, feedback, submitFeedback, rerank, updateStatus, refreshList, createNew } = useRecommendationsContext();
|
||||||
|
|
||||||
const [rec, setRec] = useState<Recommendation | null>(null);
|
const [rec, setRec] = useState<Recommendation | null>(null);
|
||||||
const [stages, setStages] = useState<StageMap>(DEFAULT_STAGES);
|
const [stages, setStages] = useState<StageMap>(DEFAULT_STAGES);
|
||||||
const [sseUrl, setSseUrl] = useState<string | null>(null);
|
const [sseUrl, setSseUrl] = useState<string | null>(null);
|
||||||
|
const [showModal, setShowModal] = useState(false);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
setRec(null);
|
setRec(null);
|
||||||
@@ -83,66 +87,83 @@ export function Recom({ id }: RecomProps) {
|
|||||||
setRec((prev) => (prev ? { ...prev, status: 'pending' } : null));
|
setRec((prev) => (prev ? { ...prev, status: 'pending' } : null));
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const handleCreateNew = async (body: {
|
||||||
|
main_prompt: string;
|
||||||
|
liked_shows: string;
|
||||||
|
disliked_shows: string;
|
||||||
|
themes: string;
|
||||||
|
brainstorm_count?: number;
|
||||||
|
}) => {
|
||||||
|
const newId = await createNew(body);
|
||||||
|
route(`/recom/${newId}`);
|
||||||
|
};
|
||||||
|
|
||||||
const isRunning = rec?.status === 'running' || rec?.status === 'pending' || !!sseUrl;
|
const isRunning = rec?.status === 'running' || rec?.status === 'pending' || !!sseUrl;
|
||||||
const feedbackMap = new Map(feedback.map((f) => [f.tv_show_name, f]));
|
const feedbackMap = new Map(feedback.map((f) => [f.tv_show_name, f]));
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div class="recom-page">
|
<div class="layout">
|
||||||
<nav class="recom-nav">
|
<Sidebar
|
||||||
<a
|
list={list}
|
||||||
class="recom-back"
|
selectedId={id}
|
||||||
href="/"
|
onSelect={(sid) => route(`/recom/${sid}`)}
|
||||||
onClick={(e) => { e.preventDefault(); route('/'); }}
|
onNewClick={() => setShowModal(true)}
|
||||||
>
|
/>
|
||||||
← Recommender
|
|
||||||
</a>
|
|
||||||
</nav>
|
|
||||||
|
|
||||||
<div class="recom-content">
|
<main class="main-content">
|
||||||
{isRunning && (
|
<div class="recom-content">
|
||||||
<div class="content-area">
|
{isRunning && (
|
||||||
<PipelineProgress stages={stages} />
|
<div class="content-area">
|
||||||
</div>
|
<PipelineProgress stages={stages} />
|
||||||
)}
|
|
||||||
|
|
||||||
{!isRunning && rec?.status === 'done' && rec.recommendations && (
|
|
||||||
<div class="content-area">
|
|
||||||
<h2 class="rec-title">{rec.title}</h2>
|
|
||||||
<div class="cards-grid">
|
|
||||||
{rec.recommendations.map((show) => (
|
|
||||||
<RecommendationCard
|
|
||||||
key={show.title}
|
|
||||||
show={show}
|
|
||||||
existingFeedback={feedbackMap.get(show.title)}
|
|
||||||
onFeedback={async (name, stars, comment) => {
|
|
||||||
await submitFeedback({ tv_show_name: name, stars, feedback: comment });
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
))}
|
|
||||||
</div>
|
</div>
|
||||||
<div class="rerank-section">
|
)}
|
||||||
<button
|
|
||||||
class="btn-rerank"
|
{!isRunning && rec?.status === 'done' && rec.recommendations && (
|
||||||
onClick={handleRerank}
|
<div class="content-area">
|
||||||
disabled={feedback.length === 0}
|
<h2 class="rec-title">{rec.title}</h2>
|
||||||
title={feedback.length === 0 ? 'Rate at least one show to enable re-ranking' : 'Re-rank based on your feedback'}
|
<div class="cards-grid">
|
||||||
>
|
{rec.recommendations.map((show) => (
|
||||||
Re-rank with Feedback {feedback.length > 0 ? `(${feedback.length} rated)` : ''}
|
<RecommendationCard
|
||||||
|
key={show.title}
|
||||||
|
show={show}
|
||||||
|
existingFeedback={feedbackMap.get(show.title)}
|
||||||
|
onFeedback={async (name, stars, comment) => {
|
||||||
|
await submitFeedback({ tv_show_name: name, stars, feedback: comment });
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
))}
|
||||||
|
</div>
|
||||||
|
<div class="rerank-section">
|
||||||
|
<button
|
||||||
|
class="btn-rerank"
|
||||||
|
onClick={handleRerank}
|
||||||
|
disabled={feedback.length === 0}
|
||||||
|
title={feedback.length === 0 ? 'Rate at least one show to enable re-ranking' : 'Re-rank based on your feedback'}
|
||||||
|
>
|
||||||
|
Re-rank with Feedback {feedback.length > 0 ? `(${feedback.length} rated)` : ''}
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
|
||||||
|
{!isRunning && rec?.status === 'error' && (
|
||||||
|
<div class="content-area error-state">
|
||||||
|
<h2>Something went wrong</h2>
|
||||||
|
<p>The pipeline encountered an error. You can try again by clicking Re-rank.</p>
|
||||||
|
<button class="btn-primary" onClick={handleRerank}>
|
||||||
|
Try Again
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
)}
|
||||||
)}
|
</div>
|
||||||
|
</main>
|
||||||
|
|
||||||
{!isRunning && rec?.status === 'error' && (
|
{showModal && (
|
||||||
<div class="content-area error-state">
|
<NewRecommendationModal
|
||||||
<h2>Something went wrong</h2>
|
onClose={() => setShowModal(false)}
|
||||||
<p>The pipeline encountered an error. You can try again by clicking Re-rank.</p>
|
onSubmit={handleCreateNew}
|
||||||
<button class="btn-primary" onClick={handleRerank}>
|
/>
|
||||||
Try Again
|
)}
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
)}
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user