Paid detailed analyses with per-kind units; example analysis page
- Credits become analysis units (migration 0006): a natal analysis uses one 'natal' unit, a synastry analysis one 'synastry' unit. No monthly free credits, no model tiers: ANALYSIS_MODEL (default Opus 5.5) writes every paid analysis. Admins grant units per kind; the worker refunds the right unit on failure. - Chart page: the detailed analysis card (offer with units left and a confirmation, progress while writing, the finished six sections). - Public /pelda page: a full Opus analysis of a made-up chart, with the free summary and a login call to action. - The worker sends the JSON schema with properties in 'required' order. serde_json sorted them, so the title came after ~9000 tokens of text and Opus sometimes left it empty (3 failed attempts in a live test); with the order fixed the same analysis succeeded at the first try. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012vLHzh5qUhFtmJhzkcTbXL
This commit is contained in:
@@ -36,7 +36,7 @@ export function errorText(e: unknown): string {
|
||||
case "forbidden":
|
||||
return "Ehhez nincs jogosultságod.";
|
||||
case "insufficient_credits":
|
||||
return "Nincs elég kredited.";
|
||||
return "Nincs több részletes elemzésed ebből a fajtából.";
|
||||
default:
|
||||
return e.message;
|
||||
}
|
||||
|
||||
@@ -16,15 +16,21 @@ export interface Me {
|
||||
user: User;
|
||||
providers: string[];
|
||||
primary_chart_id: string | null;
|
||||
credits: number;
|
||||
analyses_left: UnitBalance;
|
||||
}
|
||||
|
||||
/** Detailed analyses left, per kind. */
|
||||
export interface UnitBalance {
|
||||
natal: number;
|
||||
synastry: number;
|
||||
}
|
||||
|
||||
export interface PublicConfig {
|
||||
google_login: { enabled: boolean; client_id: string | null };
|
||||
locales: string[];
|
||||
llm_models: { id: string; credits: number; role: Role | null }[];
|
||||
default_model: string;
|
||||
monthly_free_credits: number;
|
||||
analysis_model: string;
|
||||
summary_model: string;
|
||||
password_login: boolean;
|
||||
password_min_length: number;
|
||||
}
|
||||
|
||||
@@ -88,7 +94,8 @@ export interface Analysis {
|
||||
status: "pending" | "running" | "done" | "failed";
|
||||
model: string;
|
||||
language: string;
|
||||
content: { title?: string; summary?: string } & Record<string, unknown> | null;
|
||||
content: AnalysisContent | null;
|
||||
error?: string | null;
|
||||
credits_charged: number;
|
||||
created_at: string;
|
||||
completed_at: string | null;
|
||||
@@ -103,7 +110,16 @@ export interface AdminUser {
|
||||
created_at: string;
|
||||
last_login_at: string | null;
|
||||
charts: number;
|
||||
credits: number;
|
||||
analyses_left: UnitBalance;
|
||||
}
|
||||
|
||||
export interface AnalysisContent {
|
||||
title?: string;
|
||||
summary?: string;
|
||||
sections?: Record<string, { title: string; body: string }>;
|
||||
strengths?: string[];
|
||||
challenges?: string[];
|
||||
advice?: string;
|
||||
}
|
||||
|
||||
export interface Place {
|
||||
|
||||
Reference in New Issue
Block a user