Files
sorsfonalak/services/frontend/src/lib/tarot.ts
T
fecoandClaude Opus 5.5 b0fc547b73
CI / test (push) Successful in 1m29s
CI / build (push) Successful in 5m52s
CI / deploy (push) Skipped
Tarot readings: AI-written, drawn on the server, sold as units
A new Kártyajóslás page: choose a spread (1, 3 or 5 cards), ask a
question, pick the cards from the fanned deck and watch them turn over;
the reading is written by the detailed-analysis model from the cards,
their positions and base meanings, the question and the reader's Sun,
Moon and Ascendant. The server shuffles and draws, so nobody can draw
again for free. A reading is a 'tarot' analysis (worker, retries,
fallback, refunds and admin regeneration as for analyses), uses one
'tarot' unit, and survives recalculations; deleting the account
deletes it.

Packages carry 2/5/10 readings, the new +5 kártyajóslás addon costs
1 000 Ft. The card artwork comes from the tarot design studio
(celestial astrolabe style); the deck JSON is shared by the frontend
and the prompt. A public example is at /kartyajoslas/pelda.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012vLHzh5qUhFtmJhzkcTbXL
2026-11-20 14:35:50 +00:00

72 lines
2.1 KiB
TypeScript

/** The tarot deck and spreads (the backend draws from the same deck file). */
import deckData from "@/content/tarot-deck.json";
export type TarotSuit = "major" | "wands" | "cups" | "swords" | "pentacles";
export type TarotElement = "Tűz" | "Víz" | "Levegő" | "Föld" | "Éter";
export type MinorRank = 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | "page" | "knight" | "queen" | "king";
export interface TarotCardData {
id: string;
number: number;
roman?: string;
rank?: MinorRank;
nameHu: string;
nameEn: string;
suit: TarotSuit;
suitLabelHu: string;
element: TarotElement;
astroRuler: string;
astroGlyph: string;
keywords: string[];
upright: string;
reversed: string;
}
export const DECK = deckData as TarotCardData[];
export function tarotCard(id: string): TarotCardData | undefined {
return DECK.find((c) => c.id === id);
}
export type SpreadId = "daily" | "trinity" | "astro_cross";
/** The spreads to choose from (the positions come with the reading). */
export const SPREADS: { id: SpreadId; name: string; cards: number; about: string }[] = [
{ id: "daily", name: "Napi iránymutatás", cards: 1, about: "Egy lap: mire hangolódj ma." },
{ id: "trinity", name: "Sorsfonalak hármas", cards: 3, about: "Három lap: előzmény, jelen, kibontakozás." },
{
id: "astro_cross",
name: "Képlet-kereszt",
cards: 5,
about: "Öt lap: központi téma, belső és tudatos erők, kihívás, útmutatás.",
},
];
/** Longest question (the backend's `TAROT_QUESTION_MAX_CHARS`). */
export const TAROT_QUESTION_MAX = 300;
export interface TarotContent {
title: string;
summary: string;
cards: { body: string }[];
synthesis: string;
advice: string;
}
/** A reading (`/v1/tarot/readings`). */
export interface TarotReading {
id: string;
status: "pending" | "running" | "done" | "failed";
spread: SpreadId;
spread_name: string | null;
question: string | null;
cards: { card: string; reversed: boolean; position: string | null; about: string | null }[];
content: TarotContent | null;
error: string | null;
credits_charged: number;
attempts: number;
created_at: string;
completed_at: string | null;
}