WIP Hub 1.6.0: AI proxy for Cross Events 2.0
Signed /installs/ai/status and /installs/ai/complete (protocol 3b): the Hub holds the Claude key, holds each call's worst case against the licence's monthly cap in a locked transaction, calls Claude Haiku 5.5 and meters real cost and charged amount (markup) in rand. Settings -> AI, licence markup override, AI use on the install page. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -19,6 +19,7 @@ function LicenceCard({ licence, onSaved, setMsg }: { licence: Licence; onSaved:
|
||||
expiresAt: dateInput(licence.expiresAt),
|
||||
graceDays: String(licence.graceDays),
|
||||
aiRand: String(licence.aiMonthlyCapCents / 100),
|
||||
aiMarkup: licence.aiMarkupPercent == null ? "" : String(licence.aiMarkupPercent),
|
||||
notes: licence.notes || "",
|
||||
});
|
||||
const [busy, setBusy] = useState(false);
|
||||
@@ -35,6 +36,7 @@ function LicenceCard({ licence, onSaved, setMsg }: { licence: Licence; onSaved:
|
||||
expiresAt: form.expiresAt ? `${form.expiresAt}T23:59:59+02:00` : null,
|
||||
graceDays: form.graceDays,
|
||||
aiMonthlyCapCents: Math.round((parseFloat(form.aiRand) || 0) * 100),
|
||||
aiMarkupPercent: form.aiMarkup.trim() === "" ? null : form.aiMarkup,
|
||||
notes: form.notes,
|
||||
},
|
||||
});
|
||||
@@ -65,7 +67,7 @@ function LicenceCard({ licence, onSaved, setMsg }: { licence: Licence; onSaved:
|
||||
? <>Used by <Link href={`/installs/${licence.install.id}`} className="text-indigo-600 hover:underline">{licence.install.url}</Link> · last heartbeat {ago(licence.install.lastHeartbeatAt)}</>
|
||||
: "Not used yet — enter this key in the church's Cross Events setup (or Site settings → Licence)."}
|
||||
</div>
|
||||
<div className="grid gap-3 sm:grid-cols-4">
|
||||
<div className="grid gap-3 sm:grid-cols-5">
|
||||
<div>
|
||||
<label className="label">Status</label>
|
||||
<select className="input" value={form.status} onChange={e => setForm({ ...form, status: e.target.value as LicenceStatus })}>
|
||||
@@ -86,7 +88,12 @@ function LicenceCard({ licence, onSaved, setMsg }: { licence: Licence; onSaved:
|
||||
<div>
|
||||
<label className="label">AI cap (R / month)</label>
|
||||
<input type="number" min={0} step="1" className="input" value={form.aiRand} onChange={e => setForm({ ...form, aiRand: e.target.value })} />
|
||||
<p className="mt-1 text-xs text-slate-500">0 = off. Used from 2.0.</p>
|
||||
<p className="mt-1 text-xs text-slate-500">0 = off (no AI buttons). Counted in charged rand.</p>
|
||||
</div>
|
||||
<div>
|
||||
<label className="label" htmlFor={`markup-${licence.id}`}>AI markup (%)</label>
|
||||
<input id={`markup-${licence.id}`} type="number" min={0} max={500} step="1" className="input" placeholder="Default" value={form.aiMarkup} onChange={e => setForm({ ...form, aiMarkup: e.target.value })} />
|
||||
<p className="mt-1 text-xs text-slate-500">Blank uses the default (Settings → AI).</p>
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
|
||||
Reference in New Issue
Block a user