Weekly horoscope: its own page, a Monday e-mail, and one page for every e-mail setting
CI / test (push) Successful in 3m17s
CI / build (push) Skipped
CI / deploy (push) Skipped

- The week's sky on the member's own chart (horoscope-api POST /v1/week,
  astro_engine::week): the planets' aspects to the natal points with the day
  each is exact, positions, the Moon's signs, lunar phases, stations and sign
  changes; stored once per chart and week (weekly_skies, migration 0047).
- Its text is a 'weekly' analysis written by the summary's (cheap) model when
  the member opens /heti-horoszkop: one month per page, the newest week
  first, the waiting animation while it is written. In the menu, and linked
  from the chart page.
- Monday 7:00 e-mail (worker task 'weekly'): only that it is there; on by
  default for everyone with a chart, members of today too. Its footer opens
  /ertesitesek?token=…, where the weekly e-mail and every forum e-mail can
  be set without logging in; the mail client's one-click unsubscribe turns
  off the weekly one. Also a switch on the page and on the Profile page.
- Privacy notice (HU/EN) describes it; ratings, admin labels and the model
  page know the new kind.

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-27 09:40:09 +00:00
co-authored by Claude Opus 5.5
parent 50c29e4595
commit 0358e137f1
46 changed files with 2368 additions and 70 deletions
+72 -2
View File
@@ -28,6 +28,10 @@ pub enum Kind {
/// A detailed analysis of a famous person's chart, about them in the third
/// person, for the public pages (the name comes with the data, see [`with_name`]).
Celebrity,
/// The free weekly horoscope: the week's sky on the member's own chart, a
/// title and a few paragraphs. Written by the summary's model; its prompt
/// is not edited on the admin page (so it is not in [`Kind::ALL`]).
Weekly,
}
impl Kind {
@@ -44,6 +48,7 @@ impl Kind {
Kind::Forecast => "forecast",
Kind::Question => "question",
Kind::Celebrity => "celebrity",
Kind::Weekly => "weekly",
}
}
@@ -55,6 +60,7 @@ impl Kind {
"forecast" => Some(Kind::Forecast),
"question" => Some(Kind::Question),
"celebrity" => Some(Kind::Celebrity),
"weekly" => Some(Kind::Weekly),
_ => None,
}
}
@@ -153,7 +159,7 @@ fn sections_in(kind: Kind, language: &str) -> Vec<(&'static str, &'static str)>
Kind::Natal | Kind::Celebrity => &NATAL_SECTIONS_HU,
Kind::Synastry => &SYNASTRY_SECTIONS_HU,
Kind::Forecast => &FORECAST_SECTIONS_HU,
Kind::Summary | Kind::Question => &[],
Kind::Summary | Kind::Question | Kind::Weekly => &[],
};
sections(kind).iter().zip(hu).map(|(&(key, en), &hu)| (key, if language == "hu" { hu } else { en })).collect()
}
@@ -163,7 +169,7 @@ fn sections(kind: Kind) -> &'static [(&'static str, &'static str)] {
Kind::Natal | Kind::Celebrity => &NATAL_SECTIONS,
Kind::Synastry => &SYNASTRY_SECTIONS,
Kind::Forecast => &FORECAST_SECTIONS,
Kind::Summary | Kind::Question => &[],
Kind::Summary | Kind::Question | Kind::Weekly => &[],
}
}
@@ -184,6 +190,17 @@ pub fn schema(kind: Kind) -> Value {
}
});
}
if kind == Kind::Weekly {
return json!({
"type": "object",
"additionalProperties": false,
"required": ["title", "text"],
"properties": {
"title": {"type": "string", "description": "Short, evocative title for this week (at most 6 words)"},
"text": {"type": "string", "description": "3 short paragraphs separated by a blank line, 150-220 words in all"}
}
});
}
if kind == Kind::Summary {
return json!({
"type": "object",
@@ -269,6 +286,13 @@ fn hungarian_system(kind: Kind) -> String {
előrejelzés kb. 1500–2000 szó.",
),
Kind::Question => unreachable!("questions have their own prompt"),
Kind::Weekly => (
"személyes heti horoszkópot (a hét égboltja az olvasó saját születési képletén; ingyenes, hétfőnként új)",
SECOND_PERSON_HU,
"Terjedelem: 3 rövid bekezdés, összesen 150–220 szó. Az első a hét fő témája a két-három legerősebb \
tranzitból; a második a hét kulcsnapjai (a hét napjainak nevével: „szerdán”, „a hét végén”); a harmadik \
egy konkrét, a hétre szóló javaslat. Ne sorold fel az összes tranzitot.",
),
Kind::Celebrity => (
"portrét egy híres ember születési képletéről (az olvasó nem ő maga, hanem egy érdeklődő látogató)",
THIRD_PERSON_HU,
@@ -315,6 +339,9 @@ használhatsz.
if kind == Kind::Celebrity {
text.push_str(CELEBRITY_RULES_HU);
}
if kind == Kind::Weekly {
text.push_str(WEEKLY_RULES_HU);
}
text.push_str(HUNGARIAN_TERMS);
if kind == Kind::Forecast {
text.push_str(HUNGARIAN_FORECAST_TERMS);
@@ -341,6 +368,23 @@ rajzolódik ki, aki…”), mert lehet, hogy már nem él. Ne állíts semmit az
kijelentést.
- Az „advice” mező nem neki szóló tanács, hanem zárógondolat: egy bekezdés, amely összefogja a portrét.";
const WEEKLY_RULES_HU: &str = "
A heti horoszkóp szabályai:
- Ez nem jellemrajz, hanem a hétről szól: a születési képletet csak ott említsd, ahol egy tranzit érinti.
- Úgy súlyozz, ahogy egy asztrológus: a lassú bolygók (Jupitertől a Plútóig) tranzitjai a hét háttere; a gyors \
bolygók pontos fényszögei a Napra, a Holdra, az Aszcendensre, az MC-re és a horoszkóp uralkodójára a hét eseményes \
napjai; a Hold jegyváltásai a hét hangulatának hullámzása; az újhold, a telihold és a retrográd fordulók csak akkor \
hangsúlyosak, ha a képletet érintik.
- Témákról, hangulatokról és lehetőségekről írj, ne biztos eseményekről: „jó nap arra, hogy”, „hozhat”, „azt kéri \
tőled”. Semmit betegségről, halálról, balesetről, terhességről, pénz nyereségéről vagy elvesztéséről. A feszült \
fényszögeket is kihívásként és lehetőségként írd le, ne riogass.
- Csak az adatokban szereplő napokat használd. A napokat a hét napjainak nevével említsd (hétfő, kedd, …), \
dátumszám nélkül.
- Ne reklámozz, és ne említs más elemzést vagy szolgáltatást.
- Kifejezések: tranzit („a Mars tranzitja a Napod felett”), retrográd, újhold, telihold, a Hold jegyváltása. A \
születési képlet pontjait „a születési Vénuszod”, „a Holdad” formában említsd, ne „natális”-ként.";
const FORECAST_RULES_HU: &str = "
Az előrejelzés szabályai:
@@ -408,6 +452,10 @@ pub fn default_system(kind: Kind, language: &str) -> String {
}
let (role, reader) = match kind {
Kind::Question => unreachable!("questions have their own prompt"),
Kind::Weekly => (
"a personal weekly horoscope (the week's sky on the reader's own natal chart; free, new every Monday)",
"Speak to the owner of the chart directly, in the informal second person singular (in Hungarian: tegező forma, \"te\").",
),
Kind::Celebrity => (
"a portrait of a famous person's natal chart (the reader is not that person but an interested visitor)",
"Write about them in the third person singular, by name: the full name in the summary, later also the \
@@ -455,6 +503,9 @@ and no medical, legal or financial advice.
length = match kind {
Kind::Forecast => "Length: each section 2-4 paragraphs (about 150-250 words), the timeline exactly 4 \
paragraphs; the whole forecast about 1500-2000 words.",
Kind::Weekly => "Length: 3 short paragraphs, 150-220 words in all. The first is the main theme of the \
week from the two or three strongest transits; the second the key days (by weekday name: \"on \
Wednesday\", \"at the weekend\"); the third one concrete suggestion for the week. Do not list every transit.",
Kind::Summary => "Length: one paragraph of 3-4 sentences (60-100 words). Pick the Sun, Moon and Ascendant \
(if the birth time is known) and the single most striking feature of the chart (a very tight aspect, \
a stellium, a strong element emphasis or gap). It must be complete in itself and specific to this chart: \
@@ -468,9 +519,25 @@ and no medical, legal or financial advice.
if kind == Kind::Celebrity {
text.push_str(CELEBRITY_RULES);
}
if kind == Kind::Weekly {
text.push_str(WEEKLY_RULES);
}
text
}
const WEEKLY_RULES: &str = "
Weekly horoscope rules:
- This is not a portrait but the week: mention the natal chart only where a transit touches it.
- Weigh as an astrologer would: the slow planets' transits (Jupiter to Pluto) are the background of the week; the \
fast planets' exact aspects to the Sun, Moon, Ascendant, Midheaven and chart ruler mark its eventful days; the Moon's \
sign changes are the ebb and flow of the mood; new and full moons and stations matter where they touch the chart.
- Write about themes, moods and opportunities, never certain events: \"a good day to\", \"may bring\", \"asks you \
to\". Nothing about illness, death, accidents, pregnancy, or winning or losing money. Describe tense aspects as \
challenges and chances, without alarm.
- Use only the days in the data, and name them by weekday (Monday, Tuesday, ...), without dates.
- No sales talk, and do not mention any other analysis or service.";
const CELEBRITY_RULES: &str = "
Rules for a famous person's portrait:
@@ -651,6 +718,8 @@ pub fn build(kind: Kind, language: &str, chart_text: &str, system: Option<&str>)
user.push_str(chart_text);
if kind == Kind::Summary {
user.push_str(if hu { "\nMost írd meg a rövid összefoglalót." } else { "\nWrite the short summary now." });
} else if kind == Kind::Weekly {
user.push_str(if hu { "\nMost írd meg a heti horoszkópot." } else { "\nWrite the weekly horoscope now." });
} else {
user.push_str(if hu {
"\nA megírandó fejezetek ebben a sorrendben (JSON-kulcs: tartalom):\n"
@@ -672,6 +741,7 @@ pub fn build(kind: Kind, language: &str, chart_text: &str, system: Option<&str>)
Kind::Summary => "chart_summary",
Kind::Question => "question_answer",
Kind::Forecast => "forecast_analysis",
Kind::Weekly => "weekly_horoscope",
},
schema: schema(kind),
}