@page "/settings"
@attribute [Authorize]
@rendermode InteractiveServer
@inject ISettingsService SettingsService
@inject IThemeService ThemeService
@inject IOllamaService OllamaService
@inject NavigationManager Navigation
@inject IJSRuntime JSRuntime
@inject IProjectService ProjectService
@inject ILocalizationService Loc
@inject IAuthService AuthService
@Loc["page.title.settings"] - Author Buddy
@if (currentProjectName != null)
{
@Loc["settings.context.project"]: @currentProjectName
}
else
{
@Loc["settings.context.user"]
}
@if (_isAdmin)
{
}
@if (_isAdmin && _activePromptTab == "admin")
{
@Loc["settings.section.user"]
@Loc["settings.section.models"]
@Loc["settings.section.ollama_server"]
@Loc["settings.section.diagnostics"]
@if (_diagnosticsResults != null)
{
@foreach (var line in _diagnosticsResults)
{
@line
}
}
@Loc["settings.section.appearance"]
@Loc["settings.section.language"]
}
@if (_activePromptTab == "novel")
{
@Loc["settings.section.editor_prompt"]
SetTemp(e, v => lektorTemp = v))" />
@GetTempCategory(lektorTemp)
@GetTempDescription(lektorTemp)
@Loc["settings.section.factcheck_template"]
SetTemp(e, v => factCheckTemp = v))" />
@GetTempCategory(factCheckTemp)
@GetTempDescription(factCheckTemp)
@Loc["settings.section.spellcheck_prompt"]
SetTemp(e, v => spellingTemp = v))" />
@GetTempCategory(spellingTemp)
@GetTempDescription(spellingTemp)
@Loc["settings.section.advocatus_diaboli"]
SetTemp(e, v => advocatusDiaboliTemp = v))" />
@GetTempCategory(advocatusDiaboliTemp)
@GetTempDescription(advocatusDiaboliTemp)
@Loc["settings.section.hook_finder"]
SetTemp(e, v => hookFinderTemp = v))" />
@GetTempCategory(hookFinderTemp)
@GetTempDescription(hookFinderTemp)
@Loc["settings.section.eli5"]
SetTemp(e, v => eli5Temp = v))" />
@GetTempCategory(eli5Temp)
@GetTempDescription(eli5Temp)
@Loc["settings.section.coauthor_brainstorming"]
SetTemp(e, v => coAuthorTemp = v))" />
@GetTempCategory(coAuthorTemp)
@GetTempDescription(coAuthorTemp)
}
@if (_activePromptTab == "technical")
{
@Loc["settings.section.tech_lastenheft"]
SetTemp(e, v => techLastenheftTemp = v))" />
@GetTempCategory(techLastenheftTemp)
@GetTempDescription(techLastenheftTemp)
@Loc["settings.section.tech_pflichtenheft"]
SetTemp(e, v => techPflichtenheftTemp = v))" />
@GetTempCategory(techPflichtenheftTemp)
@GetTempDescription(techPflichtenheftTemp)
@Loc["settings.section.tech_usecase"]
SetTemp(e, v => techUseCaseTemp = v))" />
@GetTempCategory(techUseCaseTemp)
@GetTempDescription(techUseCaseTemp)
@Loc["settings.section.tech_stakeholder"]
SetTemp(e, v => techStakeholderTemp = v))" />
@GetTempCategory(techStakeholderTemp)
@GetTempDescription(techStakeholderTemp)
@Loc["settings.section.tech_glossar"]
SetTemp(e, v => techGlossarTemp = v))" />
@GetTempCategory(techGlossarTemp)
@GetTempDescription(techGlossarTemp)
@Loc["settings.section.tech_qualitaet"]
SetTemp(e, v => techQualitaetTemp = v))" />
@GetTempCategory(techQualitaetTemp)
@GetTempDescription(techQualitaetTemp)
@Loc["settings.section.tech_risiko"]
SetTemp(e, v => techRisikoTemp = v))" />
@GetTempCategory(techRisikoTemp)
@GetTempDescription(techRisikoTemp)
}
@if (!string.IsNullOrEmpty(statusMessage))
{
@statusMessage
}
@code {
private string _activePromptTab = "novel";
private void SwitchToNovelTab() => _activePromptTab = "novel";
private void SwitchToTechnicalTab() => _activePromptTab = "technical";
private void SwitchToAdminTab() => _activePromptTab = "admin";
private string ragModel = "llama3.2";
private string styleModel = "llama3.2";
private string spellingModel = "phi3:mini";
private string selectedTheme = "light";
private string ollamaUrl = "http://localhost:11434";
private string llamaCppUrl = "http://localhost:8080";
private string selectedBackend = "Ollama";
private string lektorPrompt = string.Empty;
private string factCheckTemplate = string.Empty;
private string spellingPrompt = string.Empty;
private string advocatusDiaboliPrompt = string.Empty;
private string hookFinderPrompt = string.Empty;
private string eli5Prompt = string.Empty;
private string coAuthorPrompt = string.Empty;
private double lektorTemp = 0.7;
private double factCheckTemp = 0.3;
private double spellingTemp = 0.1;
private double advocatusDiaboliTemp = 0.9;
private double hookFinderTemp = 0.9;
private double eli5Temp = 0.5;
private double coAuthorTemp = 1.0;
private string techLastenheftPrompt = string.Empty;
private string techPflichtenheftPrompt = string.Empty;
private string techUseCasePrompt = string.Empty;
private string techStakeholderPrompt = string.Empty;
private string techGlossarPrompt = string.Empty;
private string techQualitaetPrompt = string.Empty;
private string techRisikoPrompt = string.Empty;
private double techLastenheftTemp = 0.3;
private double techPflichtenheftTemp = 0.3;
private double techUseCaseTemp = 0.4;
private double techStakeholderTemp = 0.5;
private double techGlossarTemp = 0.2;
private double techQualitaetTemp = 0.3;
private double techRisikoTemp = 0.5;
private string selectedLanguage = "de";
private string newProjectName = string.Empty;
private string newUserName = string.Empty;
private string statusMessage = string.Empty;
private List