i18n: Englisch als Hauptsprache, Sprachpakete fuer Desktop und WebUI (#661)
Umbau durch Gemini Flash, Durchsicht und Nacharbeit durch Claude. Umfang: - Desktop: LocalizationManager (JSON-Pakete, Rueckfall auf Englisch, Umschalten zur Laufzeit), Localize-Markup-Erweiterung, Sprachwahl in den Einstellungen (AppSettings.Language, Vorgabe "en"); 317 Schluessel je Sprache - WebUI: alle Ansichten auf t()/data-i18n, 656 Schluessel je Sprache - Agenten-Werkzeuge: Beschreibungen, Schemata und Meldungen auf Englisch - Tests an die englischen Meldungen angepasst, keine Pruefung abgeschwaecht Nacharbeit bei der Durchsicht: - ~25 Kommentarbloecke mit Begruendungen waren ersatzlos entfallen, darunter sicherheitsrelevante (NTFS-Datenstrom beim shared:-Praefix, Bremse gegen Agentenschleifen, doppelter POST beim Anlegen einer Instanz). Wieder eingesetzt: auf Englisch, wo die Datei umgestellt ist, sonst im Wortlaut. - Drei WebUI-Schluessel fehlten (logs.paused, instances.instanceOfflineError, instances.noInstanceActiveError). Weil t() bei fehlendem Schluessel den Schluessel selbst liefert, griff der "|| err.message"-Rueckfall nie — die Oberflaeche haette den Schluesselnamen angezeigt. Geprueft: Schluesselgleichheit en/de, Platzhalter je Schluessel, jeder im Code benutzte Schluessel vorhanden, node --check fuer alle Module, 1.220 Tests gruen. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
69718122f3
commit
ad71682c2d
@@ -11,7 +11,7 @@ public sealed class TelegramTool : IAgentTool, IToolJobProvider
|
||||
{
|
||||
public string Name => "Telegram";
|
||||
|
||||
public string Description => "Erlaubt das Senden und Empfangen von Nachrichten über Telegram.";
|
||||
public string Description => "Allows sending and receiving messages via Telegram.";
|
||||
|
||||
public JsonElement InputSchema { get; } = JsonDocument.Parse("""
|
||||
{
|
||||
@@ -20,19 +20,19 @@ public sealed class TelegramTool : IAgentTool, IToolJobProvider
|
||||
"action": {
|
||||
"type": "string",
|
||||
"enum": ["send_message", "get_updates"],
|
||||
"description": "Die auszuführende Aktion"
|
||||
"description": "The action to execute"
|
||||
},
|
||||
"chatId": {
|
||||
"type": "string",
|
||||
"description": "Die ID des Chats (optional, falls Standard-ID konfiguriert)"
|
||||
"description": "The ID of the chat (optional if default ID is configured)"
|
||||
},
|
||||
"text": {
|
||||
"type": "string",
|
||||
"description": "Der zu sendende Text (nur für send_message)"
|
||||
"description": "The text to send (only for send_message)"
|
||||
},
|
||||
"limit": {
|
||||
"type": "integer",
|
||||
"description": "Maximale Anzahl an Nachrichten zum Abrufen (nur für get_updates)"
|
||||
"description": "Maximum number of messages to fetch (only for get_updates)"
|
||||
}
|
||||
},
|
||||
"required": ["action"]
|
||||
@@ -52,7 +52,7 @@ public sealed class TelegramTool : IAgentTool, IToolJobProvider
|
||||
var botToken = context.ToolConfig.TryGetValue("botToken", out var bt) ? bt?.ToString() : null;
|
||||
if (string.IsNullOrWhiteSpace(botToken))
|
||||
{
|
||||
return ToolResult.Fail("Konfigurationsfehler: 'botToken' ist nicht definiert.");
|
||||
return ToolResult.Fail("Configuration error: 'botToken' is not defined.");
|
||||
}
|
||||
|
||||
var botClient = new TelegramBotClient(botToken);
|
||||
@@ -63,13 +63,13 @@ public sealed class TelegramTool : IAgentTool, IToolJobProvider
|
||||
{
|
||||
"send_message" => await HandleSendMessageAsync(botClient, input, context, ct),
|
||||
"get_updates" => await HandleGetUpdatesAsync(botClient, input, context, ct),
|
||||
_ => ToolResult.Fail($"Unbekannte Aktion: {action}")
|
||||
_ => ToolResult.Fail($"Unknown action: {action}")
|
||||
};
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
context.Logger.LogError(ex, "Fehler bei Telegram Aktion {Action}", action);
|
||||
return ToolResult.Fail($"Fehler: {ex.Message}");
|
||||
context.Logger.LogError(ex, "Error in Telegram action {Action}", action);
|
||||
return ToolResult.Fail($"Error: {ex.Message}");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -78,7 +78,7 @@ public sealed class TelegramTool : IAgentTool, IToolJobProvider
|
||||
public IReadOnlyList<ToolJobDefinition> GetJobDefinitions() =>
|
||||
[
|
||||
new("telegram_poll", "Telegram Polling",
|
||||
"Prüft regelmäßig auf neue Telegram-Nachrichten und weckt den Agenten bei neuen Nachrichten.")
|
||||
"Periodically checks for new Telegram messages and wakes the agent on new messages.")
|
||||
];
|
||||
|
||||
public async Task<ToolJobResult> ExecuteJobAsync(
|
||||
@@ -91,11 +91,11 @@ public sealed class TelegramTool : IAgentTool, IToolJobProvider
|
||||
string? workspacePath = null)
|
||||
{
|
||||
if (jobTypeId != "telegram_poll")
|
||||
return ToolJobResult.NoAction($"Unbekannter Job-Typ: {jobTypeId}");
|
||||
return ToolJobResult.NoAction($"Unknown job type: {jobTypeId}");
|
||||
|
||||
var botToken = toolConfig.TryGetValue("botToken", out var bt) ? bt?.ToString() : null;
|
||||
if (string.IsNullOrWhiteSpace(botToken))
|
||||
return ToolJobResult.NoAction("Kein botToken konfiguriert");
|
||||
return ToolJobResult.NoAction("No botToken configured");
|
||||
|
||||
var client = new TelegramBotClient(botToken);
|
||||
|
||||
@@ -120,7 +120,7 @@ public sealed class TelegramTool : IAgentTool, IToolJobProvider
|
||||
var newOffset = updates.Max(u => u.Id) + 1;
|
||||
await stateStore.SetAsync(offsetKey, newOffset.ToString(), ct);
|
||||
}
|
||||
return ToolJobResult.NoAction("Polled: 0 neue Nachrichten");
|
||||
return ToolJobResult.NoAction("Polled: 0 new messages");
|
||||
}
|
||||
|
||||
var newOffsetFinal = updates.Max(u => u.Id) + 1;
|
||||
@@ -128,21 +128,21 @@ public sealed class TelegramTool : IAgentTool, IToolJobProvider
|
||||
|
||||
var summary = string.Join("\n", messages.Select(u =>
|
||||
{
|
||||
var from = u.Message!.From?.Username ?? u.Message.From?.FirstName ?? "Unbekannt";
|
||||
var text = u.Message.Text ?? "(kein Text)";
|
||||
var from = u.Message!.From?.Username ?? u.Message.From?.FirstName ?? "Unknown";
|
||||
var text = u.Message.Text ?? "(no text)";
|
||||
return $"- {from}: {text}";
|
||||
}));
|
||||
|
||||
var wakeMessage = $"[Telegram] {messages.Count} neue Nachricht(en) empfangen:\n\n{summary}";
|
||||
var wakeMessage = $"[Telegram] {messages.Count} new message(s) received:\n\n{summary}";
|
||||
|
||||
logger.LogInformation("Telegram Poll: {Count} neue Nachrichten", messages.Count);
|
||||
logger.LogInformation("Telegram Poll: {Count} new messages", messages.Count);
|
||||
|
||||
return ToolJobResult.Wake(wakeMessage, $"Polled: {messages.Count} neue Nachrichten");
|
||||
return ToolJobResult.Wake(wakeMessage, $"Polled: {messages.Count} new messages");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
logger.LogError(ex, "Telegram Polling fehlgeschlagen");
|
||||
return ToolJobResult.NoAction($"Polling-Fehler: {ex.Message}");
|
||||
logger.LogError(ex, "Telegram polling failed");
|
||||
return ToolJobResult.NoAction($"Polling error: {ex.Message}");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -161,16 +161,16 @@ public sealed class TelegramTool : IAgentTool, IToolJobProvider
|
||||
|
||||
if (string.IsNullOrWhiteSpace(chatIdStr) || string.IsNullOrWhiteSpace(text))
|
||||
{
|
||||
return ToolResult.Fail("'chatId' (oder Standard-ID in Konfig) und 'text' sind für send_message erforderlich.");
|
||||
return ToolResult.Fail("'chatId' (or default ID in config) and 'text' are required for send_message.");
|
||||
}
|
||||
|
||||
if (!IsChatIdAllowed(chatIdStr, context.ToolConfig))
|
||||
{
|
||||
return ToolResult.Fail($"Sicherheitsfehler: Zugriff auf ChatId '{chatIdStr}' ist nicht erlaubt.");
|
||||
return ToolResult.Fail($"Security error: Access to ChatId '{chatIdStr}' is not allowed.");
|
||||
}
|
||||
|
||||
await client.SendMessage(new ChatId(chatIdStr), text, cancellationToken: ct);
|
||||
return ToolResult.Ok($"Nachricht erfolgreich an {chatIdStr} gesendet.");
|
||||
return ToolResult.Ok($"Message successfully sent to {chatIdStr}.");
|
||||
}
|
||||
|
||||
private async Task<ToolResult> HandleGetUpdatesAsync(
|
||||
|
||||
Reference in New Issue
Block a user