Read the news again with an optional language model, capped and schema-bound (refs #58)
ci / test (postgres) (push) Successful in 3m33s
ci / test (sqlite) (push) Successful in 4m16s
ci / image (push) Successful in 2m55s
ci / test (postgres) (pull_request) Successful in 3m42s
ci / test (sqlite) (pull_request) Successful in 4m36s
ci / image (pull_request) Successful in 2m2s

The analyst of SPEC 10.2 point 5 sends the fresh stories about held and
candidate instruments to Anthropic, an OpenAI-compatible service or Ollama,
eight to a request, over plain HTTP with no SDK. The news text travels as
escaped JSON data; only the appendix B schema is kept, instruments not
already linked are dropped, and a verdict can only add a restriction.
Each request goes out only if its worst-case cost still fits under the
daily cap; verdicts are cached by content hash. Without a key nothing is
asked and the rules work as before. ADR 0014 point 15.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Alby96andClaude Opus 5.5 committed 2026-11-28 12:41:39 +01:00
1 parent 4449ec7a0a
commit dcebfb61e1
20 files changed
+1774 -79

No files matched your search

+15 -9
View File
@@ -238,28 +238,34 @@ internal static partial class Forms
{
var back = Back(form, "/impostazioni");
var news = Anubis.News.NewsRuleSettings.All.Any(d => d.Key == key);
var cap = key == Anubis.News.NewsModelSettings.DailyCap.Key;
var model = Anubis.News.NewsModelSettings.All.Any(d => d.Key == key);
if (key != SettingsStore.Theme.Key && key != SettingsStore.Currency.Key && key != SettingsStore.CentralBankMeetings.Key && key != SettingsStore.TelegramStatus.Key &&
!news && !cap)
!news && !model)
{
return Results.Redirect(With(back, "errore", "impostazione"));
}
if ((news || cap) && host.IsDemo)
if ((news || model) && host.IsDemo)
{
return Results.Redirect(With(back, "errore", "motore"));
}
if (cap)
if (model)
{
// "0,50" as the user writes it; stored as "0.50".
var amount = form["valore"].ToString().Trim().Replace("€", "", StringComparison.Ordinal).Trim().Replace(',', '.');
if (Anubis.News.NewsModelSettings.CheckCap(amount) is not null)
// Amounts as the user writes them, "0,50" or "0,50 €", stored as "0.50"; the other values trimmed.
var value = form["valore"].ToString().Trim();
if (Anubis.News.NewsModelSettings.IsAmount(key))
{
return Results.Redirect(With(back, "errore", "tetto"));
value = Anubis.News.NewsModelSettings.Amount(value)?.ToString(System.Globalization.CultureInfo.InvariantCulture) ?? value;
}
var saved = await Endpoints.SetSettingAsync(host, key, amount, context, ct).ConfigureAwait(false);
var definition = SettingsStore.Definition(key);
if ((definition.Check?.Invoke(value) is not null) || (definition.Allowed is { } allowed && !allowed.Contains(value, StringComparer.Ordinal)))
{
return Results.Redirect(With(back, "errore", key == Anubis.News.NewsModelSettings.DailyCap.Key ? "tetto" : "modello"));
}
var saved = await Endpoints.SetSettingAsync(host, key, value, context, ct).ConfigureAwait(false);
return Results.Redirect(saved is IStatusCodeHttpResult { StatusCode: StatusCodes.Status204NoContent } ? back : With(back, "errore", "impostazione"));
}