Comparisons (synastry) of the own chart and persons
/osszevetesek compares any two of the user's charts (own and persons); the person card and the person's chart page have "Összevetés velem". The comparison page shows a double wheel (first person inside with houses, second outside, aspects between them), the aspects by character, and tabs: paid relationship analysis (synastry unit), the cross aspect grid, house overlays, composite and the full aspect list. Correcting a person within the hour now deletes the user's own comparisons with them instead of being refused; still refused after a paid analysis or when someone else's comparison uses the chart. The relationship analysis prompt is editable on /admin/promptok too, and can be tried on one of the admin's comparisons. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012vLHzh5qUhFtmJhzkcTbXL
This commit is contained in:
@@ -6,7 +6,8 @@ import { AnalysisLoading } from "@/components/AnalysisLoading";
|
||||
import { AnalysisView } from "@/components/AnalysisView";
|
||||
import { api, errorText } from "@/lib/api";
|
||||
import { formatDate } from "@/lib/astro";
|
||||
import type { ChartListItem, PromptKind, PromptPreview } from "@/lib/types";
|
||||
import { listName } from "@/lib/synastry";
|
||||
import type { ChartListItem, PromptKind, PromptPreview, SynastryListItem } from "@/lib/types";
|
||||
|
||||
const POLL_MS = 4000;
|
||||
const MAX_POLLS = 150; // 10 minutes
|
||||
@@ -34,7 +35,23 @@ export function PromptTrial({
|
||||
charts: ChartListItem[];
|
||||
onLoad: (system: string) => void;
|
||||
}) {
|
||||
const synastry = kind === "synastry";
|
||||
const [chartId, setChartId] = useState(charts.find((c) => c.is_primary)?.id ?? charts[0]?.id ?? "");
|
||||
const [synastries, setSynastries] = useState<SynastryListItem[]>([]);
|
||||
const [synastryId, setSynastryId] = useState("");
|
||||
|
||||
useEffect(() => {
|
||||
if (!synastry) return;
|
||||
api<{ synastries: SynastryListItem[] }>("/synastries")
|
||||
.then((d) => {
|
||||
const own = d.synastries.filter((s) => s.owned);
|
||||
setSynastries(own);
|
||||
setSynastryId((current) => current || own[0]?.id || "");
|
||||
})
|
||||
.catch(() => setSynastries([]));
|
||||
}, [synastry]);
|
||||
const targetId = synastry ? synastryId : chartId;
|
||||
const comparisonName = (s: SynastryListItem) => `${listName(s.chart1, charts)} és ${listName(s.chart2, charts)}`;
|
||||
const [trials, setTrials] = useState<Trial[]>([]);
|
||||
const [busy, setBusy] = useState(false);
|
||||
const [error, setError] = useState<string | null>(null);
|
||||
@@ -45,7 +62,7 @@ export function PromptTrial({
|
||||
setError(null);
|
||||
try {
|
||||
const preview = await api<PromptPreview>(`/admin/prompts/${kind}/${language}/preview`, {
|
||||
body: { system: draft, chart_id: chartId },
|
||||
body: synastry ? { system: draft, synastry_id: synastryId } : { system: draft, chart_id: chartId },
|
||||
});
|
||||
setTrials((all) => [{ preview, system: draft }, ...all]);
|
||||
} catch (e) {
|
||||
@@ -66,11 +83,32 @@ export function PromptTrial({
|
||||
<div className="prompt-trial-head">
|
||||
<h2 id={`${selectId}-title`}>Kipróbálás</h2>
|
||||
<p className="hint">
|
||||
A szerkesztőben lévő szöveggel (mentés nélkül is) megírja az elemzést egy saját képletedre. Az eredmény nem
|
||||
kerül a képlethez, csak itt látod. Valódi modellhívás, ezért költsége van.
|
||||
A szerkesztőben lévő szöveggel (mentés nélkül is) megírja az elemzést egy saját{" "}
|
||||
{synastry ? "összevetésedre" : "képletedre"}. Az eredmény nem kerül {synastry ? "az összevetéshez" : "a képlethez"},
|
||||
csak itt látod. Valódi modellhívás, ezért költsége van.
|
||||
</p>
|
||||
</div>
|
||||
{charts.length === 0 ? (
|
||||
{synastry && synastries.length === 0 ? (
|
||||
<p className="muted">
|
||||
Kipróbáláshoz előbb készíts egy összevetést az <a href="/osszevetesek">Összevetések</a> oldalon.
|
||||
</p>
|
||||
) : synastry ? (
|
||||
<div className="prompt-trial-form">
|
||||
<div className="field">
|
||||
<label htmlFor={selectId}>Összevetés</label>
|
||||
<select id={selectId} className="inp" value={synastryId} onChange={(e) => setSynastryId(e.target.value)}>
|
||||
{synastries.map((s) => (
|
||||
<option key={s.id} value={s.id}>
|
||||
{comparisonName(s)}
|
||||
</option>
|
||||
))}
|
||||
</select>
|
||||
</div>
|
||||
<button type="button" className="btn btn-primary" onClick={start} disabled={busy || !targetId || !draft.trim()}>
|
||||
{busy ? "Indítás…" : "Kipróbálás"}
|
||||
</button>
|
||||
</div>
|
||||
) : charts.length === 0 ? (
|
||||
<p className="muted">Kipróbáláshoz előbb legyen legalább egy képleted.</p>
|
||||
) : (
|
||||
<div className="prompt-trial-form">
|
||||
@@ -99,7 +137,14 @@ export function PromptTrial({
|
||||
<TrialResult
|
||||
key={t.preview.id}
|
||||
trial={t}
|
||||
chartLabel={charts.find((c) => c.id === t.preview.chart_id)?.label ?? "Képlet"}
|
||||
chartLabel={
|
||||
t.preview.synastry_id
|
||||
? (() => {
|
||||
const s = synastries.find((x) => x.id === t.preview.synastry_id);
|
||||
return s ? comparisonName(s) : "Összevetés";
|
||||
})()
|
||||
: (charts.find((c) => c.id === t.preview.chart_id)?.label ?? "Képlet")
|
||||
}
|
||||
changed={t.system.trim() !== draft.trim()}
|
||||
onUpdate={update}
|
||||
onLoad={() => onLoad(t.system)}
|
||||
@@ -186,7 +231,7 @@ function TrialResult({
|
||||
<p className="summary-text">{p.content.summary}</p>
|
||||
</div>
|
||||
) : (
|
||||
<AnalysisView content={p.content} />
|
||||
<AnalysisView content={p.content} kind={p.kind === "synastry" ? "synastry" : "natal"} />
|
||||
)
|
||||
) : null}
|
||||
{meta.length > 0 && !waiting && <p className="hint">{meta.join(" · ")}</p>}
|
||||
|
||||
Reference in New Issue
Block a user