initial commit
This commit is contained in:
54
packages/frontend/src/api/client.ts
Normal file
54
packages/frontend/src/api/client.ts
Normal file
@@ -0,0 +1,54 @@
|
||||
import type { Recommendation, RecommendationSummary, FeedbackEntry } from '../types/index.js';
|
||||
|
||||
const BASE = '/api';
|
||||
|
||||
async function request<T>(path: string, options?: RequestInit): Promise<T> {
|
||||
const res = await fetch(`${BASE}${path}`, {
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
...options,
|
||||
});
|
||||
if (!res.ok) {
|
||||
const text = await res.text();
|
||||
throw new Error(`HTTP ${res.status}: ${text}`);
|
||||
}
|
||||
return res.json() as Promise<T>;
|
||||
}
|
||||
|
||||
export function createRecommendation(body: {
|
||||
main_prompt: string;
|
||||
liked_shows: string;
|
||||
disliked_shows: string;
|
||||
themes: string;
|
||||
}): Promise<{ id: string }> {
|
||||
return request('/recommendations', {
|
||||
method: 'POST',
|
||||
body: JSON.stringify(body),
|
||||
});
|
||||
}
|
||||
|
||||
export function listRecommendations(): Promise<RecommendationSummary[]> {
|
||||
return request('/recommendations');
|
||||
}
|
||||
|
||||
export function getRecommendation(id: string): Promise<Recommendation> {
|
||||
return request(`/recommendations/${id}`);
|
||||
}
|
||||
|
||||
export function rerankRecommendation(id: string): Promise<{ ok: boolean }> {
|
||||
return request(`/recommendations/${id}/rerank`, { method: 'POST' });
|
||||
}
|
||||
|
||||
export function submitFeedback(body: {
|
||||
tv_show_name: string;
|
||||
stars: number;
|
||||
feedback?: string;
|
||||
}): Promise<{ ok: boolean }> {
|
||||
return request('/feedback', {
|
||||
method: 'POST',
|
||||
body: JSON.stringify(body),
|
||||
});
|
||||
}
|
||||
|
||||
export function getFeedback(): Promise<FeedbackEntry[]> {
|
||||
return request('/feedback');
|
||||
}
|
||||
1
packages/frontend/src/app.css
Normal file
1
packages/frontend/src/app.css
Normal file
@@ -0,0 +1 @@
|
||||
/* App-level styles are in index.css */
|
||||
5
packages/frontend/src/app.tsx
Normal file
5
packages/frontend/src/app.tsx
Normal file
@@ -0,0 +1,5 @@
|
||||
import { Home } from './pages/Home.js';
|
||||
|
||||
export function App() {
|
||||
return <Home />;
|
||||
}
|
||||
BIN
packages/frontend/src/assets/hero.png
Normal file
BIN
packages/frontend/src/assets/hero.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 44 KiB |
1
packages/frontend/src/assets/preact.svg
Normal file
1
packages/frontend/src/assets/preact.svg
Normal file
@@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="iconify iconify--logos" width="27.68" height="32" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 296"><path fill="#673AB8" d="m128 0l128 73.9v147.8l-128 73.9L0 221.7V73.9z"></path><path fill="#FFF" d="M34.865 220.478c17.016 21.78 71.095 5.185 122.15-34.704c51.055-39.888 80.24-88.345 63.224-110.126c-17.017-21.78-71.095-5.184-122.15 34.704c-51.055 39.89-80.24 88.346-63.224 110.126Zm7.27-5.68c-5.644-7.222-3.178-21.402 7.573-39.253c11.322-18.797 30.541-39.548 54.06-57.923c23.52-18.375 48.303-32.004 69.281-38.442c19.922-6.113 34.277-5.075 39.92 2.148c5.644 7.223 3.178 21.403-7.573 39.254c-11.322 18.797-30.541 39.547-54.06 57.923c-23.52 18.375-48.304 32.004-69.281 38.441c-19.922 6.114-34.277 5.076-39.92-2.147Z"></path><path fill="#FFF" d="M220.239 220.478c17.017-21.78-12.169-70.237-63.224-110.126C105.96 70.464 51.88 53.868 34.865 75.648c-17.017 21.78 12.169 70.238 63.224 110.126c51.055 39.889 105.133 56.485 122.15 34.704Zm-7.27-5.68c-5.643 7.224-19.998 8.262-39.92 2.148c-20.978-6.437-45.761-20.066-69.28-38.441c-23.52-18.376-42.74-39.126-54.06-57.923c-10.752-17.851-13.218-32.03-7.575-39.254c5.644-7.223 19.999-8.261 39.92-2.148c20.978 6.438 45.762 20.067 69.281 38.442c23.52 18.375 42.739 39.126 54.06 57.923c10.752 17.85 13.218 32.03 7.574 39.254Z"></path><path fill="#FFF" d="M127.552 167.667c10.827 0 19.603-8.777 19.603-19.604c0-10.826-8.776-19.603-19.603-19.603c-10.827 0-19.604 8.777-19.604 19.603c0 10.827 8.777 19.604 19.604 19.604Z"></path></svg>
|
||||
|
After Width: | Height: | Size: 1.6 KiB |
1
packages/frontend/src/assets/vite.svg
Normal file
1
packages/frontend/src/assets/vite.svg
Normal file
File diff suppressed because one or more lines are too long
|
After Width: | Height: | Size: 8.5 KiB |
115
packages/frontend/src/components/NewRecommendationModal.tsx
Normal file
115
packages/frontend/src/components/NewRecommendationModal.tsx
Normal file
@@ -0,0 +1,115 @@
|
||||
import { useState } from 'preact/hooks';
|
||||
|
||||
interface NewRecommendationModalProps {
|
||||
onClose: () => void;
|
||||
onSubmit: (body: {
|
||||
main_prompt: string;
|
||||
liked_shows: string;
|
||||
disliked_shows: string;
|
||||
themes: string;
|
||||
}) => Promise<void>;
|
||||
}
|
||||
|
||||
export function NewRecommendationModal({ onClose, onSubmit }: NewRecommendationModalProps) {
|
||||
const [mainPrompt, setMainPrompt] = useState('');
|
||||
const [likedShows, setLikedShows] = useState('');
|
||||
const [dislikedShows, setDislikedShows] = useState('');
|
||||
const [themes, setThemes] = useState('');
|
||||
const [loading, setLoading] = useState(false);
|
||||
|
||||
const handleSubmit = async (e: Event) => {
|
||||
e.preventDefault();
|
||||
if (!mainPrompt.trim()) return;
|
||||
setLoading(true);
|
||||
try {
|
||||
await onSubmit({
|
||||
main_prompt: mainPrompt.trim(),
|
||||
liked_shows: likedShows.trim(),
|
||||
disliked_shows: dislikedShows.trim(),
|
||||
themes: themes.trim(),
|
||||
});
|
||||
onClose();
|
||||
} finally {
|
||||
setLoading(false);
|
||||
}
|
||||
};
|
||||
|
||||
const handleBackdropClick = (e: MouseEvent) => {
|
||||
if ((e.target as HTMLElement).classList.contains('modal-backdrop')) {
|
||||
onClose();
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
<div class="modal-backdrop" onClick={handleBackdropClick}>
|
||||
<div class="modal">
|
||||
<div class="modal-header">
|
||||
<h2>New Recommendation</h2>
|
||||
<button class="modal-close" onClick={onClose} aria-label="Close">×</button>
|
||||
</div>
|
||||
|
||||
<form class="modal-form" onSubmit={handleSubmit}>
|
||||
<div class="form-group">
|
||||
<label for="main-prompt">What are you looking for?</label>
|
||||
<textarea
|
||||
id="main-prompt"
|
||||
class="form-textarea"
|
||||
placeholder="Describe what you want to watch. Be as specific as you like — mood, themes, setting, what you've enjoyed before..."
|
||||
value={mainPrompt}
|
||||
onInput={(e) => setMainPrompt((e.target as HTMLTextAreaElement).value)}
|
||||
rows={5}
|
||||
required
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div class="form-row">
|
||||
<div class="form-group">
|
||||
<label for="liked-shows">Shows you liked</label>
|
||||
<input
|
||||
id="liked-shows"
|
||||
type="text"
|
||||
class="form-input"
|
||||
placeholder="e.g. Breaking Bad, The Wire"
|
||||
value={likedShows}
|
||||
onInput={(e) => setLikedShows((e.target as HTMLInputElement).value)}
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="disliked-shows">Shows you disliked</label>
|
||||
<input
|
||||
id="disliked-shows"
|
||||
type="text"
|
||||
class="form-input"
|
||||
placeholder="e.g. Game of Thrones"
|
||||
value={dislikedShows}
|
||||
onInput={(e) => setDislikedShows((e.target as HTMLInputElement).value)}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="themes">Themes and requirements</label>
|
||||
<input
|
||||
id="themes"
|
||||
type="text"
|
||||
class="form-input"
|
||||
placeholder="e.g. dramatic setting, historical, sci-fi, etc."
|
||||
value={themes}
|
||||
onInput={(e) => setThemes((e.target as HTMLInputElement).value)}
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div class="modal-actions">
|
||||
<button type="button" class="btn-secondary" onClick={onClose} disabled={loading}>
|
||||
Cancel
|
||||
</button>
|
||||
<button type="submit" class="btn-primary" disabled={loading || !mainPrompt.trim()}>
|
||||
{loading ? 'Starting…' : 'Get Recommendations'}
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
41
packages/frontend/src/components/PipelineProgress.tsx
Normal file
41
packages/frontend/src/components/PipelineProgress.tsx
Normal file
@@ -0,0 +1,41 @@
|
||||
import type { StageMap, StageStatus } from '../types/index.js';
|
||||
|
||||
const STAGES: { key: keyof StageMap; label: string }[] = [
|
||||
{ key: 'interpreter', label: 'Interpreting Preferences' },
|
||||
{ key: 'retrieval', label: 'Generating Candidates' },
|
||||
{ key: 'ranking', label: 'Ranking Shows' },
|
||||
{ key: 'curator', label: 'Curating Results' },
|
||||
];
|
||||
|
||||
interface PipelineProgressProps {
|
||||
stages: StageMap;
|
||||
}
|
||||
|
||||
function StageIcon({ status }: { status: StageStatus }) {
|
||||
switch (status) {
|
||||
case 'done':
|
||||
return <span class="stage-icon stage-done">✓</span>;
|
||||
case 'error':
|
||||
return <span class="stage-icon stage-error">✗</span>;
|
||||
case 'running':
|
||||
return <span class="stage-icon stage-running spinner">⟳</span>;
|
||||
default:
|
||||
return <span class="stage-icon stage-pending">○</span>;
|
||||
}
|
||||
}
|
||||
|
||||
export function PipelineProgress({ stages }: PipelineProgressProps) {
|
||||
return (
|
||||
<div class="pipeline-progress">
|
||||
<h3 class="pipeline-title">Generating Recommendations…</h3>
|
||||
<ul class="pipeline-steps">
|
||||
{STAGES.map(({ key, label }) => (
|
||||
<li key={key} class={`pipeline-step pipeline-step--${stages[key]}`}>
|
||||
<StageIcon status={stages[key]} />
|
||||
<span class="pipeline-step-label">{label}</span>
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
85
packages/frontend/src/components/RecommendationCard.tsx
Normal file
85
packages/frontend/src/components/RecommendationCard.tsx
Normal file
@@ -0,0 +1,85 @@
|
||||
import { useState } from 'preact/hooks';
|
||||
import type { CuratorOutput, CuratorCategory } from '../types/index.js';
|
||||
|
||||
interface RecommendationCardProps {
|
||||
show: CuratorOutput;
|
||||
existingFeedback?: { stars: number; feedback: string };
|
||||
onFeedback: (tv_show_name: string, stars: number, feedback: string) => Promise<void>;
|
||||
}
|
||||
|
||||
const CATEGORY_COLORS: Record<CuratorCategory, string> = {
|
||||
'Definitely Like': 'badge-green',
|
||||
'Might Like': 'badge-blue',
|
||||
'Questionable': 'badge-yellow',
|
||||
'Will Not Like': 'badge-red',
|
||||
};
|
||||
|
||||
export function RecommendationCard({ show, existingFeedback, onFeedback }: RecommendationCardProps) {
|
||||
const [selectedStars, setSelectedStars] = useState(existingFeedback?.stars ?? 0);
|
||||
const [comment, setComment] = useState(existingFeedback?.feedback ?? '');
|
||||
const [showComment, setShowComment] = useState(false);
|
||||
const [submitted, setSubmitted] = useState(!!existingFeedback);
|
||||
const [saving, setSaving] = useState(false);
|
||||
|
||||
const handleStarClick = (stars: number) => {
|
||||
setSelectedStars(stars);
|
||||
setShowComment(true);
|
||||
};
|
||||
|
||||
const handleSubmit = async () => {
|
||||
if (!selectedStars) return;
|
||||
setSaving(true);
|
||||
try {
|
||||
await onFeedback(show.title, selectedStars, comment);
|
||||
setSubmitted(true);
|
||||
setShowComment(false);
|
||||
} finally {
|
||||
setSaving(false);
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
<span class={`badge ${CATEGORY_COLORS[show.category]}`}>{show.category}</span>
|
||||
<h3 class="card-title">{show.title}</h3>
|
||||
</div>
|
||||
<p class="card-explanation">{show.explanation}</p>
|
||||
|
||||
<div class="card-feedback">
|
||||
<div class="star-rating">
|
||||
{[1, 2, 3].map((star) => (
|
||||
<button
|
||||
key={star}
|
||||
class={`star-btn${selectedStars >= star ? ' star-active' : ''}`}
|
||||
onClick={() => handleStarClick(star)}
|
||||
aria-label={`Rate ${star} star${star > 1 ? 's' : ''}`}
|
||||
>
|
||||
{selectedStars >= star ? '★' : '☆'}
|
||||
</button>
|
||||
))}
|
||||
{submitted && <span class="feedback-saved">Saved</span>}
|
||||
</div>
|
||||
|
||||
{showComment && !submitted && (
|
||||
<div class="comment-area">
|
||||
<textarea
|
||||
class="form-textarea comment-input"
|
||||
placeholder="Optional comment…"
|
||||
value={comment}
|
||||
onInput={(e) => setComment((e.target as HTMLTextAreaElement).value)}
|
||||
rows={2}
|
||||
/>
|
||||
<button
|
||||
class="btn-primary btn-sm"
|
||||
onClick={handleSubmit}
|
||||
disabled={saving || !selectedStars}
|
||||
>
|
||||
{saving ? 'Saving…' : 'Save Feedback'}
|
||||
</button>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
60
packages/frontend/src/components/Sidebar.tsx
Normal file
60
packages/frontend/src/components/Sidebar.tsx
Normal file
@@ -0,0 +1,60 @@
|
||||
import type { RecommendationSummary } from '../types/index.js';
|
||||
|
||||
interface SidebarProps {
|
||||
list: RecommendationSummary[];
|
||||
selectedId: string | null;
|
||||
onSelect: (id: string) => void;
|
||||
onNewClick: () => void;
|
||||
}
|
||||
|
||||
function statusIcon(status: RecommendationSummary['status']): string {
|
||||
switch (status) {
|
||||
case 'done': return '✓';
|
||||
case 'error': return '✗';
|
||||
case 'running': return '⟳';
|
||||
default: return '…';
|
||||
}
|
||||
}
|
||||
|
||||
function statusClass(status: RecommendationSummary['status']): string {
|
||||
switch (status) {
|
||||
case 'done': return 'status-done';
|
||||
case 'error': return 'status-error';
|
||||
case 'running': return 'status-running';
|
||||
default: return 'status-pending';
|
||||
}
|
||||
}
|
||||
|
||||
export function Sidebar({ list, selectedId, onSelect, onNewClick }: SidebarProps) {
|
||||
return (
|
||||
<aside class="sidebar">
|
||||
<div class="sidebar-header">
|
||||
<span class="sidebar-title">Recommender</span>
|
||||
</div>
|
||||
|
||||
<button class="btn-new" onClick={onNewClick}>
|
||||
+ New Recommendation
|
||||
</button>
|
||||
|
||||
<div class="sidebar-section-label">History</div>
|
||||
|
||||
<ul class="sidebar-list">
|
||||
{list.length === 0 && (
|
||||
<li class="sidebar-empty">No recommendations yet</li>
|
||||
)}
|
||||
{list.map((item) => (
|
||||
<li
|
||||
key={item.id}
|
||||
class={`sidebar-item${selectedId === item.id ? ' selected' : ''}`}
|
||||
onClick={() => onSelect(item.id)}
|
||||
>
|
||||
<span class={`sidebar-icon ${statusClass(item.status)}`}>
|
||||
{statusIcon(item.status)}
|
||||
</span>
|
||||
<span class="sidebar-item-title">{item.title}</span>
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
</aside>
|
||||
);
|
||||
}
|
||||
83
packages/frontend/src/hooks/useRecommendations.ts
Normal file
83
packages/frontend/src/hooks/useRecommendations.ts
Normal file
@@ -0,0 +1,83 @@
|
||||
import { useState, useEffect, useCallback } from 'preact/hooks';
|
||||
import type { RecommendationSummary, FeedbackEntry } from '../types/index.js';
|
||||
import {
|
||||
listRecommendations,
|
||||
createRecommendation,
|
||||
rerankRecommendation,
|
||||
submitFeedback,
|
||||
getFeedback,
|
||||
} from '../api/client.js';
|
||||
|
||||
export function useRecommendations() {
|
||||
const [list, setList] = useState<RecommendationSummary[]>([]);
|
||||
const [selectedId, setSelectedId] = useState<string | null>(null);
|
||||
const [feedback, setFeedback] = useState<FeedbackEntry[]>([]);
|
||||
|
||||
const refreshList = useCallback(async () => {
|
||||
const rows = await listRecommendations();
|
||||
setList(rows);
|
||||
}, []);
|
||||
|
||||
const refreshFeedback = useCallback(async () => {
|
||||
const rows = await getFeedback();
|
||||
setFeedback(rows);
|
||||
}, []);
|
||||
|
||||
useEffect(() => {
|
||||
void refreshList();
|
||||
void refreshFeedback();
|
||||
}, [refreshList, refreshFeedback]);
|
||||
|
||||
const createNew = useCallback(
|
||||
async (body: {
|
||||
main_prompt: string;
|
||||
liked_shows: string;
|
||||
disliked_shows: string;
|
||||
themes: string;
|
||||
}) => {
|
||||
const { id } = await createRecommendation(body);
|
||||
await refreshList();
|
||||
setSelectedId(id);
|
||||
return id;
|
||||
},
|
||||
[refreshList],
|
||||
);
|
||||
|
||||
const rerank = useCallback(
|
||||
async (id: string) => {
|
||||
await rerankRecommendation(id);
|
||||
// Update local list to show pending status
|
||||
setList((prev) =>
|
||||
prev.map((r) => (r.id === id ? { ...r, status: 'pending' as const } : r)),
|
||||
);
|
||||
},
|
||||
[],
|
||||
);
|
||||
|
||||
const handleSubmitFeedback = useCallback(
|
||||
async (body: { tv_show_name: string; stars: number; feedback?: string }) => {
|
||||
await submitFeedback(body);
|
||||
await refreshFeedback();
|
||||
},
|
||||
[refreshFeedback],
|
||||
);
|
||||
|
||||
const updateStatus = useCallback(
|
||||
(id: string, status: RecommendationSummary['status']) => {
|
||||
setList((prev) => prev.map((r) => (r.id === id ? { ...r, status } : r)));
|
||||
},
|
||||
[],
|
||||
);
|
||||
|
||||
return {
|
||||
list,
|
||||
selectedId,
|
||||
feedback,
|
||||
setSelectedId,
|
||||
createNew,
|
||||
rerank,
|
||||
submitFeedback: handleSubmitFeedback,
|
||||
updateStatus,
|
||||
refreshList,
|
||||
};
|
||||
}
|
||||
49
packages/frontend/src/hooks/useSSE.ts
Normal file
49
packages/frontend/src/hooks/useSSE.ts
Normal file
@@ -0,0 +1,49 @@
|
||||
import { useEffect, useRef } from 'preact/hooks';
|
||||
import type { SSEEvent } from '../types/index.js';
|
||||
|
||||
export function useSSE(
|
||||
url: string | null,
|
||||
onEvent: (event: SSEEvent) => void,
|
||||
): { close: () => void } {
|
||||
const esRef = useRef<EventSource | null>(null);
|
||||
const onEventRef = useRef(onEvent);
|
||||
onEventRef.current = onEvent;
|
||||
|
||||
useEffect(() => {
|
||||
if (!url) return;
|
||||
|
||||
const es = new EventSource(url);
|
||||
esRef.current = es;
|
||||
|
||||
es.onmessage = (e: MessageEvent) => {
|
||||
try {
|
||||
const event = JSON.parse(e.data as string) as SSEEvent;
|
||||
onEventRef.current(event);
|
||||
|
||||
if (event.stage === 'complete' || event.status === 'error') {
|
||||
es.close();
|
||||
esRef.current = null;
|
||||
}
|
||||
} catch {
|
||||
// ignore parse errors
|
||||
}
|
||||
};
|
||||
|
||||
es.onerror = () => {
|
||||
es.close();
|
||||
esRef.current = null;
|
||||
};
|
||||
|
||||
return () => {
|
||||
es.close();
|
||||
esRef.current = null;
|
||||
};
|
||||
}, [url]);
|
||||
|
||||
return {
|
||||
close: () => {
|
||||
esRef.current?.close();
|
||||
esRef.current = null;
|
||||
},
|
||||
};
|
||||
}
|
||||
558
packages/frontend/src/index.css
Normal file
558
packages/frontend/src/index.css
Normal file
@@ -0,0 +1,558 @@
|
||||
*, *::before, *::after {
|
||||
box-sizing: border-box;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
:root {
|
||||
--bg: #0f1117;
|
||||
--bg-surface: #1a1d27;
|
||||
--bg-surface-2: #222535;
|
||||
--bg-surface-3: #2a2e42;
|
||||
--border: #2e3248;
|
||||
--text: #e2e4ed;
|
||||
--text-muted: #8a8fa8;
|
||||
--text-dim: #5a5f77;
|
||||
--accent: #6366f1;
|
||||
--accent-hover: #4f52d9;
|
||||
--accent-dim: rgba(99, 102, 241, 0.15);
|
||||
--green: #22c55e;
|
||||
--blue: #3b82f6;
|
||||
--yellow: #eab308;
|
||||
--red: #ef4444;
|
||||
--radius: 8px;
|
||||
--radius-sm: 4px;
|
||||
--sidebar-width: 260px;
|
||||
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
|
||||
font-size: 14px;
|
||||
color: var(--text);
|
||||
background: var(--bg);
|
||||
-webkit-font-smoothing: antialiased;
|
||||
}
|
||||
|
||||
html, body, #app {
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
/* ── Layout ────────────────────────────────────────────── */
|
||||
|
||||
.layout {
|
||||
display: flex;
|
||||
height: 100vh;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.main-content {
|
||||
flex: 1;
|
||||
overflow-y: auto;
|
||||
padding: 32px;
|
||||
}
|
||||
|
||||
/* ── 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);
|
||||
}
|
||||
|
||||
.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 {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
height: 100%;
|
||||
gap: 12px;
|
||||
color: var(--text-muted);
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.empty-state h2 {
|
||||
font-size: 24px;
|
||||
font-weight: 700;
|
||||
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 ────────────────────────────────────────────── */
|
||||
|
||||
.btn-primary {
|
||||
padding: 10px 20px;
|
||||
background: var(--accent);
|
||||
color: #fff;
|
||||
border: none;
|
||||
border-radius: var(--radius);
|
||||
font-size: 14px;
|
||||
font-weight: 600;
|
||||
cursor: pointer;
|
||||
transition: background 0.15s;
|
||||
}
|
||||
|
||||
.btn-primary:hover:not(:disabled) {
|
||||
background: var(--accent-hover);
|
||||
}
|
||||
|
||||
.btn-primary:disabled {
|
||||
opacity: 0.5;
|
||||
cursor: not-allowed;
|
||||
}
|
||||
|
||||
.btn-primary.btn-sm {
|
||||
padding: 6px 14px;
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
.btn-secondary {
|
||||
padding: 10px 20px;
|
||||
background: var(--bg-surface-2);
|
||||
color: var(--text-muted);
|
||||
border: 1px solid var(--border);
|
||||
border-radius: var(--radius);
|
||||
font-size: 14px;
|
||||
font-weight: 500;
|
||||
cursor: pointer;
|
||||
transition: background 0.15s;
|
||||
}
|
||||
|
||||
.btn-secondary:hover:not(:disabled) {
|
||||
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;
|
||||
}
|
||||
5
packages/frontend/src/main.tsx
Normal file
5
packages/frontend/src/main.tsx
Normal file
@@ -0,0 +1,5 @@
|
||||
import { render } from 'preact'
|
||||
import './index.css'
|
||||
import { App } from './app.tsx'
|
||||
|
||||
render(<App />, document.getElementById('app')!)
|
||||
192
packages/frontend/src/pages/Home.tsx
Normal file
192
packages/frontend/src/pages/Home.tsx
Normal file
@@ -0,0 +1,192 @@
|
||||
import { useState, useCallback, useEffect } from 'preact/hooks';
|
||||
import { Sidebar } from '../components/Sidebar.js';
|
||||
import { NewRecommendationModal } from '../components/NewRecommendationModal.js';
|
||||
import { PipelineProgress } from '../components/PipelineProgress.js';
|
||||
import { RecommendationCard } from '../components/RecommendationCard.js';
|
||||
import { useRecommendations } from '../hooks/useRecommendations.js';
|
||||
import { useSSE } from '../hooks/useSSE.js';
|
||||
import { getRecommendation } from '../api/client.js';
|
||||
import type { Recommendation, SSEEvent, StageMap, PipelineStage } from '../types/index.js';
|
||||
|
||||
const DEFAULT_STAGES: StageMap = {
|
||||
interpreter: 'pending',
|
||||
retrieval: 'pending',
|
||||
ranking: 'pending',
|
||||
curator: 'pending',
|
||||
};
|
||||
|
||||
const STAGE_ORDER: (keyof StageMap)[] = ['interpreter', 'retrieval', 'ranking', 'curator'];
|
||||
|
||||
export function Home() {
|
||||
const {
|
||||
list,
|
||||
selectedId,
|
||||
feedback,
|
||||
setSelectedId,
|
||||
createNew,
|
||||
rerank,
|
||||
submitFeedback,
|
||||
updateStatus,
|
||||
refreshList,
|
||||
} = useRecommendations();
|
||||
|
||||
const [showModal, setShowModal] = useState(false);
|
||||
const [selectedRec, setSelectedRec] = useState<Recommendation | null>(null);
|
||||
const [stages, setStages] = useState<StageMap>(DEFAULT_STAGES);
|
||||
const [sseUrl, setSseUrl] = useState<string | null>(null);
|
||||
|
||||
// Load full recommendation when selected
|
||||
useEffect(() => {
|
||||
if (!selectedId) {
|
||||
setSelectedRec(null);
|
||||
return;
|
||||
}
|
||||
void getRecommendation(selectedId).then((rec) => {
|
||||
setSelectedRec(rec);
|
||||
// If already running or pending, open SSE
|
||||
if (rec.status === 'running' || rec.status === 'pending') {
|
||||
setStages(DEFAULT_STAGES);
|
||||
setSseUrl(`/api/recommendations/${selectedId}/stream`);
|
||||
}
|
||||
});
|
||||
}, [selectedId]);
|
||||
|
||||
const handleSSEEvent = useCallback(
|
||||
(event: SSEEvent) => {
|
||||
if (!selectedId) return;
|
||||
|
||||
if (event.stage !== 'complete') {
|
||||
const stageKey = event.stage as keyof StageMap;
|
||||
if (STAGE_ORDER.includes(stageKey)) {
|
||||
setStages((prev) => ({
|
||||
...prev,
|
||||
[stageKey]: event.status === 'start' ? 'running' : event.status === 'done' ? 'done' : 'error',
|
||||
}));
|
||||
}
|
||||
}
|
||||
|
||||
if (event.stage === 'complete' && event.status === 'done') {
|
||||
setSseUrl(null);
|
||||
updateStatus(selectedId, 'done');
|
||||
// Reload full recommendation to get results
|
||||
void getRecommendation(selectedId).then(setSelectedRec);
|
||||
void refreshList();
|
||||
}
|
||||
|
||||
if (event.status === 'error') {
|
||||
setSseUrl(null);
|
||||
updateStatus(selectedId, 'error');
|
||||
const stageKey = event.stage as PipelineStage;
|
||||
if (stageKey !== 'complete') {
|
||||
setStages((prev) => ({ ...prev, [stageKey as keyof StageMap]: 'error' }));
|
||||
}
|
||||
}
|
||||
},
|
||||
[selectedId, updateStatus, refreshList],
|
||||
);
|
||||
|
||||
useSSE(sseUrl, handleSSEEvent);
|
||||
|
||||
const handleSelect = (id: string) => {
|
||||
setSseUrl(null);
|
||||
setStages(DEFAULT_STAGES);
|
||||
setSelectedId(id);
|
||||
};
|
||||
|
||||
const handleCreateNew = async (body: {
|
||||
main_prompt: string;
|
||||
liked_shows: string;
|
||||
disliked_shows: string;
|
||||
themes: string;
|
||||
}) => {
|
||||
const id = await createNew(body);
|
||||
setStages(DEFAULT_STAGES);
|
||||
setSseUrl(`/api/recommendations/${id}/stream`);
|
||||
};
|
||||
|
||||
const handleRerank = async () => {
|
||||
if (!selectedId) return;
|
||||
await rerank(selectedId);
|
||||
setStages(DEFAULT_STAGES);
|
||||
setSseUrl(`/api/recommendations/${selectedId}/stream`);
|
||||
setSelectedRec((prev) => (prev ? { ...prev, status: 'pending' } : null));
|
||||
};
|
||||
|
||||
const isRunning =
|
||||
selectedRec?.status === 'running' || selectedRec?.status === 'pending' || !!sseUrl;
|
||||
|
||||
const feedbackMap = new Map(feedback.map((f) => [f.tv_show_name, f]));
|
||||
|
||||
return (
|
||||
<div class="layout">
|
||||
<Sidebar
|
||||
list={list}
|
||||
selectedId={selectedId}
|
||||
onSelect={handleSelect}
|
||||
onNewClick={() => setShowModal(true)}
|
||||
/>
|
||||
|
||||
<main class="main-content">
|
||||
{!selectedId && (
|
||||
<div class="empty-state">
|
||||
<h2>TV Show Recommender</h2>
|
||||
<p>Click <strong>+ New Recommendation</strong> to get started.</p>
|
||||
</div>
|
||||
)}
|
||||
|
||||
{selectedId && isRunning && (
|
||||
<div class="content-area">
|
||||
<PipelineProgress stages={stages} />
|
||||
</div>
|
||||
)}
|
||||
|
||||
{selectedId && !isRunning && selectedRec?.status === 'done' && selectedRec.recommendations && (
|
||||
<div class="content-area">
|
||||
<h2 class="rec-title">{selectedRec.title}</h2>
|
||||
|
||||
<div class="cards-grid">
|
||||
{selectedRec.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 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>
|
||||
)}
|
||||
|
||||
{selectedId && !isRunning && selectedRec?.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>
|
||||
</div>
|
||||
)}
|
||||
</main>
|
||||
|
||||
{showModal && (
|
||||
<NewRecommendationModal
|
||||
onClose={() => setShowModal(false)}
|
||||
onSubmit={handleCreateNew}
|
||||
/>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
49
packages/frontend/src/types/index.ts
Normal file
49
packages/frontend/src/types/index.ts
Normal file
@@ -0,0 +1,49 @@
|
||||
export type CuratorCategory = 'Definitely Like' | 'Might Like' | 'Questionable' | 'Will Not Like';
|
||||
|
||||
export interface CuratorOutput {
|
||||
title: string;
|
||||
explanation: string;
|
||||
category: CuratorCategory;
|
||||
}
|
||||
|
||||
export type RecommendationStatus = 'pending' | 'running' | 'done' | 'error';
|
||||
|
||||
export interface Recommendation {
|
||||
id: string;
|
||||
title: string;
|
||||
main_prompt: string;
|
||||
liked_shows: string;
|
||||
disliked_shows: string;
|
||||
themes: string;
|
||||
recommendations: CuratorOutput[] | null;
|
||||
status: RecommendationStatus;
|
||||
created_at: string;
|
||||
}
|
||||
|
||||
export interface RecommendationSummary {
|
||||
id: string;
|
||||
title: string;
|
||||
status: RecommendationStatus;
|
||||
created_at: string;
|
||||
}
|
||||
|
||||
export interface FeedbackEntry {
|
||||
id: string;
|
||||
tv_show_name: string;
|
||||
stars: number;
|
||||
feedback: string;
|
||||
created_at: string;
|
||||
}
|
||||
|
||||
export type PipelineStage = 'interpreter' | 'retrieval' | 'ranking' | 'curator' | 'complete';
|
||||
export type SSEStatus = 'start' | 'done' | 'error';
|
||||
|
||||
export interface SSEEvent {
|
||||
stage: PipelineStage;
|
||||
status: SSEStatus;
|
||||
data?: unknown;
|
||||
}
|
||||
|
||||
export type StageStatus = 'pending' | 'running' | 'done' | 'error';
|
||||
|
||||
export type StageMap = Record<Exclude<PipelineStage, 'complete'>, StageStatus>;
|
||||
Reference in New Issue
Block a user