Refactor: Server-Settings von appsettings.json in DB-Tabelle (server_settings)
- Neuer ServerSettingsService: zentrale Settings in SQLite mit In-Memory-Cache - Auto-Migration: bestehende appsettings.Production.json wird einmalig in DB übernommen - Alle Services umgestellt: IConfiguration → ServerSettingsService (dynamisch, kein Neustart) - Port bleibt als einziges Setting in appsettings.Production.json (erfordert Neustart) - ServerSettingsEndpoint: liest/schreibt DB statt JSON-Datei, Port als Sonder-Setting - IConfiguration komplett entfernt aus allen Services (ChatService, ToolService, AnthropicService, OpenAiService, KreaService, TelegramService, KeyScannerService, GitHubEventScannerService) - AuthMiddleware: KreaApiKey dynamisch aus DB - appsettings.json bereinigt: nur noch Port und Logging - Dokumentation aktualisiert (ARCHITECTURE.md, ARCHITECTURE_QUICK.md, README.md)
This commit is contained in:
1 parent
542a031172
commit
122000487c
18 files changed
+389
-270
No files matched your search
@@ -15,20 +15,20 @@ public class TelegramService
|
||||
private readonly DatabaseService _db;
|
||||
private readonly ChatService _chatService;
|
||||
private readonly AnthropicService _anthropic;
|
||||
private readonly int _maxIterations;
|
||||
private readonly ServerSettingsService _settings;
|
||||
|
||||
public TelegramService(
|
||||
IHttpClientFactory httpFactory,
|
||||
DatabaseService db,
|
||||
ChatService chatService,
|
||||
AnthropicService anthropic,
|
||||
int maxIterations = 100)
|
||||
ServerSettingsService settings)
|
||||
{
|
||||
_httpFactory = httpFactory;
|
||||
_db = db;
|
||||
_chatService = chatService;
|
||||
_anthropic = anthropic;
|
||||
_maxIterations = maxIterations;
|
||||
_settings = settings;
|
||||
}
|
||||
|
||||
// ── Webhook-Update verarbeiten ──
|
||||
@@ -161,7 +161,7 @@ public class TelegramService
|
||||
|
||||
private async Task HandleMessage(long chatId, string userText, string botToken, string botUserId, SessionRecord session)
|
||||
{
|
||||
var ctx = await _chatService.PrepareContext(session.SessionId, botUserId, _maxIterations);
|
||||
var ctx = await _chatService.PrepareContext(session.SessionId, botUserId, _settings.GetInt("MaxIterations", 100));
|
||||
if (ctx == null)
|
||||
{
|
||||
await SendMessage(chatId, botToken, "❌ Kein Agent konfiguriert. Bitte weise der Session im Web-UI einen Agent zu.");
|
||||
|
||||
Reference in new issue
Block a user