initial commit
Some checks failed
Recommender Build and Deploy (internal) / Build Recommender Image (push) Failing after 3m48s
Recommender Build and Deploy (internal) / Deploy Recommender (internal) (push) Has been skipped

This commit is contained in:
2026-03-25 17:34:37 -03:00
commit f9c7582e4d
52 changed files with 7022 additions and 0 deletions

View 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');
}