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
@@ -5,12 +5,12 @@ using ClawdDotNet.Core.Api.Models;
|
||||
namespace ClawdDotNet.Core.Tests.Infrastructure;
|
||||
|
||||
/// <summary>
|
||||
/// Ersetzt den OpenRouterClient in Tests. Liefert eine vorprogrammierte Antwortfolge
|
||||
/// und schreibt jeden empfangenen Request mit.
|
||||
/// Replaces the OpenRouterClient in tests. Delivers a preprogrammed sequence of answers
|
||||
/// and records every request received.
|
||||
///
|
||||
/// Wichtig: Requests werden tief kopiert. Die Engine reicht dieselbe List<ChatMessage>
|
||||
/// weiter und verändert sie danach — ohne Kopie würden Tests den Endzustand prüfen
|
||||
/// statt dessen, was tatsächlich gesendet wurde.
|
||||
/// Important: requests are deep-copied. The engine passes on the same List<ChatMessage>
|
||||
/// and changes it afterwards — without a copy tests would check the final state
|
||||
/// instead of what was actually sent.
|
||||
/// </summary>
|
||||
internal sealed class FakeChatClient : IChatCompletionClient
|
||||
{
|
||||
@@ -18,12 +18,12 @@ internal sealed class FakeChatClient : IChatCompletionClient
|
||||
private Func<ChatRequest, ChatResponse>? _fallback;
|
||||
private readonly Lock _gate = new();
|
||||
|
||||
/// <summary>Alle empfangenen Requests, als tiefe Kopien.</summary>
|
||||
/// <summary>All requests received, as deep copies.</summary>
|
||||
public List<ChatRequest> ReceivedRequests { get; } = new();
|
||||
|
||||
public int CallCount => ReceivedRequests.Count;
|
||||
|
||||
// ─── Programmierung der Antworten ───
|
||||
// ─── Programming the answers ───
|
||||
|
||||
public FakeChatClient RespondsWithText(string text, Usage? usage = null)
|
||||
{
|
||||
@@ -42,7 +42,7 @@ internal sealed class FakeChatClient : IChatCompletionClient
|
||||
|
||||
private static ChatResponse ToolCallResponse((string Tool, string Args, string? Id)[] calls)
|
||||
{
|
||||
// Ids müssen pro Antwort eindeutig sein, sonst kollidieren parallele Läufe.
|
||||
// IDs must be unique per answer, otherwise parallel runs collide.
|
||||
var toolCalls = calls.Select(c => new ToolCall
|
||||
{
|
||||
Id = c.Id ?? "call_" + Guid.NewGuid().ToString("N")[..12],
|
||||
@@ -58,7 +58,7 @@ internal sealed class FakeChatClient : IChatCompletionClient
|
||||
};
|
||||
}
|
||||
|
||||
/// <summary>Antwortet mit einer bestimmten Prompt-Token-Zahl — für Compaction-Schwellen.</summary>
|
||||
/// <summary>Answers with a particular prompt token count — for compaction thresholds.</summary>
|
||||
public FakeChatClient RespondsWithTokens(int promptTokens, string text = "fertig")
|
||||
{
|
||||
_responses.Enqueue(_ => TextResponse(text, new Usage
|
||||
@@ -77,7 +77,7 @@ internal sealed class FakeChatClient : IChatCompletionClient
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Antwortet mit einem an der Ausgabegrenze abgeschnittenen Text (#548).
|
||||
/// Answers with a text cut off at the output limit (#548).
|
||||
/// </summary>
|
||||
public FakeChatClient RespondsWithTruncatedText(string text, string finishReason = "length")
|
||||
{
|
||||
@@ -99,8 +99,8 @@ internal sealed class FakeChatClient : IChatCompletionClient
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Antwortet mit Werkzeugaufrufen UND Begleittext bzw. Denkverlauf — der Fall, den
|
||||
/// #547 und #549 betreffen.
|
||||
/// Answers with tool calls AND accompanying text or reasoning — the case
|
||||
/// #547 and #549 concern.
|
||||
/// </summary>
|
||||
public FakeChatClient RespondsWithToolCallAndContent(
|
||||
string toolName,
|
||||
@@ -122,7 +122,7 @@ internal sealed class FakeChatClient : IChatCompletionClient
|
||||
return this;
|
||||
}
|
||||
|
||||
/// <summary>Antwort für alle Aufrufe, die über die programmierte Folge hinausgehen.</summary>
|
||||
/// <summary>Answer for all calls that go beyond the programmed sequence.</summary>
|
||||
public FakeChatClient AlwaysRespondsWithText(string text)
|
||||
{
|
||||
_fallback = _ => TextResponse(text);
|
||||
@@ -136,9 +136,9 @@ internal sealed class FakeChatClient : IChatCompletionClient
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Antwortet passend zum jeweiligen Gesprächsstand: nach einer Tool-Antwort
|
||||
/// kommt Text, sonst ein Tool-Aufruf. Damit verhält sich der Fake auch dann
|
||||
/// sinnvoll, wenn mehrere Konversationen ineinander verschränkt laufen.
|
||||
/// Answers matching the respective state of the conversation: after a tool answer
|
||||
/// comes text, otherwise a tool call. That way the fake behaves sensibly
|
||||
/// even when several conversations run interleaved.
|
||||
/// </summary>
|
||||
public FakeChatClient RespondsContextually(string toolName = "TestTool")
|
||||
{
|
||||
@@ -154,8 +154,8 @@ internal sealed class FakeChatClient : IChatCompletionClient
|
||||
{
|
||||
ct.ThrowIfCancellationRequested();
|
||||
|
||||
// Erst kopieren, dann auswerten: Die Engine mutiert die Original-Liste
|
||||
// weiter, und bei Nebenläufigkeitstests soll der Fake daran nicht scheitern.
|
||||
// Copy first, then evaluate: the engine keeps mutating the original list,
|
||||
// and in concurrency tests the fake should not fail because of that.
|
||||
var snapshot = DeepClone(request);
|
||||
lock (_gate)
|
||||
ReceivedRequests.Add(snapshot);
|
||||
@@ -172,7 +172,7 @@ internal sealed class FakeChatClient : IChatCompletionClient
|
||||
return Task.FromResult(responder(snapshot));
|
||||
}
|
||||
|
||||
// ─── Helfer ───
|
||||
// ─── Helpers ───
|
||||
|
||||
private static ChatResponse TextResponse(string text, Usage? usage = null) => new()
|
||||
{
|
||||
@@ -189,8 +189,8 @@ internal sealed class FakeChatClient : IChatCompletionClient
|
||||
MaxTokens = request.MaxTokens,
|
||||
ToolChoice = request.ToolChoice,
|
||||
Tools = request.Tools?.ToList(),
|
||||
// Die Gateway-Felder gehören mitkopiert, sonst prüft ein Test die Härtung
|
||||
// am Wire-Format vorbei — dieselbe Falle wie bei CacheBreakpoint.
|
||||
// The gateway fields must be copied too, otherwise a test checks the hardening
|
||||
// past the wire format — the same trap as with CacheBreakpoint.
|
||||
Provider = request.Provider,
|
||||
Usage = request.Usage,
|
||||
Reasoning = request.Reasoning,
|
||||
@@ -202,7 +202,7 @@ internal sealed class FakeChatClient : IChatCompletionClient
|
||||
Role = m.Role,
|
||||
Content = m.Content,
|
||||
ToolCallId = m.ToolCallId,
|
||||
// Muss mitkopiert werden, sonst prüfen Caching-Tests am Wire-Format vorbei.
|
||||
// Must be copied too, otherwise caching tests check past the wire format.
|
||||
CacheBreakpoint = m.CacheBreakpoint,
|
||||
Reasoning = m.Reasoning,
|
||||
ReasoningDetails = m.ReasoningDetails,
|
||||
|
||||
Reference in New Issue
Block a user