fix: VPS fresh-DB bootstrap — sync OPENAI_API_KEY from env to DB at startup + show countdown before first cycle

- main.py startup: if DB has no openai_api_key but OPENAI_API_KEY env var is set, auto-save it so cycle trigger returns 200 instead of 400
- Config.tsx: move NextRunCountdown outside cs?.last_cycle block so it renders even when no cycle has run yet

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
OpenSquared
2026-06-17 14:55:42 +02:00
parent 9fe9a15939
commit d726cf430e
2 changed files with 20 additions and 8 deletions

View File

@@ -720,7 +720,7 @@ export default function Config() {
<RiskProfilesCard />
{cs?.last_cycle && (
<div className="card bg-dark-700/50 mb-4 text-xs space-y-2">
<div className="card bg-dark-700/50 mb-2 text-xs space-y-2">
<div className="flex items-center gap-4 flex-wrap">
<span className="text-slate-500">Dernier cycle :</span>
<span className="text-slate-300">{cs.last_cycle.started_at?.slice(0, 16)} UTC</span>
@@ -732,9 +732,11 @@ export default function Config() {
<span className="text-slate-500">Géo: {cs.last_cycle.geo_score}</span>
<span className="text-slate-500 capitalize">{cs.last_cycle.dominant_regime}</span>
</div>
{cs.enabled && cs.next_run_at && !cs.running && (
<NextRunCountdown nextRunAt={cs.next_run_at} />
)}
</div>
)}
{cs?.enabled && cs?.next_run_at && !cs?.running && (
<div className="card bg-dark-700/50 mb-4 text-xs">
<NextRunCountdown nextRunAt={cs.next_run_at} />
</div>
)}