Compare commits
5
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e476117c77 | ||
|
|
da533e8fa9 | ||
|
|
bc0227042b | ||
|
|
d758f5bf12 | ||
|
|
d46cd7a445 |
@@ -20,3 +20,7 @@ SIGNUP_MODE=invite
|
|||||||
|
|
||||||
# Image version; every deployment rewrites it
|
# Image version; every deployment rewrites it
|
||||||
TAG=latest
|
TAG=latest
|
||||||
|
|
||||||
|
# worker-ai: analyses and answers written at the same time.
|
||||||
|
# QUICK_CONCURRENCY=2 # summaries and answers
|
||||||
|
# ANALYSIS_CONCURRENCY=4 # detailed analyses and forecasts
|
||||||
|
|||||||
+2
-1
@@ -82,7 +82,8 @@ A Google OAuth kliensnél a `https://sorsfonalak.hu` címet fel kell venni az en
|
|||||||
|
|
||||||
## Üzemeltetés
|
## Üzemeltetés
|
||||||
|
|
||||||
- Naplók: `docker compose logs -f backend worker`
|
- Naplók: `docker compose logs -f backend worker worker-ai`
|
||||||
|
- A worker két konténerben fut, ugyanabból az image-ből: a `worker` küldi az e-maileket és takarít (`WORKER_TASKS=email,cleanup`, ide kerülnek a további háttérfeladatok is), a `worker-ai` írja az elemzéseket és a válaszokat (`WORKER_TASKS=analyses`, gyors és lassú sáv). A sávok mérete a szerver `.env` fájljában állítható (`QUICK_CONCURRENCY`, `ANALYSIS_CONCURRENCY`).
|
||||||
- Visszaállás korábbi verzióra: `.env`-ben `TAG=<régebbi hash>`, utána `docker compose up -d`
|
- Visszaállás korábbi verzióra: `.env`-ben `TAG=<régebbi hash>`, utána `docker compose up -d`
|
||||||
- Mentés: naponta egy `pg_dump` a `/opt/sorsfonalak/backups` mappába, 14 napig megmarad. A mentéseket érdemes a szerverről is elvinni (DigitalOcean backup, vagy `rsync` otthonra).
|
- Mentés: naponta egy `pg_dump` a `/opt/sorsfonalak/backups` mappába, 14 napig megmarad. A mentéseket érdemes a szerverről is elvinni (DigitalOcean backup, vagy `rsync` otthonra).
|
||||||
- Visszatöltés: `gunzip -c backups/sorsfonalak-<dátum>.sql.gz | docker compose exec -T postgres psql -U sorsfonalak sorsfonalak`
|
- Visszatöltés: `gunzip -c backups/sorsfonalak-<dátum>.sql.gz | docker compose exec -T postgres psql -U sorsfonalak sorsfonalak`
|
||||||
|
|||||||
@@ -99,10 +99,12 @@ services:
|
|||||||
logging: *logging
|
logging: *logging
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
|
|
||||||
|
# E-mail delivery, cleanup and the other background jobs.
|
||||||
worker:
|
worker:
|
||||||
image: ${REGISTRY_PREFIX:-registry.sagifer.com/sagifer/sorsfonalak}-worker:${TAG:-latest}
|
image: ${REGISTRY_PREFIX:-registry.sagifer.com/sagifer/sorsfonalak}-worker:${TAG:-latest}
|
||||||
environment:
|
environment:
|
||||||
DATABASE_URL: postgres://sorsfonalak:${POSTGRES_PASSWORD}@postgres:5432/sorsfonalak
|
DATABASE_URL: postgres://sorsfonalak:${POSTGRES_PASSWORD}@postgres:5432/sorsfonalak
|
||||||
|
WORKER_TASKS: email,cleanup
|
||||||
# SMTP_URL or the SES credentials come from .env.secrets (docs/levelkuldes.md);
|
# SMTP_URL or the SES credentials come from .env.secrets (docs/levelkuldes.md);
|
||||||
# listing them here with an empty default would override that file.
|
# listing them here with an empty default would override that file.
|
||||||
SES_REGION: ${SES_REGION:-eu-central-1}
|
SES_REGION: ${SES_REGION:-eu-central-1}
|
||||||
@@ -118,6 +120,26 @@ services:
|
|||||||
logging: *logging
|
logging: *logging
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
|
|
||||||
|
# The same image writing the analyses and answers (quick and slow lane);
|
||||||
|
# OPENROUTER_API_KEY comes from .env.secrets.
|
||||||
|
worker-ai:
|
||||||
|
image: ${REGISTRY_PREFIX:-registry.sagifer.com/sagifer/sorsfonalak}-worker:${TAG:-latest}
|
||||||
|
environment:
|
||||||
|
DATABASE_URL: postgres://sorsfonalak:${POSTGRES_PASSWORD}@postgres:5432/sorsfonalak
|
||||||
|
WORKER_TASKS: analyses
|
||||||
|
QUICK_CONCURRENCY: ${QUICK_CONCURRENCY:-2}
|
||||||
|
ANALYSIS_CONCURRENCY: ${ANALYSIS_CONCURRENCY:-4}
|
||||||
|
PUBLIC_BASE_URL: https://${DOMAIN}
|
||||||
|
env_file:
|
||||||
|
- path: .env.secrets
|
||||||
|
required: false
|
||||||
|
depends_on:
|
||||||
|
postgres:
|
||||||
|
condition: service_healthy
|
||||||
|
read_only: true
|
||||||
|
logging: *logging
|
||||||
|
restart: unless-stopped
|
||||||
|
|
||||||
frontend:
|
frontend:
|
||||||
image: ${REGISTRY_PREFIX:-registry.sagifer.com/sagifer/sorsfonalak}-frontend:${TAG:-latest}
|
image: ${REGISTRY_PREFIX:-registry.sagifer.com/sagifer/sorsfonalak}-frontend:${TAG:-latest}
|
||||||
environment:
|
environment:
|
||||||
|
|||||||
@@ -37,67 +37,69 @@ export default async function PrivacyPage() {
|
|||||||
|
|
||||||
<section>
|
<section>
|
||||||
<h2>2. Milyen adatokat kezelünk, és miért?</h2>
|
<h2>2. Milyen adatokat kezelünk, és miért?</h2>
|
||||||
<table className="legal-table">
|
<div className="table-wrap">
|
||||||
<thead>
|
<table className="legal-table">
|
||||||
<tr>
|
<thead>
|
||||||
<th scope="col">Adat</th>
|
<tr>
|
||||||
<th scope="col">Cél</th>
|
<th scope="col">Adat</th>
|
||||||
<th scope="col">Jogalap</th>
|
<th scope="col">Cél</th>
|
||||||
</tr>
|
<th scope="col">Jogalap</th>
|
||||||
</thead>
|
</tr>
|
||||||
<tbody>
|
</thead>
|
||||||
<tr>
|
<tbody>
|
||||||
<td>Google-fiókod neve, e-mail-címe és azonosítója (belépéskor a Google adja át)</td>
|
<tr>
|
||||||
<td>Fiókod létrehozása, belépés, kapcsolattartás</td>
|
<td>Google-fiókod neve, e-mail-címe és azonosítója (belépéskor a Google adja át)</td>
|
||||||
<td>Szerződés teljesítése (GDPR 6. cikk (1) b)</td>
|
<td>Fiókod létrehozása, belépés, kapcsolattartás</td>
|
||||||
</tr>
|
<td>Szerződés teljesítése (GDPR 6. cikk (1) b)</td>
|
||||||
<tr>
|
</tr>
|
||||||
<td>Megjelenített név, az elemzések nyelve</td>
|
<tr>
|
||||||
<td>A szolgáltatás személyre szabása</td>
|
<td>Megjelenített név, az elemzések nyelve</td>
|
||||||
<td>Szerződés teljesítése</td>
|
<td>A szolgáltatás személyre szabása</td>
|
||||||
</tr>
|
<td>Szerződés teljesítése</td>
|
||||||
<tr>
|
</tr>
|
||||||
<td>Születési adataid: dátum, időpont, hely</td>
|
<tr>
|
||||||
<td>A születési képleted kiszámítása és az elemzések elkészítése</td>
|
<td>Születési adataid: dátum, időpont, hely</td>
|
||||||
<td>Szerződés teljesítése</td>
|
<td>A születési képleted kiszámítása és az elemzések elkészítése</td>
|
||||||
</tr>
|
<td>Szerződés teljesítése</td>
|
||||||
<tr>
|
</tr>
|
||||||
<td>Az általad felvett személyek neve és születési adatai</td>
|
<tr>
|
||||||
<td>Az ő képletük és elemzésük elkészítése a kérésedre</td>
|
<td>Az általad felvett személyek neve és születési adatai</td>
|
||||||
<td>Szerződés teljesítése; a felvételhez az érintett beleegyezése szükséges (lásd 4. pont)</td>
|
<td>Az ő képletük és elemzésük elkészítése a kérésedre</td>
|
||||||
</tr>
|
<td>Szerződés teljesítése; a felvételhez az érintett beleegyezése szükséges (lásd 4. pont)</td>
|
||||||
<tr>
|
</tr>
|
||||||
<td>A képletek és az elkészült elemzések</td>
|
<tr>
|
||||||
<td>Hogy bármikor újra megnézhesd őket</td>
|
<td>A képletek és az elkészült elemzések</td>
|
||||||
<td>Szerződés teljesítése</td>
|
<td>Hogy bármikor újra megnézhesd őket</td>
|
||||||
</tr>
|
<td>Szerződés teljesítése</td>
|
||||||
<tr>
|
</tr>
|
||||||
<td>Vásárlásaid és felhasznált kereteid (elemzések, személyek)</td>
|
<tr>
|
||||||
<td>A megvásárolt szolgáltatás nyújtása, elszámolás</td>
|
<td>Vásárlásaid és felhasznált kereteid (elemzések, személyek)</td>
|
||||||
<td>Szerződés teljesítése; számviteli kötelezettség (6. cikk (1) c)</td>
|
<td>A megvásárolt szolgáltatás nyújtása, elszámolás</td>
|
||||||
</tr>
|
<td>Szerződés teljesítése; számviteli kötelezettség (6. cikk (1) c)</td>
|
||||||
<tr>
|
</tr>
|
||||||
<td>Meghívott e-mail-címe, a meghívó neve és személyes üzenete</td>
|
<tr>
|
||||||
<td>A meghívó elküldése; amíg az oldal zártkörű, csak meghívottak regisztrálhatnak</td>
|
<td>Meghívott e-mail-címe, a meghívó neve és személyes üzenete</td>
|
||||||
<td>Jogos érdek (6. cikk (1) f)</td>
|
<td>A meghívó elküldése; amíg az oldal zártkörű, csak meghívottak regisztrálhatnak</td>
|
||||||
</tr>
|
<td>Jogos érdek (6. cikk (1) f)</td>
|
||||||
<tr>
|
</tr>
|
||||||
<td>A várólistán megadott e-mail-cím</td>
|
<tr>
|
||||||
<td>Értesítés, ha megnyílik az oldal, vagy meghívót küldünk</td>
|
<td>A várólistán megadott e-mail-cím</td>
|
||||||
<td>Hozzájárulás (6. cikk (1) a)</td>
|
<td>Értesítés, ha megnyílik az oldal, vagy meghívót küldünk</td>
|
||||||
</tr>
|
<td>Hozzájárulás (6. cikk (1) a)</td>
|
||||||
<tr>
|
</tr>
|
||||||
<td>Azok a címek, amelyek leiratkoztak a meghívókról (csak a cím egyirányú lenyomata, hash-e)</td>
|
<tr>
|
||||||
<td>Hogy ezekre a címekre ne küldjünk több meghívót</td>
|
<td>Azok a címek, amelyek leiratkoztak a meghívókról (csak a cím egyirányú lenyomata, hash-e)</td>
|
||||||
<td>Jogos érdek (6. cikk (1) f)</td>
|
<td>Hogy ezekre a címekre ne küldjünk több meghívót</td>
|
||||||
</tr>
|
<td>Jogos érdek (6. cikk (1) f)</td>
|
||||||
<tr>
|
</tr>
|
||||||
<td>IP-cím, böngésző adatai, a kérések ideje (szervernaplók)</td>
|
<tr>
|
||||||
<td>Biztonság, hibakeresés, visszaélések kiszűrése</td>
|
<td>IP-cím, böngésző adatai, a kérések ideje (szervernaplók)</td>
|
||||||
<td>Jogos érdek (6. cikk (1) f)</td>
|
<td>Biztonság, hibakeresés, visszaélések kiszűrése</td>
|
||||||
</tr>
|
<td>Jogos érdek (6. cikk (1) f)</td>
|
||||||
</tbody>
|
</tr>
|
||||||
</table>
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
<p>
|
<p>
|
||||||
Bankkártyaadatot nem kezelünk és nem tárolunk; a fizetést, amikor elindul, külső fizetési szolgáltató
|
Bankkártyaadatot nem kezelünk és nem tárolunk; a fizetést, amikor elindul, külső fizetési szolgáltató
|
||||||
végzi, akinek a neve itt lesz feltüntetve.
|
végzi, akinek a neve itt lesz feltüntetve.
|
||||||
|
|||||||
@@ -28,6 +28,8 @@
|
|||||||
html, body { margin: 0; }
|
html, body { margin: 0; }
|
||||||
body {
|
body {
|
||||||
min-height: 100vh;
|
min-height: 100vh;
|
||||||
|
overflow-x: clip; /* nothing may push the page sideways on a phone */
|
||||||
|
overflow-wrap: break-word;
|
||||||
background: var(--bg);
|
background: var(--bg);
|
||||||
color: var(--ink);
|
color: var(--ink);
|
||||||
font: 400 15px/1.55 var(--font-body);
|
font: 400 15px/1.55 var(--font-body);
|
||||||
@@ -71,8 +73,8 @@ p { margin: 0; }
|
|||||||
.page-head { display: flex; flex-direction: column; gap: 6px; }
|
.page-head { display: flex; flex-direction: column; gap: 6px; }
|
||||||
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 24px; display: flex; flex-direction: column; gap: 18px; }
|
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 24px; display: flex; flex-direction: column; gap: 18px; }
|
||||||
.card-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; }
|
.card-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; }
|
||||||
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; }
|
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(240px, 100%), 1fr)); gap: 16px; }
|
||||||
.facts { display: grid; grid-template-columns: max-content 1fr; gap: 8px 20px; margin: 0; }
|
.facts { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 8px 20px; margin: 0; }
|
||||||
.facts dt { color: var(--muted); }
|
.facts dt { color: var(--muted); }
|
||||||
.facts dd { margin: 0; }
|
.facts dd { margin: 0; }
|
||||||
|
|
||||||
@@ -81,11 +83,11 @@ p { margin: 0; }
|
|||||||
.field label, .label { font-size: 14px; font-weight: 500; }
|
.field label, .label { font-size: 14px; font-weight: 500; }
|
||||||
.hint { font-size: 13px; color: var(--muted); }
|
.hint { font-size: 13px; color: var(--muted); }
|
||||||
.inp {
|
.inp {
|
||||||
width: 100%; min-height: 48px; padding: 0 14px; border-radius: var(--radius);
|
width: 100%; min-width: 0; max-width: 100%; min-height: 48px; padding: 0 14px; border-radius: var(--radius);
|
||||||
border: 1px solid var(--line-2); background: var(--panel-2); color: var(--ink);
|
border: 1px solid var(--line-2); background: var(--panel-2); color: var(--ink);
|
||||||
font: 400 15px var(--font-body);
|
font: 400 15px var(--font-body);
|
||||||
}
|
}
|
||||||
select.inp { padding-right: 32px; }
|
select.inp { padding-right: 32px; text-overflow: ellipsis; }
|
||||||
.inp::placeholder { color: #8a93ab; }
|
.inp::placeholder { color: #8a93ab; }
|
||||||
.inp:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px rgba(217, 180, 106, 0.25); }
|
.inp:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px rgba(217, 180, 106, 0.25); }
|
||||||
.inp:disabled { opacity: 0.55; }
|
.inp:disabled { opacity: 0.55; }
|
||||||
@@ -190,7 +192,7 @@ td.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
|
|||||||
.analysis-section h3 { font-size: 24px; color: var(--gold); }
|
.analysis-section h3 { font-size: 24px; color: var(--gold); }
|
||||||
.analysis-section p, .analysis-lists li { font-size: 16px; line-height: 1.75; color: var(--ink-2); }
|
.analysis-section p, .analysis-lists li { font-size: 16px; line-height: 1.75; color: var(--ink-2); }
|
||||||
.analysis strong { color: var(--ink); font-weight: 600; }
|
.analysis strong { color: var(--ink); font-weight: 600; }
|
||||||
.analysis-lists { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 24px; }
|
.analysis-lists { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(260px, 100%), 1fr)); gap: 24px; }
|
||||||
.analysis-lists h3 { font-size: 22px; margin-bottom: 8px; }
|
.analysis-lists h3 { font-size: 22px; margin-bottom: 8px; }
|
||||||
.analysis-lists ul { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 8px; }
|
.analysis-lists ul { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 8px; }
|
||||||
.analysis-advice { border-top: 1px solid var(--line); padding-top: 24px; }
|
.analysis-advice { border-top: 1px solid var(--line); padding-top: 24px; }
|
||||||
@@ -308,7 +310,7 @@ td.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
|
|||||||
.w-point:hover .w-point-glyph { fill: var(--gold); }
|
.w-point:hover .w-point-glyph { fill: var(--gold); }
|
||||||
|
|
||||||
@media (max-width: 900px) {
|
@media (max-width: 900px) {
|
||||||
.chart-layout { grid-template-columns: 1fr; }
|
.chart-layout { grid-template-columns: minmax(0, 1fr); }
|
||||||
}
|
}
|
||||||
|
|
||||||
@media (max-width: 640px) {
|
@media (max-width: 640px) {
|
||||||
@@ -342,7 +344,7 @@ td.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
|
|||||||
@media (max-width: 640px) { .tab { padding: 12px 10px; font-size: 14px; } .tabs { scroll-margin-top: 120px; } }
|
@media (max-width: 640px) { .tab { padding: 12px 10px; font-size: 14px; } .tabs { scroll-margin-top: 120px; } }
|
||||||
|
|
||||||
/* Charts list, persons */
|
/* Charts list, persons */
|
||||||
.chart-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; }
|
.chart-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(240px, 100%), 1fr)); gap: 16px; }
|
||||||
.chart-card {
|
.chart-card {
|
||||||
background: var(--panel); border: 1px solid var(--line); border-radius: 14px; display: flex; flex-direction: column;
|
background: var(--panel); border: 1px solid var(--line); border-radius: 14px; display: flex; flex-direction: column;
|
||||||
transition: border-color 0.15s;
|
transition: border-color 0.15s;
|
||||||
@@ -485,14 +487,14 @@ td.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
|
|||||||
.nature-challenging { background: var(--tense); }
|
.nature-challenging { background: var(--tense); }
|
||||||
.nature-neutral { background: var(--gold); }
|
.nature-neutral { background: var(--gold); }
|
||||||
.nature-list { margin: 0; display: flex; flex-direction: column; gap: 8px; }
|
.nature-list { margin: 0; display: flex; flex-direction: column; gap: 8px; }
|
||||||
.nature-list > div { display: grid; grid-template-columns: 128px 1fr; gap: 8px; align-items: baseline; }
|
.nature-list > div { display: grid; grid-template-columns: 128px minmax(0, 1fr); gap: 8px; align-items: baseline; }
|
||||||
.nature-list dt { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; color: var(--ink-2); }
|
.nature-list dt { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; color: var(--ink-2); }
|
||||||
.nature-list dd { margin: 0; }
|
.nature-list dd { margin: 0; }
|
||||||
.nature-dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
|
.nature-dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
|
||||||
|
|
||||||
.pair-card { gap: 4px; }
|
.pair-card { gap: 4px; }
|
||||||
.pair-row {
|
.pair-row {
|
||||||
display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: center; padding: 10px 0;
|
display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 10px 0;
|
||||||
color: inherit; text-decoration: none; border-bottom: 1px solid var(--line);
|
color: inherit; text-decoration: none; border-bottom: 1px solid var(--line);
|
||||||
}
|
}
|
||||||
.pair-row:last-child { border-bottom: 0; padding-bottom: 0; }
|
.pair-row:last-child { border-bottom: 0; padding-bottom: 0; }
|
||||||
@@ -501,7 +503,7 @@ a.pair-row:hover strong { color: var(--gold); }
|
|||||||
.pair-text strong { font-family: var(--font-display); font-size: 21px; font-weight: 600; }
|
.pair-text strong { font-family: var(--font-display); font-size: 21px; font-weight: 600; }
|
||||||
|
|
||||||
.compare-new { gap: 16px; }
|
.compare-new { gap: 16px; }
|
||||||
.compare-form { display: grid; grid-template-columns: 1fr auto 1fr auto; gap: 12px; align-items: end; }
|
.compare-form { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr) auto; gap: 12px; align-items: end; }
|
||||||
.compare-swap { font-size: 20px; padding: 0 10px; }
|
.compare-swap { font-size: 20px; padding: 0 10px; }
|
||||||
.compare-tile { gap: 6px; padding: 16px 20px; }
|
.compare-tile { gap: 6px; padding: 16px 20px; }
|
||||||
.compare-tile strong { font-family: var(--font-display); font-size: 21px; font-weight: 600; }
|
.compare-tile strong { font-family: var(--font-display); font-size: 21px; font-weight: 600; }
|
||||||
@@ -509,12 +511,12 @@ a.pair-row:hover strong { color: var(--gold); }
|
|||||||
.compare-tile .form-actions { margin-top: 6px; }
|
.compare-tile .form-actions { margin-top: 6px; }
|
||||||
.back-link { font-size: 14px; text-decoration: none; align-self: flex-start; }
|
.back-link { font-size: 14px; text-decoration: none; align-self: flex-start; }
|
||||||
@media (max-width: 640px) {
|
@media (max-width: 640px) {
|
||||||
.compare-form { grid-template-columns: 1fr auto; }
|
.compare-form { grid-template-columns: minmax(0, 1fr) auto; }
|
||||||
.compare-form .field:first-child { grid-column: 1; }
|
.compare-form .field:first-child { grid-column: 1; }
|
||||||
.compare-swap { grid-column: 2; grid-row: 1 / span 2; align-self: center; }
|
.compare-swap { grid-column: 2; grid-row: 1 / span 2; align-self: center; }
|
||||||
.compare-form .field:nth-child(3) { grid-column: 1; }
|
.compare-form .field:nth-child(3) { grid-column: 1; }
|
||||||
.compare-form > .btn-primary { grid-column: 1 / -1; width: 100%; }
|
.compare-form > .btn-primary { grid-column: 1 / -1; width: 100%; }
|
||||||
.nature-list > div { grid-template-columns: 1fr; gap: 2px; }
|
.nature-list > div { grid-template-columns: minmax(0, 1fr); gap: 2px; }
|
||||||
.nav { overflow-x: auto; scrollbar-width: none; }
|
.nav { overflow-x: auto; scrollbar-width: none; }
|
||||||
.nav a { white-space: nowrap; padding: 10px 9px; }
|
.nav a { white-space: nowrap; padding: 10px 9px; }
|
||||||
.cross-grid td.cross-corner { min-width: 56px; font-size: 9px; }
|
.cross-grid td.cross-corner { min-width: 56px; font-size: 9px; }
|
||||||
@@ -522,7 +524,7 @@ a.pair-row:hover strong { color: var(--gold); }
|
|||||||
|
|
||||||
/* Packages */
|
/* Packages */
|
||||||
.pkg-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; align-items: stretch; }
|
.pkg-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; align-items: stretch; }
|
||||||
.pkg-grid-compact { grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 12px; }
|
.pkg-grid-compact { grid-template-columns: repeat(auto-fit, minmax(min(210px, 100%), 1fr)); gap: 12px; }
|
||||||
.pkg {
|
.pkg {
|
||||||
position: relative; display: flex; flex-direction: column; gap: 10px; padding: 22px 20px 20px;
|
position: relative; display: flex; flex-direction: column; gap: 10px; padding: 22px 20px 20px;
|
||||||
background: var(--panel); border: 1px solid var(--line-2); border-radius: var(--radius);
|
background: var(--panel); border: 1px solid var(--line-2); border-radius: var(--radius);
|
||||||
@@ -589,7 +591,7 @@ a.pair-row:hover strong { color: var(--gold); }
|
|||||||
.timeline-month h3 { font-size: 20px; margin: 0 0 8px; text-transform: capitalize; }
|
.timeline-month h3 { font-size: 20px; margin: 0 0 8px; text-transform: capitalize; }
|
||||||
.timeline-month ol, .transit-list { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 6px; }
|
.timeline-month ol, .transit-list { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 6px; }
|
||||||
.timeline-item {
|
.timeline-item {
|
||||||
display: grid; grid-template-columns: 64px 56px 1fr; gap: 10px; align-items: baseline;
|
display: grid; grid-template-columns: 64px 56px minmax(0, 1fr); gap: 10px; align-items: baseline;
|
||||||
padding: 8px 12px; border-left: 3px solid var(--line); border-radius: 4px; background: rgba(255, 255, 255, 0.02);
|
padding: 8px 12px; border-left: 3px solid var(--line); border-radius: 4px; background: rgba(255, 255, 255, 0.02);
|
||||||
}
|
}
|
||||||
.timeline-date { color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
|
.timeline-date { color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
|
||||||
@@ -599,15 +601,15 @@ a.pair-row:hover strong { color: var(--gold); }
|
|||||||
.timeline-item.tone-harmonic, .transit-list .tone-harmonic { border-left-color: var(--harmonic); }
|
.timeline-item.tone-harmonic, .transit-list .tone-harmonic { border-left-color: var(--harmonic); }
|
||||||
.timeline-item.tone-neutral, .transit-list .tone-neutral { border-left-color: var(--gold); }
|
.timeline-item.tone-neutral, .transit-list .tone-neutral { border-left-color: var(--gold); }
|
||||||
.transit-list li {
|
.transit-list li {
|
||||||
display: grid; grid-template-columns: 72px 1fr; gap: 10px; align-items: baseline;
|
display: grid; grid-template-columns: 72px minmax(0, 1fr); gap: 10px; align-items: baseline;
|
||||||
padding: 8px 12px; border-left: 3px solid var(--line); border-radius: 4px;
|
padding: 8px 12px; border-left: 3px solid var(--line); border-radius: 4px;
|
||||||
}
|
}
|
||||||
.transit-list li > span:last-child { display: flex; flex-direction: column; gap: 2px; }
|
.transit-list li > span:last-child { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
|
||||||
.transit-list .sym { font-size: 17px; color: var(--gold); white-space: nowrap; }
|
.transit-list .sym { font-size: 17px; color: var(--gold); white-space: nowrap; }
|
||||||
.transit-list .pill { align-self: flex-start; font-size: 12px; padding: 1px 8px; border: 1px solid var(--gold); border-radius: 999px; color: var(--gold); }
|
.transit-list .pill { align-self: flex-start; font-size: 12px; padding: 1px 8px; border: 1px solid var(--gold); border-radius: 999px; color: var(--gold); }
|
||||||
.plain-list { margin: 8px 0 12px; padding-left: 18px; display: flex; flex-direction: column; gap: 4px; }
|
.plain-list { margin: 8px 0 12px; padding-left: 18px; display: flex; flex-direction: column; gap: 4px; }
|
||||||
@media (max-width: 560px) {
|
@media (max-width: 560px) {
|
||||||
.timeline-item { grid-template-columns: 52px 1fr; }
|
.timeline-item { grid-template-columns: 52px minmax(0, 1fr); }
|
||||||
.timeline-glyph { display: none; }
|
.timeline-glyph { display: none; }
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -638,7 +640,7 @@ a.pair-row:hover strong { color: var(--gold); }
|
|||||||
.questions { display: flex; flex-direction: column; gap: 14px; margin-top: 28px; padding-top: 22px; border-top: 1px solid var(--line); }
|
.questions { display: flex; flex-direction: column; gap: 14px; margin-top: 28px; padding-top: 22px; border-top: 1px solid var(--line); }
|
||||||
.questions h3 { margin: 0; }
|
.questions h3 { margin: 0; }
|
||||||
.qa { display: flex; flex-direction: column; gap: 8px; padding: 14px 16px; border: 1px solid var(--line); border-radius: 12px; }
|
.qa { display: flex; flex-direction: column; gap: 8px; padding: 14px 16px; border: 1px solid var(--line); border-radius: 12px; }
|
||||||
.qa-question { margin: 0; display: flex; flex-direction: column; gap: 2px; font-weight: 600; white-space: pre-wrap; }
|
.qa-question { margin: 0; display: flex; flex-direction: column; gap: 2px; font-weight: 600; white-space: pre-wrap; overflow-wrap: anywhere; }
|
||||||
.qa-answer { display: flex; flex-direction: column; gap: 6px; }
|
.qa-answer { display: flex; flex-direction: column; gap: 6px; }
|
||||||
.qa-answer p { margin: 0 0 8px; }
|
.qa-answer p { margin: 0 0 8px; }
|
||||||
.qa-form { display: flex; flex-direction: column; gap: 8px; }
|
.qa-form { display: flex; flex-direction: column; gap: 8px; }
|
||||||
@@ -657,3 +659,39 @@ a.pair-row:hover strong { color: var(--gold); }
|
|||||||
.error-log .error-text { overflow-wrap: anywhere; max-width: 460px; }
|
.error-log .error-text { overflow-wrap: anywhere; max-width: 460px; }
|
||||||
.error-log .outcome { white-space: nowrap; }
|
.error-log .outcome { white-space: nowrap; }
|
||||||
.error-log .outcome.tone-tense { color: var(--tense); font-weight: 600; }
|
.error-log .outcome.tone-tense { color: var(--tense); font-weight: 600; }
|
||||||
|
|
||||||
|
/* Generated text (summaries, analyses, answers): justified, with hyphenation so
|
||||||
|
narrow screens get no wide gaps. The last line of a paragraph stays ragged. */
|
||||||
|
.analysis-lead, .analysis-section p, .analysis-lists li, .summary-text, .qa-answer p {
|
||||||
|
text-align: justify;
|
||||||
|
hyphens: auto;
|
||||||
|
-webkit-hyphens: auto;
|
||||||
|
hyphenate-limit-chars: 7 3 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Phones: tighter spacing, smaller headings, no sideways scrolling */
|
||||||
|
@media (max-width: 640px) {
|
||||||
|
.page { padding: 20px 14px 48px; gap: 18px; }
|
||||||
|
.card { padding: 16px; gap: 14px; }
|
||||||
|
h2 { font-size: 24px; }
|
||||||
|
.analysis { gap: 22px; }
|
||||||
|
.analysis-head h2 { font-size: 28px; }
|
||||||
|
.analysis-section h3 { font-size: 21px; }
|
||||||
|
.analysis-lists h3 { font-size: 20px; }
|
||||||
|
.analysis-lead { font-size: 16px; line-height: 1.65; }
|
||||||
|
.analysis-section p, .analysis-lists li, .summary-text { font-size: 15.5px; line-height: 1.7; }
|
||||||
|
.analysis-lists ul { padding-left: 18px; }
|
||||||
|
.summary-title { font-size: 23px; }
|
||||||
|
.questions { margin-top: 22px; padding-top: 18px; }
|
||||||
|
.qa { padding: 12px; }
|
||||||
|
.pay-box { padding: 16px; }
|
||||||
|
.loading-wheel { width: 96px; height: 96px; }
|
||||||
|
.tagline { font-size: 32px; }
|
||||||
|
}
|
||||||
|
@media (max-width: 480px) {
|
||||||
|
/* label above value: the label column would squeeze the values */
|
||||||
|
.facts { grid-template-columns: minmax(0, 1fr); gap: 2px; }
|
||||||
|
.facts dd + dt { margin-top: 8px; }
|
||||||
|
.site-header { gap: 8px 12px; }
|
||||||
|
.logo { font-size: 25px; }
|
||||||
|
}
|
||||||
|
|||||||
@@ -11,14 +11,17 @@ const ORDER = { natal: NATAL_ORDER, synastry: SYNASTRY_ORDER, forecast: FORECAST
|
|||||||
export function AnalysisView({
|
export function AnalysisView({
|
||||||
content,
|
content,
|
||||||
kind = "natal",
|
kind = "natal",
|
||||||
|
language,
|
||||||
}: {
|
}: {
|
||||||
content: AnalysisContent;
|
content: AnalysisContent;
|
||||||
kind?: "natal" | "synastry" | "forecast";
|
kind?: "natal" | "synastry" | "forecast";
|
||||||
|
/** The language of the text, for hyphenation. */
|
||||||
|
language?: string;
|
||||||
}) {
|
}) {
|
||||||
const order = ORDER[kind];
|
const order = ORDER[kind];
|
||||||
const sections = order.map((key) => content.sections?.[key]).filter((s) => s !== undefined);
|
const sections = order.map((key) => content.sections?.[key]).filter((s) => s !== undefined);
|
||||||
return (
|
return (
|
||||||
<article className="analysis">
|
<article className="analysis" lang={language}>
|
||||||
<header className="analysis-head">
|
<header className="analysis-head">
|
||||||
<h2>{content.title}</h2>
|
<h2>{content.title}</h2>
|
||||||
{content.summary && (
|
{content.summary && (
|
||||||
|
|||||||
@@ -78,7 +78,7 @@ export function ChartSummary({
|
|||||||
<h2 id="summary-title" className="summary-title">
|
<h2 id="summary-title" className="summary-title">
|
||||||
{content.title}
|
{content.title}
|
||||||
</h2>
|
</h2>
|
||||||
<p className="summary-text">
|
<p className="summary-text" lang={summary?.language}>
|
||||||
<Rich text={content.summary ?? ""} />
|
<Rich text={content.summary ?? ""} />
|
||||||
</p>
|
</p>
|
||||||
<a
|
<a
|
||||||
|
|||||||
@@ -155,7 +155,7 @@ export function DetailedAnalysis({
|
|||||||
<RegenerateButton<Analysis> url={`/admin/analyses/${analysis.id}/regenerate`} onStarted={setAnalysis} />
|
<RegenerateButton<Analysis> url={`/admin/analyses/${analysis.id}/regenerate`} onStarted={setAnalysis} />
|
||||||
)}
|
)}
|
||||||
{note && <p className="hint">{note}</p>}
|
{note && <p className="hint">{note}</p>}
|
||||||
<AnalysisView content={analysis.content} kind={target.kind} />
|
<AnalysisView content={analysis.content} kind={target.kind} language={analysis.language} />
|
||||||
{questionsLeft !== undefined && (
|
{questionsLeft !== undefined && (
|
||||||
<AnalysisQuestions
|
<AnalysisQuestions
|
||||||
analysisId={analysis.id}
|
analysisId={analysis.id}
|
||||||
|
|||||||
@@ -21,6 +21,11 @@ Háttérmunkák a közös PostgreSQL-adatbázis fölött: e-mail-küldés, szöv
|
|||||||
|
|
||||||
**Szöveges elemzések** (`analyses`, `pending` → `running` → `done`/`failed`)
|
**Szöveges elemzések** (`analyses`, `pending` → `running` → `done`/`failed`)
|
||||||
- A backend létrehozza a `pending` sort, és levon egy elemzési egységet. Egy trigger (`NOTIFY analyses`) felébreszti a workert; egyszerre `ANALYSIS_CONCURRENCY` elemzés készül.
|
- A backend létrehozza a `pending` sort, és levon egy elemzési egységet. Egy trigger (`NOTIFY analyses`) felébreszti a workert; egyszerre `ANALYSIS_CONCURRENCY` elemzés készül.
|
||||||
|
- **Két sáv**, saját helyekkel, hogy egy rövid szöveg ne várjon a hosszúak mögött:
|
||||||
|
- *gyors sáv* (`QUICK_CONCURRENCY`, alapból 2): előbb a kérdések, aztán a rövid összefoglalók;
|
||||||
|
- *lassú sáv* (`ANALYSIS_CONCURRENCY`, alapból 4): a részletes elemzések és az előrejelzések. Ha nincs ilyen, a szabad hely gyors munkát vesz fel, végül az admin próbafuttatásait.
|
||||||
|
- A 0 kikapcsolja a sávot, így a két sáv külön telepítésként is futhat (például Kubernetesen: egy gyors és egy lassú deployment).
|
||||||
|
- **Több worker** is dolgozhat ugyanabból a sorból: a sorokat `FOR UPDATE SKIP LOCKED` foglalja, egy munkát csak egy worker kap meg. Leálláskor mindegyik csak a saját félbehagyott munkáit adja vissza a sorba, az elakadt (15 percnél régebben futó) munkákat bármelyik visszateszi. Az e-mail-küldés és a takarítás is biztonságos több példányban.
|
||||||
- A prompt a tárolt képletből készül (`src/analysis/compact.rs`). Ez egy tömör szöveg, amely csak a pozíciókat tartalmazza: jegyek, fokok, házak, fényszögek, elemek. **Név, születési dátum, idő, hely és koordináta nem megy ki.** Ismeretlen születési időnél nincsenek házak, Aszcendens és MC.
|
- A prompt a tárolt képletből készül (`src/analysis/compact.rs`). Ez egy tömör szöveg, amely csak a pozíciókat tartalmazza: jegyek, fokok, házak, fényszögek, elemek. **Név, születési dátum, idő, hely és koordináta nem megy ki.** Ismeretlen születési időnél nincsenek házak, Aszcendens és MC.
|
||||||
- **5 fokos szabály:** ha egy pont legfeljebb 5°-kal (`CUSP_ORB`) a következő ház csúcsa előtt áll, a szöveg már abban a házban adja meg, és odaírja, hogy formálisan az előzőben van („house 11 (on the cusp: 2°00' before it, formally house 10)”). Így olvassák az asztrológusok. A számított ház, a képlet rajza és a táblázatok nem változnak. Ugyanez érvényes az összevetés házátfedéseire, a szolár Aszcendensre, az év urára és a fogyatkozásokra.
|
- **5 fokos szabály:** ha egy pont legfeljebb 5°-kal (`CUSP_ORB`) a következő ház csúcsa előtt áll, a szöveg már abban a házban adja meg, és odaírja, hogy formálisan az előzőben van („house 11 (on the cusp: 2°00' before it, formally house 10)”). Így olvassák az asztrológusok. A számított ház, a képlet rajza és a táblázatok nem változnak. Ugyanez érvényes az összevetés házátfedéseire, a szolár Aszcendensre, az év urára és a fogyatkozásokra.
|
||||||
- A modell OpenRouteren keresztül válaszol, azzal a modellel, amely a sor `model` mezőjében áll. A válasznak kötött JSON-sémát kell követnie (`crates/analysis-prompt`, `PROMPT_VERSION = v3`; ha a sor `prompt_version`-je `v3-r<id>`, a system prompt az admin által szerkesztett `prompt_revisions` sorból jön):
|
- A modell OpenRouteren keresztül válaszol, azzal a modellel, amely a sor `model` mezőjében áll. A válasznak kötött JSON-sémát kell követnie (`crates/analysis-prompt`, `PROMPT_VERSION = v3`; ha a sor `prompt_version`-je `v3-r<id>`, a system prompt az admin által szerkesztett `prompt_revisions` sorból jön):
|
||||||
@@ -72,7 +77,9 @@ Ugyanazt a radix-elemzést több modellel is megírja, véletlenszerű betűkkel
|
|||||||
| `OPENROUTER_API_KEY` | – | OpenRouter-kulcs (compose-ban a `.env.secrets` fájlból); nélküle az elemzések várnak |
|
| `OPENROUTER_API_KEY` | – | OpenRouter-kulcs (compose-ban a `.env.secrets` fájlból); nélküle az elemzések várnak |
|
||||||
| `OPENROUTER_BASE_URL` | `https://openrouter.ai/api/v1` | |
|
| `OPENROUTER_BASE_URL` | `https://openrouter.ai/api/v1` | |
|
||||||
| `PUBLIC_BASE_URL` | – | `HTTP-Referer` fejléc az OpenRouter felé |
|
| `PUBLIC_BASE_URL` | – | `HTTP-Referer` fejléc az OpenRouter felé |
|
||||||
| `ANALYSIS_CONCURRENCY` | `4` | egyszerre írt elemzések |
|
| `WORKER_TASKS` | `email,cleanup,analyses` | a folyamat feladatai; élesben `worker`: `email,cleanup`, `worker-ai`: `analyses` |
|
||||||
|
| `ANALYSIS_CONCURRENCY` | `4` | lassú sáv: egyszerre írt részletes elemzések és előrejelzések (0: kikapcsolva) |
|
||||||
|
| `QUICK_CONCURRENCY` | `2` | gyors sáv: egyszerre írt rövid összefoglalók és válaszok (0: kikapcsolva) |
|
||||||
| `MAX_ANALYSIS_ATTEMPTS` | `3` | ennyi próbálkozás után sikertelen az elemzés (az egység visszajár) |
|
| `MAX_ANALYSIS_ATTEMPTS` | `3` | ennyi próbálkozás után sikertelen az elemzés (az egység visszajár) |
|
||||||
| `BIND_ADDR`, `LOG_FORMAT`, `RUST_LOG` | `0.0.0.0:8082`, `text`, `info` | |
|
| `BIND_ADDR`, `LOG_FORMAT`, `RUST_LOG` | `0.0.0.0:8082`, `text`, `info` | |
|
||||||
|
|
||||||
|
|||||||
@@ -9,6 +9,13 @@
|
|||||||
//! Admin test runs of an edited prompt (`prompt_previews`) go through the
|
//! Admin test runs of an edited prompt (`prompt_previews`) go through the
|
||||||
//! same loop when no analysis is due: one attempt, no credits, no retries.
|
//! same loop when no analysis is due: one attempt, no credits, no retries.
|
||||||
//!
|
//!
|
||||||
|
//! Two lanes, each with its own slots, so a short text never waits behind
|
||||||
|
//! the long ones: the quick lane writes summaries and answers questions, the
|
||||||
|
//! slow lane writes the detailed analyses and forecasts (and the test runs).
|
||||||
|
//! A free slow slot also takes quick work. A lane of size 0 is off, so the
|
||||||
|
//! lanes can run as separate deployments; several workers may share the
|
||||||
|
//! queue, rows are claimed with `FOR UPDATE SKIP LOCKED`.
|
||||||
|
//!
|
||||||
//! Fallback: when the model chosen on the admin page fails twice (or once with
|
//! Fallback: when the model chosen on the admin page fails twice (or once with
|
||||||
//! a permanent error), the default model (`fallback_model`) takes over with a
|
//! a permanent error), the default model (`fallback_model`) takes over with a
|
||||||
//! fresh set of attempts; only when that fails too is the unit refunded.
|
//! fresh set of attempts; only when that fails too is the unit refunded.
|
||||||
@@ -29,6 +36,7 @@ use uuid::Uuid;
|
|||||||
|
|
||||||
use self::openrouter::{Completion, LlmError, OpenRouter};
|
use self::openrouter::{Completion, LlmError, OpenRouter};
|
||||||
use self::prompt::{Kind, PROMPT_VERSION, Prompt};
|
use self::prompt::{Kind, PROMPT_VERSION, Prompt};
|
||||||
|
use self::questions::QuestionJob;
|
||||||
|
|
||||||
/// A `running` analysis older than this was left behind by a stopped worker.
|
/// A `running` analysis older than this was left behind by a stopped worker.
|
||||||
const STUCK_AFTER_MINUTES: i32 = 15;
|
const STUCK_AFTER_MINUTES: i32 = 15;
|
||||||
@@ -101,11 +109,36 @@ pub struct PreviewJob {
|
|||||||
pub system: String,
|
pub system: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Which analyses a claim may take.
|
||||||
|
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
||||||
|
pub enum Lane {
|
||||||
|
/// The short summary of a chart (questions are claimed separately).
|
||||||
|
Quick,
|
||||||
|
/// The detailed analyses and the yearly forecast.
|
||||||
|
Slow,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Lane {
|
||||||
|
fn kinds(self) -> &'static [&'static str] {
|
||||||
|
match self {
|
||||||
|
Lane::Quick => &["summary"],
|
||||||
|
Lane::Slow => &["natal", "synastry", "forecast"],
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Slots per lane; 0 turns a lane off.
|
||||||
|
#[derive(Debug, Clone, Copy)]
|
||||||
|
pub struct Lanes {
|
||||||
|
pub quick: usize,
|
||||||
|
pub slow: usize,
|
||||||
|
}
|
||||||
|
|
||||||
pub struct Analyzer {
|
pub struct Analyzer {
|
||||||
pub db: PgPool,
|
pub db: PgPool,
|
||||||
pub llm: OpenRouter,
|
pub llm: OpenRouter,
|
||||||
pub max_attempts: i32,
|
pub max_attempts: i32,
|
||||||
pub concurrency: usize,
|
pub lanes: Lanes,
|
||||||
/// Analyses and previews being written right now (released on shutdown).
|
/// Analyses and previews being written right now (released on shutdown).
|
||||||
running: Mutex<HashSet<Uuid>>,
|
running: Mutex<HashSet<Uuid>>,
|
||||||
}
|
}
|
||||||
@@ -117,19 +150,21 @@ pub fn backoff(attempts: i32) -> Duration {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl Analyzer {
|
impl Analyzer {
|
||||||
pub fn new(db: PgPool, llm: OpenRouter, max_attempts: i32, concurrency: usize) -> Self {
|
pub fn new(db: PgPool, llm: OpenRouter, max_attempts: i32, lanes: Lanes) -> Self {
|
||||||
Self { db, llm, max_attempts, concurrency: concurrency.max(1), running: Mutex::default() }
|
Self { db, llm, max_attempts, lanes, running: Mutex::default() }
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Takes the next due analysis, if any.
|
/// Takes the next due analysis of the lane, if any.
|
||||||
pub async fn claim(&self) -> Result<Option<Job>, sqlx::Error> {
|
pub async fn claim(&self, lane: Lane) -> Result<Option<Job>, sqlx::Error> {
|
||||||
let job: Option<Job> = sqlx::query_as(
|
let job: Option<Job> = sqlx::query_as(
|
||||||
"UPDATE analyses SET status = 'running', started_at = now(), attempts = attempts + 1 \
|
"UPDATE analyses SET status = 'running', started_at = now(), attempts = attempts + 1 \
|
||||||
WHERE id = (SELECT id FROM analyses WHERE status = 'pending' AND next_attempt_at <= now() \
|
WHERE id = (SELECT id FROM analyses WHERE status = 'pending' AND next_attempt_at <= now() \
|
||||||
|
AND kind = ANY($1) \
|
||||||
ORDER BY next_attempt_at LIMIT 1 FOR UPDATE SKIP LOCKED) \
|
ORDER BY next_attempt_at LIMIT 1 FOR UPDATE SKIP LOCKED) \
|
||||||
RETURNING id, kind, chart_id, synastry_id, forecast_id, language, model, prompt_version, attempts, \
|
RETURNING id, kind, chart_id, synastry_id, forecast_id, language, model, prompt_version, attempts, \
|
||||||
fallback_model, on_fallback, started_at",
|
fallback_model, on_fallback, started_at",
|
||||||
)
|
)
|
||||||
|
.bind(lane.kinds())
|
||||||
.fetch_optional(&self.db)
|
.fetch_optional(&self.db)
|
||||||
.await?;
|
.await?;
|
||||||
if let Some(job) = &job {
|
if let Some(job) = &job {
|
||||||
@@ -530,8 +565,46 @@ impl Analyzer {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Work a free slot can take, in order of preference.
|
||||||
|
pub(crate) enum Work {
|
||||||
|
Analysis(Job),
|
||||||
|
Question(QuestionJob),
|
||||||
|
Preview(PreviewJob),
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Analyzer {
|
||||||
|
/// Quick work: a question first (someone is waiting for a short answer),
|
||||||
|
/// then a summary.
|
||||||
|
pub(crate) async fn claim_quick(&self) -> Result<Option<Work>, sqlx::Error> {
|
||||||
|
if let Some(job) = self.claim_question().await? {
|
||||||
|
return Ok(Some(Work::Question(job)));
|
||||||
|
}
|
||||||
|
Ok(self.claim(Lane::Quick).await?.map(Work::Analysis))
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Slow work: a detailed analysis, else quick work, else a test run.
|
||||||
|
pub(crate) async fn claim_slow(&self) -> Result<Option<Work>, sqlx::Error> {
|
||||||
|
if let Some(job) = self.claim(Lane::Slow).await? {
|
||||||
|
return Ok(Some(Work::Analysis(job)));
|
||||||
|
}
|
||||||
|
if let Some(work) = self.claim_quick().await? {
|
||||||
|
return Ok(Some(work));
|
||||||
|
}
|
||||||
|
Ok(self.claim_preview().await?.map(Work::Preview))
|
||||||
|
}
|
||||||
|
|
||||||
|
async fn work(&self, work: Work) {
|
||||||
|
match work {
|
||||||
|
Work::Analysis(job) => self.handle(job).await,
|
||||||
|
Work::Question(job) => self.handle_question(job).await,
|
||||||
|
Work::Preview(job) => self.handle_preview(job).await,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
pub async fn run(analyzer: Arc<Analyzer>, poll: Duration, stop: watch::Receiver<bool>) {
|
pub async fn run(analyzer: Arc<Analyzer>, poll: Duration, stop: watch::Receiver<bool>) {
|
||||||
let slots = Arc::new(Semaphore::new(analyzer.concurrency));
|
let quick = Arc::new(Semaphore::new(analyzer.lanes.quick));
|
||||||
|
let slow = Arc::new(Semaphore::new(analyzer.lanes.slow));
|
||||||
let mut tasks = tokio::task::JoinSet::new();
|
let mut tasks = tokio::task::JoinSet::new();
|
||||||
let mut listener = crate::listen(&analyzer.db, "analyses").await;
|
let mut listener = crate::listen(&analyzer.db, "analyses").await;
|
||||||
let mut last_requeue: Option<Instant> = None;
|
let mut last_requeue: Option<Instant> = None;
|
||||||
@@ -547,50 +620,27 @@ pub async fn run(analyzer: Arc<Analyzer>, poll: Duration, stop: watch::Receiver<
|
|||||||
Err(e) => tracing::error!(error = %e, "requeueing analyses"),
|
Err(e) => tracing::error!(error = %e, "requeueing analyses"),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Fill the free slots.
|
// Fill the free slots: the quick lane first, then the slow one.
|
||||||
while let Ok(permit) = slots.clone().try_acquire_owned() {
|
for lane in [Lane::Quick, Lane::Slow] {
|
||||||
// Questions first: someone is waiting for a short answer.
|
let slots = if lane == Lane::Quick { &quick } else { &slow };
|
||||||
match analyzer.claim_question().await {
|
while let Ok(permit) = slots.clone().try_acquire_owned() {
|
||||||
Ok(Some(job)) => {
|
let claimed = match lane {
|
||||||
let analyzer = analyzer.clone();
|
Lane::Quick => analyzer.claim_quick().await,
|
||||||
tasks.spawn(async move {
|
Lane::Slow => analyzer.claim_slow().await,
|
||||||
analyzer.handle_question(job).await;
|
};
|
||||||
drop(permit);
|
match claimed {
|
||||||
});
|
Ok(Some(work)) => {
|
||||||
continue;
|
|
||||||
}
|
|
||||||
Ok(None) => {}
|
|
||||||
Err(e) => {
|
|
||||||
tracing::error!(error = %e, "claiming a question");
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
match analyzer.claim().await {
|
|
||||||
Ok(Some(job)) => {
|
|
||||||
let analyzer = analyzer.clone();
|
|
||||||
tasks.spawn(async move {
|
|
||||||
analyzer.handle(job).await;
|
|
||||||
drop(permit);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
// No analysis is due: a prompt test run, if one waits.
|
|
||||||
Ok(None) => match analyzer.claim_preview().await {
|
|
||||||
Ok(Some(job)) => {
|
|
||||||
let analyzer = analyzer.clone();
|
let analyzer = analyzer.clone();
|
||||||
tasks.spawn(async move {
|
tasks.spawn(async move {
|
||||||
analyzer.handle_preview(job).await;
|
analyzer.work(work).await;
|
||||||
drop(permit);
|
drop(permit);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
Ok(None) => break,
|
Ok(None) => break,
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
tracing::error!(error = %e, "claiming a prompt preview");
|
tracing::error!(error = %e, ?lane, "claiming work");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
},
|
|
||||||
Err(e) => {
|
|
||||||
tracing::error!(error = %e, "claiming an analysis");
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,7 +5,38 @@ use std::time::Duration;
|
|||||||
use anyhow::Context;
|
use anyhow::Context;
|
||||||
use lettre::message::Mailbox;
|
use lettre::message::Mailbox;
|
||||||
|
|
||||||
|
/// The jobs a worker process runs (`WORKER_TASKS`, comma-separated).
|
||||||
|
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
||||||
|
pub struct Tasks {
|
||||||
|
/// Sending the e-mails of `email_outbox`.
|
||||||
|
pub email: bool,
|
||||||
|
/// The hourly removal of expired data.
|
||||||
|
pub cleanup: bool,
|
||||||
|
/// Writing the analyses and answers with the LLM (both lanes).
|
||||||
|
pub analyses: bool,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Tasks {
|
||||||
|
pub const ALL: Tasks = Tasks { email: true, cleanup: true, analyses: true };
|
||||||
|
|
||||||
|
pub fn parse(raw: &str) -> anyhow::Result<Self> {
|
||||||
|
let mut tasks = Tasks { email: false, cleanup: false, analyses: false };
|
||||||
|
for name in raw.split(',').map(str::trim).filter(|n| !n.is_empty()) {
|
||||||
|
match name {
|
||||||
|
"email" => tasks.email = true,
|
||||||
|
"cleanup" => tasks.cleanup = true,
|
||||||
|
"analyses" => tasks.analyses = true,
|
||||||
|
other => anyhow::bail!("unknown task '{other}' in WORKER_TASKS (email, cleanup, analyses)"),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
anyhow::ensure!(tasks != Tasks { email: false, cleanup: false, analyses: false }, "WORKER_TASKS names no task");
|
||||||
|
Ok(tasks)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
pub struct Config {
|
pub struct Config {
|
||||||
|
/// What this process does; all of it by default.
|
||||||
|
pub tasks: Tasks,
|
||||||
pub database_url: String,
|
pub database_url: String,
|
||||||
/// `smtp://host:port` (plain, e.g. Mailpit), `smtp://user:pass@host:587?tls=required`
|
/// `smtp://host:port` (plain, e.g. Mailpit), `smtp://user:pass@host:587?tls=required`
|
||||||
/// (STARTTLS) or `smtps://...` (TLS). Without it, Amazon SES from the AWS
|
/// (STARTTLS) or `smtps://...` (TLS). Without it, Amazon SES from the AWS
|
||||||
@@ -24,8 +55,10 @@ pub struct Config {
|
|||||||
pub openrouter_base_url: String,
|
pub openrouter_base_url: String,
|
||||||
/// Frontend address, sent to OpenRouter as `HTTP-Referer`.
|
/// Frontend address, sent to OpenRouter as `HTTP-Referer`.
|
||||||
pub public_base_url: Option<String>,
|
pub public_base_url: Option<String>,
|
||||||
/// Analyses written at the same time.
|
/// Detailed analyses and forecasts written at the same time (0: none).
|
||||||
pub analysis_concurrency: usize,
|
pub analysis_concurrency: usize,
|
||||||
|
/// Summaries and answers written at the same time (0: none).
|
||||||
|
pub quick_concurrency: usize,
|
||||||
/// After this many failed attempts an analysis fails and is refunded.
|
/// After this many failed attempts an analysis fails and is refunded.
|
||||||
pub max_analysis_attempts: i32,
|
pub max_analysis_attempts: i32,
|
||||||
}
|
}
|
||||||
@@ -55,6 +88,7 @@ impl Config {
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
Ok(Self {
|
Ok(Self {
|
||||||
|
tasks: var("WORKER_TASKS").map(|raw| Tasks::parse(&raw)).transpose()?.unwrap_or(Tasks::ALL),
|
||||||
database_url: var("DATABASE_URL").context("DATABASE_URL is required")?,
|
database_url: var("DATABASE_URL").context("DATABASE_URL is required")?,
|
||||||
smtp_url,
|
smtp_url,
|
||||||
smtp_about,
|
smtp_about,
|
||||||
@@ -67,6 +101,7 @@ impl Config {
|
|||||||
.unwrap_or_else(|| crate::analysis::openrouter::DEFAULT_BASE_URL.into()),
|
.unwrap_or_else(|| crate::analysis::openrouter::DEFAULT_BASE_URL.into()),
|
||||||
public_base_url: var("PUBLIC_BASE_URL"),
|
public_base_url: var("PUBLIC_BASE_URL"),
|
||||||
analysis_concurrency: parsed("ANALYSIS_CONCURRENCY", 4)?,
|
analysis_concurrency: parsed("ANALYSIS_CONCURRENCY", 4)?,
|
||||||
|
quick_concurrency: parsed("QUICK_CONCURRENCY", 2)?,
|
||||||
max_analysis_attempts: parsed("MAX_ANALYSIS_ATTEMPTS", 3)?,
|
max_analysis_attempts: parsed("MAX_ANALYSIS_ATTEMPTS", 3)?,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,6 +5,9 @@
|
|||||||
//! * hourly cleanup of expired sessions, tokens, invites and old e-mails
|
//! * hourly cleanup of expired sessions, tokens, invites and old e-mails
|
||||||
//! * writing the requested text analyses with an LLM (OpenRouter)
|
//! * writing the requested text analyses with an LLM (OpenRouter)
|
||||||
//!
|
//!
|
||||||
|
//! `WORKER_TASKS` (e.g. `email,cleanup` or `analyses`) picks the jobs of one
|
||||||
|
//! process, so they can run in separate containers; all of them by default.
|
||||||
|
//!
|
||||||
//! Configuration: see [`config::Config`]; plus `BIND_ADDR` (default
|
//! Configuration: see [`config::Config`]; plus `BIND_ADDR` (default
|
||||||
//! `0.0.0.0:8082`, only `/healthz`), `LOG_FORMAT` and `RUST_LOG`.
|
//! `0.0.0.0:8082`, only `/healthz`), `LOG_FORMAT` and `RUST_LOG`.
|
||||||
//! `worker healthcheck` performs a local health check (for Docker);
|
//! `worker healthcheck` performs a local health check (for Docker);
|
||||||
@@ -91,7 +94,10 @@ async fn main() -> anyhow::Result<()> {
|
|||||||
|
|
||||||
let (stop_tx, stop) = watch::channel(false);
|
let (stop_tx, stop) = watch::channel(false);
|
||||||
let mut jobs = tokio::task::JoinSet::new();
|
let mut jobs = tokio::task::JoinSet::new();
|
||||||
|
let tasks = config.tasks;
|
||||||
|
tracing::info!(email = tasks.email, cleanup = tasks.cleanup, analyses = tasks.analyses, "worker tasks");
|
||||||
match &config.smtp_url {
|
match &config.smtp_url {
|
||||||
|
_ if !tasks.email => {}
|
||||||
Some(url) => {
|
Some(url) => {
|
||||||
let delivery = email::Delivery::new(pool.clone(), email::Mailer::smtp(url)?, &config);
|
let delivery = email::Delivery::new(pool.clone(), email::Mailer::smtp(url)?, &config);
|
||||||
let via = config.smtp_about.clone().unwrap_or_else(|| "SMTP_URL".into());
|
let via = config.smtp_about.clone().unwrap_or_else(|| "SMTP_URL".into());
|
||||||
@@ -101,17 +107,24 @@ async fn main() -> anyhow::Result<()> {
|
|||||||
None => tracing::warn!("neither SMTP_URL nor SES credentials are set: e-mails stay in the outbox"),
|
None => tracing::warn!("neither SMTP_URL nor SES credentials are set: e-mails stay in the outbox"),
|
||||||
}
|
}
|
||||||
match &config.openrouter_api_key {
|
match &config.openrouter_api_key {
|
||||||
|
_ if !tasks.analyses => {}
|
||||||
Some(key) => {
|
Some(key) => {
|
||||||
let llm =
|
let llm =
|
||||||
analysis::openrouter::OpenRouter::new(&config.openrouter_base_url, key, config.public_base_url.clone());
|
analysis::openrouter::OpenRouter::new(&config.openrouter_base_url, key, config.public_base_url.clone());
|
||||||
let analyzer =
|
let lanes = analysis::Lanes { quick: config.quick_concurrency, slow: config.analysis_concurrency };
|
||||||
analysis::Analyzer::new(pool.clone(), llm, config.max_analysis_attempts, config.analysis_concurrency);
|
if lanes.quick + lanes.slow == 0 {
|
||||||
tracing::info!(concurrency = analyzer.concurrency, "analyses enabled");
|
tracing::warn!("QUICK_CONCURRENCY and ANALYSIS_CONCURRENCY are both 0: this worker writes no analyses");
|
||||||
jobs.spawn(analysis::run(Arc::new(analyzer), config.poll_interval, stop.clone()));
|
} else {
|
||||||
|
let analyzer = analysis::Analyzer::new(pool.clone(), llm, config.max_analysis_attempts, lanes);
|
||||||
|
tracing::info!(quick = lanes.quick, slow = lanes.slow, "analyses enabled");
|
||||||
|
jobs.spawn(analysis::run(Arc::new(analyzer), config.poll_interval, stop.clone()));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
None => tracing::warn!("OPENROUTER_API_KEY is not set: analyses stay pending"),
|
None => tracing::warn!("OPENROUTER_API_KEY is not set: analyses stay pending"),
|
||||||
}
|
}
|
||||||
jobs.spawn(cleanup::run(pool.clone(), stop.clone()));
|
if tasks.cleanup {
|
||||||
|
jobs.spawn(cleanup::run(pool.clone(), stop.clone()));
|
||||||
|
}
|
||||||
|
|
||||||
let app = Router::new().route("/healthz", get(healthz)).with_state(pool);
|
let app = Router::new().route("/healthz", get(healthz)).with_state(pool);
|
||||||
let listener = tokio::net::TcpListener::bind(addr).await.with_context(|| format!("binding {addr}"))?;
|
let listener = tokio::net::TcpListener::bind(addr).await.with_context(|| format!("binding {addr}"))?;
|
||||||
|
|||||||
@@ -223,6 +223,16 @@ async fn cleanup_removes_only_expired_data(db: PgPool) {
|
|||||||
|
|
||||||
// --- analyses ----------------------------------------------------------------------------
|
// --- analyses ----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn worker_tasks_are_chosen_by_name() {
|
||||||
|
use crate::config::Tasks;
|
||||||
|
let mail = Tasks::parse("email, cleanup").unwrap();
|
||||||
|
assert_eq!(mail, Tasks { email: true, cleanup: true, analyses: false });
|
||||||
|
assert_eq!(Tasks::parse("analyses").unwrap(), Tasks { email: false, cleanup: false, analyses: true });
|
||||||
|
assert!(Tasks::parse("emails").is_err());
|
||||||
|
assert!(Tasks::parse(" , ").is_err());
|
||||||
|
}
|
||||||
|
|
||||||
mod analyses {
|
mod analyses {
|
||||||
use std::sync::{Arc, Mutex};
|
use std::sync::{Arc, Mutex};
|
||||||
|
|
||||||
@@ -235,7 +245,7 @@ mod analyses {
|
|||||||
|
|
||||||
use crate::analysis::openrouter::OpenRouter;
|
use crate::analysis::openrouter::OpenRouter;
|
||||||
use crate::analysis::prompt::{Kind, schema, validate};
|
use crate::analysis::prompt::{Kind, schema, validate};
|
||||||
use crate::analysis::{Analyzer, backoff};
|
use crate::analysis::{Analyzer, Lane, Lanes, backoff};
|
||||||
|
|
||||||
/// Scripted replies (then the last one forever) and the requests received.
|
/// Scripted replies (then the last one forever) and the requests received.
|
||||||
#[derive(Clone, Default)]
|
#[derive(Clone, Default)]
|
||||||
@@ -337,11 +347,11 @@ mod analyses {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn analyzer(db: &PgPool, base_url: &str) -> Analyzer {
|
fn analyzer(db: &PgPool, base_url: &str) -> Analyzer {
|
||||||
Analyzer::new(db.clone(), OpenRouter::new(base_url, "test-key", None), 3, 2)
|
Analyzer::new(db.clone(), OpenRouter::new(base_url, "test-key", None), 3, Lanes { quick: 1, slow: 2 })
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn run_once(a: &Analyzer) -> bool {
|
async fn run_once(a: &Analyzer) -> bool {
|
||||||
match a.claim().await.unwrap() {
|
match a.claim(Lane::Slow).await.unwrap() {
|
||||||
Some(job) => {
|
Some(job) => {
|
||||||
a.handle(job).await;
|
a.handle(job).await;
|
||||||
true
|
true
|
||||||
@@ -464,10 +474,10 @@ mod analyses {
|
|||||||
let a = analyzer(&db, &url);
|
let a = analyzer(&db, &url);
|
||||||
|
|
||||||
// the analysis goes first; the preview only when nothing else is due
|
// the analysis goes first; the preview only when nothing else is due
|
||||||
let job = a.claim().await.unwrap().expect("the analysis");
|
let job = a.claim(Lane::Slow).await.unwrap().expect("the analysis");
|
||||||
assert_eq!(job.id, analysis);
|
assert_eq!(job.id, analysis);
|
||||||
a.handle(job).await;
|
a.handle(job).await;
|
||||||
assert!(a.claim().await.unwrap().is_none());
|
assert!(a.claim(Lane::Slow).await.unwrap().is_none());
|
||||||
let job = a.claim_preview().await.unwrap().expect("the preview");
|
let job = a.claim_preview().await.unwrap().expect("the preview");
|
||||||
a.handle_preview(job).await;
|
a.handle_preview(job).await;
|
||||||
let (status, title, model, credits): (String, Option<String>, Option<String>, i64) = sqlx::query_as(
|
let (status, title, model, credits): (String, Option<String>, Option<String>, i64) = sqlx::query_as(
|
||||||
@@ -811,7 +821,7 @@ mod analyses {
|
|||||||
let id = request_analysis(&db, &s).await;
|
let id = request_analysis(&db, &s).await;
|
||||||
let (_, url) = fake_openrouter(vec![reply(&content(Kind::Natal))]).await;
|
let (_, url) = fake_openrouter(vec![reply(&content(Kind::Natal))]).await;
|
||||||
let a = analyzer(&db, &url);
|
let a = analyzer(&db, &url);
|
||||||
let job = a.claim().await.unwrap().expect("a job");
|
let job = a.claim(Lane::Slow).await.unwrap().expect("a job");
|
||||||
// an admin restarts it while the worker is still writing it
|
// an admin restarts it while the worker is still writing it
|
||||||
sqlx::query("UPDATE analyses SET status = 'pending', started_at = NULL, attempts = 0 WHERE id = $1")
|
sqlx::query("UPDATE analyses SET status = 'pending', started_at = NULL, attempts = 0 WHERE id = $1")
|
||||||
.bind(id)
|
.bind(id)
|
||||||
@@ -829,6 +839,40 @@ mod analyses {
|
|||||||
assert_eq!(status, "done");
|
assert_eq!(status, "done");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[sqlx::test(migrator = "db::MIGRATOR")]
|
||||||
|
async fn summaries_have_their_own_lane(db: PgPool) {
|
||||||
|
let s = setup(&db).await;
|
||||||
|
let natal = request_analysis(&db, &s).await;
|
||||||
|
let summary = |id: Uuid| {
|
||||||
|
sqlx::query(
|
||||||
|
"INSERT INTO analyses (id, kind, chart_id, requested_by, language, model, prompt_version, cache_key, \
|
||||||
|
credits_charged) \
|
||||||
|
VALUES ($1, 'summary', $2, $3, 'hu', 'test/model', 'v1', 'key', 0)",
|
||||||
|
)
|
||||||
|
.bind(id)
|
||||||
|
.bind(s.chart)
|
||||||
|
.bind(s.user)
|
||||||
|
};
|
||||||
|
let first = Uuid::now_v7();
|
||||||
|
summary(first).execute(&db).await.unwrap();
|
||||||
|
let a = analyzer(&db, "http://127.0.0.1:9");
|
||||||
|
|
||||||
|
// the quick lane takes the summary, never the detailed analysis
|
||||||
|
let id_of = |work: Option<crate::analysis::Work>| match work {
|
||||||
|
Some(crate::analysis::Work::Analysis(job)) => Some(job.id),
|
||||||
|
Some(_) => panic!("not an analysis"),
|
||||||
|
None => None,
|
||||||
|
};
|
||||||
|
assert_eq!(id_of(a.claim_quick().await.unwrap()), Some(first));
|
||||||
|
assert_eq!(id_of(a.claim_quick().await.unwrap()), None);
|
||||||
|
// the slow lane prefers the detailed analysis, then helps with quick work
|
||||||
|
let second = Uuid::now_v7();
|
||||||
|
summary(second).execute(&db).await.unwrap();
|
||||||
|
assert_eq!(id_of(a.claim_slow().await.unwrap()), Some(natal));
|
||||||
|
assert_eq!(id_of(a.claim_slow().await.unwrap()), Some(second));
|
||||||
|
assert_eq!(id_of(a.claim_slow().await.unwrap()), None);
|
||||||
|
}
|
||||||
|
|
||||||
#[sqlx::test(migrator = "db::MIGRATOR")]
|
#[sqlx::test(migrator = "db::MIGRATOR")]
|
||||||
async fn answers_a_question_about_a_relationship_with_both_charts(db: PgPool) {
|
async fn answers_a_question_about_a_relationship_with_both_charts(db: PgPool) {
|
||||||
let s = setup(&db).await;
|
let s = setup(&db).await;
|
||||||
|
|||||||
Reference in New Issue
Block a user