Hungarian prompts in Hungarian, model choice per analysis kind, admin regenerate
CI / test (push) Successful in 57s
CI / build (push) Successful in 4m48s
CI / deploy (push) Skipped

- The built-in Hungarian system prompts and the user message frame are written in Hungarian
- Admin page Modellek: the model of each analysis kind, chosen from the OpenRouter list
  (structured-output models only) with prices and a cost estimate per analysis
- Admin: regenerate any analysis in place with the current prompt and model (no charge)
- Fix: a failed forecast analysis refunds a forecast unit, not a natal one

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012vLHzh5qUhFtmJhzkcTbXL
This commit is contained in:
feco
2026-11-18 13:15:57 +00:00
co-authored by Claude Opus 5.5
parent 23975a8369
commit 27de820091
24 changed files with 981 additions and 71 deletions
@@ -4,6 +4,7 @@ const PAGES = [
{ href: "/admin", label: "Felhasználók" },
{ href: "/admin/meghivok", label: "Meghívók" },
{ href: "/admin/promptok", label: "Promptok" },
{ href: "/admin/modellek", label: "Modellek" },
];
/** Switches between the admin pages. */
@@ -6,6 +6,7 @@ import { api } from "@/lib/api";
import type { Analysis } from "@/lib/types";
import { AnalysisLoading } from "./AnalysisLoading";
import { RegenerateButton } from "./RegenerateButton";
import { Rich } from "./Rich";
import { openTab } from "./Tabs";
@@ -21,11 +22,14 @@ export function ChartSummary({
chartId,
initial,
detailedDone = false,
isAdmin = false,
}: {
chartId: string;
initial: Analysis | null;
/** The detailed analysis is ready: the link says so instead of offering it. */
detailedDone?: boolean;
/** Admins can write the summary again. */
isAdmin?: boolean;
}) {
const [summary, setSummary] = useState<Analysis | null>(initial);
const [gaveUp, setGaveUp] = useState(false);
@@ -61,6 +65,15 @@ export function ChartSummary({
<span className="eyebrow">Röviden</span>
{content ? (
<>
{isAdmin && summary && (
<RegenerateButton
analysisId={summary.id}
onStarted={(a) => {
setGaveUp(false);
setSummary(a);
}}
/>
)}
<h2 id="summary-title" className="summary-title">
{content.title}
</h2>
@@ -9,6 +9,7 @@ import type { Analysis } from "@/lib/types";
import { AI_SHORT } from "./AiNote";
import { AnalysisLoading } from "./AnalysisLoading";
import { PackageChooser } from "./PackageCards";
import { RegenerateButton } from "./RegenerateButton";
import { AnalysisView } from "./AnalysisView";
const POLL_MS = 5000;
@@ -145,6 +146,7 @@ export function DetailedAnalysis({
return (
<section className="analysis-card" aria-label={t.eyebrow}>
<span className="eyebrow">{t.eyebrow}</span>
{isAdmin && <RegenerateButton analysisId={analysis.id} onStarted={setAnalysis} />}
{note && <p className="hint">{note}</p>}
<AnalysisView content={analysis.content} kind={target.kind} />
</section>
@@ -0,0 +1,54 @@
"use client";
import { useState } from "react";
import { api, errorText } from "@/lib/api";
import type { Analysis } from "@/lib/types";
/**
* Admin only: writes the analysis again in place with the current prompt and
* model (nobody is charged). Asks once before it starts.
*/
export function RegenerateButton({ analysisId, onStarted }: { analysisId: string; onStarted: (a: Analysis) => void }) {
const [asking, setAsking] = useState(false);
const [busy, setBusy] = useState(false);
const [error, setError] = useState<string | null>(null);
async function regenerate() {
setBusy(true);
setError(null);
try {
onStarted(await api<Analysis>(`/admin/analyses/${analysisId}/regenerate`, { method: "POST" }));
setAsking(false);
} catch (e) {
setError(errorText(e));
} finally {
setBusy(false);
}
}
return (
<div className="regenerate">
{asking ? (
<>
<span className="hint">A mostani szöveg helyett újat ír a jelenlegi prompttal és modellel.</span>
<button type="button" className="btn btn-sm" onClick={regenerate} disabled={busy}>
{busy ? "Indítás…" : "Igen, újragenerálás"}
</button>
<button type="button" className="btn btn-sm btn-ghost" onClick={() => setAsking(false)} disabled={busy}>
Mégse
</button>
</>
) : (
<button type="button" className="btn btn-sm btn-ghost" onClick={() => setAsking(true)} title="Admin: újragenerálás">
↻ Újragenerálás
</button>
)}
{error && (
<span className="msg msg-error" role="alert">
{error}
</span>
)}
</div>
);
}