@page "/editor" @page "/editor/{action}" @page "/editor/{action}/{projectId:int}" @inject IOllamaService OllamaService @inject IProjectService ProjectService @inject NavigationManager Navigation Editor - Author Buddy
@statusText @if (isChecking) { }
@if (showSpellDiff && !string.IsNullOrEmpty(correctedText)) {

Rechtschreibprüfung - Änderungen:

} else if (!string.IsNullOrEmpty(analysisResult)) {

Ergebnis:

@analysisResult
} @code { [Parameter] public string? Action { get; set; } [Parameter] public int? ProjectId { get; set; } private string editorContent = string.Empty; private string statusText = "Bereit"; private bool isChecking; private double checkProgress; private string analysisResult = string.Empty; private string originalText = string.Empty; private string correctedText = string.Empty; private bool showSpellDiff; protected override async Task OnInitializedAsync() { if (Action == "newproject") { statusText = "Bitte nutze die Einstellungen zum Erstellen eines neuen Projekts."; } } private async Task CheckStyle() { if (string.IsNullOrWhiteSpace(editorContent)) return; isChecking = true; statusText = "Ollama analysiert Stil..."; checkProgress = 50; showSpellDiff = false; try { //analysisResult = await OllamaService.StreamStyleCheckAsync(editorContent); } catch (Exception ex) { analysisResult = $"Fehler: {ex.Message}"; } finally { statusText = "Bereit"; isChecking = false; checkProgress = 0; } } private async Task SpellCheck() { if (string.IsNullOrWhiteSpace(editorContent)) return; isChecking = true; statusText = "Ollama prüft Rechtschreibung..."; checkProgress = 50; showSpellDiff = false; try { originalText = editorContent; correctedText = await OllamaService.QuickSpellCheckAsync(editorContent); showSpellDiff = true; } catch (Exception ex) { analysisResult = $"Fehler: {ex.Message}"; } finally { statusText = "Bereit"; isChecking = false; checkProgress = 0; } } private async Task RagSearch() { if (string.IsNullOrWhiteSpace(editorContent)) return; isChecking = true; statusText = "Suche verwandte Fakten..."; showSpellDiff = false; await Task.Delay(500); analysisResult = "RAG-Suche: Stelle sicher, dass ein Projekt geladen und indexiert wurde."; statusText = "Bereit"; isChecking = false; } }