Stufe 4c (#764): Kommentare in C#, WebUI-Skripten, CSS und HTML auf Englisch
Rund 2.600 Kommentarblöcke in 310 C#-Dateien übersetzt, Begründungen vollständig erhalten: blockweise gleiche Anzahl wie vorher, kein Block unter 60 % seiner Länge, der Code außerhalb der Kommentare per Tokenizer byte-identisch geprüft. Zitate deutscher Oberflächentexte und Testdaten bleiben deutsch. WebUI: Kommentare in JS/CSS/HTML übersetzt, JSDoc-@param an die in 4b umbenannten Parameter angeglichen. Dabei behoben: - 4b hatte "tag" (HTML-Tag) als deutsches "Tag" gelesen und zu "dayValue" gemacht (makeElement, svg, Tagesübersicht) - zurück auf tag/day. - Aufgaben "InProgress" bekamen die Plakettenart "laufend", für die es nie eine CSS-Klasse gab - jetzt "success" wie laufende Instanzen. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
da4ceac7d5
commit
837a634a22
@@ -46,7 +46,7 @@ public sealed class DirectApiTool : IAgentTool
|
||||
var action = input.GetProperty("action").GetString()!;
|
||||
var symbol = input.GetProperty("symbol").GetString()!;
|
||||
|
||||
// Config laden
|
||||
// Load config
|
||||
IReadOnlyDictionary<string, object?>? config = context.ToolConfig.TryGetValue("DirectAPI", out var c) && c is JsonElement je
|
||||
? JsonSerializer.Deserialize<Dictionary<string, object?>>(je.GetRawText())
|
||||
: context.ToolConfig;
|
||||
@@ -279,19 +279,19 @@ public sealed class DirectApiTool : IAgentTool
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Das Ergebnis eines API-Aufrufs: <b>entweder</b> Daten <b>oder</b> eine Absage —
|
||||
/// nie beides, nie keines von beiden.
|
||||
/// The result of an API call: <b>either</b> data <b>or</b> a refusal —
|
||||
/// never both, never neither.
|
||||
///
|
||||
/// <para>Vorher war das ein Tupel <c>(JsonElement? json, ToolResult? error)</c>, und
|
||||
/// jede der elf Aufrufstellen las danach <c>json.Value</c>. Dass der Wert nach
|
||||
/// <c>if (error != null) return error;</c> immer da ist, wusste nur der Mensch —
|
||||
/// der Compiler wies mit elf CS8629 darauf hin, dass er es nicht nachvollziehen
|
||||
/// kann. Elf Warnungen, die man wegzusehen lernt, verdecken die zwölfte, die
|
||||
/// stimmt.</para>
|
||||
/// <para>Previously this was a tuple <c>(JsonElement? json, ToolResult? error)</c>, and
|
||||
/// each of the eleven call sites then read <c>json.Value</c>. That the value is always there after
|
||||
/// <c>if (error != null) return error;</c> was only known to the human —
|
||||
/// the compiler pointed out with eleven CS8629 that it could not follow it.
|
||||
/// Eleven warnings you learn to look away from hide the twelfth that
|
||||
/// is right.</para>
|
||||
///
|
||||
/// <para><see cref="TryGet"/> sagt dasselbe so, dass es nachvollziehbar ist: Wer
|
||||
/// <c>true</c> bekommt, hat die Daten; wer <c>false</c> bekommt, hat die Absage,
|
||||
/// die er zurückgeben soll.</para>
|
||||
/// <para><see cref="TryGet"/> says the same in a way that can be followed: whoever
|
||||
/// gets <c>true</c> has the data; whoever gets <c>false</c> has the refusal
|
||||
/// they should return.</para>
|
||||
/// </summary>
|
||||
private readonly struct JsonFetch
|
||||
{
|
||||
@@ -310,21 +310,21 @@ public sealed class DirectApiTool : IAgentTool
|
||||
public bool TryGet(out JsonElement json, out ToolResult error)
|
||||
{
|
||||
json = _json;
|
||||
// Der Ersatz greift nie: Fail verlangt eine Absage, Ok setzt keine. Er steht
|
||||
// hier, damit die Zusage ohne Ausrufezeichen auskommt.
|
||||
// The fallback never applies: Fail demands a refusal, Ok sets none. It stands
|
||||
// here so the promise gets by without an exclamation mark.
|
||||
error = _error ?? ToolResult.Fail("Unbekannter Fehler beim API-Aufruf.");
|
||||
return _error is null;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sichere JSON-Antwort von einer API abrufen.
|
||||
/// Prüft HTTP-Status und ob die Antwort tatsächlich JSON ist, bevor geparst wird.
|
||||
/// Fetch a JSON response from an API safely.
|
||||
/// Checks the HTTP status and whether the response actually is JSON before parsing.
|
||||
/// </summary>
|
||||
private static async Task<JsonFetch> SafeGetJsonAsync(
|
||||
HttpClient http, string url, CancellationToken ct)
|
||||
{
|
||||
// Auch Fehlermeldungen gehen an das Modell — der Schlüssel darf darin nicht auftauchen.
|
||||
// Error messages go to the model too — the key must not appear in them.
|
||||
var safeUrl = UrlSanitizer.Sanitize(url);
|
||||
|
||||
HttpResponseMessage response;
|
||||
@@ -346,7 +346,7 @@ public sealed class DirectApiTool : IAgentTool
|
||||
$"API Fehler: HTTP {(int)response.StatusCode} {response.ReasonPhrase} von {safeUrl}\nAntwort: {preview}"));
|
||||
}
|
||||
|
||||
// Prüfen ob die Antwort überhaupt JSON ist
|
||||
// Check whether the response is JSON at all
|
||||
var trimmed = body.TrimStart();
|
||||
if (trimmed.Length == 0 || (trimmed[0] != '{' && trimmed[0] != '['))
|
||||
{
|
||||
@@ -382,8 +382,8 @@ public sealed class DirectApiTool : IAgentTool
|
||||
{
|
||||
fetchedAt = fetchedAt,
|
||||
dataAsOf = dataAsOf,
|
||||
// Ohne Bereinigung ginge der API-Schlüssel im Query-String an das Modell,
|
||||
// in den persistierten Kontext und in die Logs.
|
||||
// Without sanitizing, the API key in the query string would go to the model,
|
||||
// into the persisted context and into the logs.
|
||||
source = UrlSanitizer.Sanitize(source),
|
||||
data = data
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user