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
@@ -19,21 +19,19 @@ public class AnthropicService
|
||||
private readonly ToolService _toolService;
|
||||
private readonly DatabaseService _db;
|
||||
private readonly MemoryService _memoryService;
|
||||
private readonly bool _payloadLogging;
|
||||
private readonly bool _payloadLoggingGzip;
|
||||
private readonly ServerSettingsService _settings;
|
||||
private readonly VectorSearchService _vectorSearch;
|
||||
private readonly EmbeddingBackgroundService _embeddingBg;
|
||||
private ChatService _chatService;
|
||||
private TelegramService _telegramService;
|
||||
|
||||
public AnthropicService(IHttpClientFactory httpFactory, ToolService toolService, DatabaseService db, MemoryService memoryService = null, bool payloadLogging = false, bool payloadLoggingGzip = false, VectorSearchService vectorSearch = null, EmbeddingBackgroundService embeddingBg = null)
|
||||
public AnthropicService(IHttpClientFactory httpFactory, ToolService toolService, DatabaseService db, MemoryService memoryService = null, ServerSettingsService settings = null, VectorSearchService vectorSearch = null, EmbeddingBackgroundService embeddingBg = null)
|
||||
{
|
||||
_httpFactory = httpFactory;
|
||||
_toolService = toolService;
|
||||
_db = db;
|
||||
_memoryService = memoryService;
|
||||
_payloadLogging = payloadLogging;
|
||||
_payloadLoggingGzip = payloadLoggingGzip;
|
||||
_settings = settings;
|
||||
_vectorSearch = vectorSearch;
|
||||
_embeddingBg = embeddingBg;
|
||||
}
|
||||
@@ -1201,7 +1199,7 @@ public class AnthropicService
|
||||
|
||||
private void LogPayload(string json, string sessionId, string chainId, int iteration)
|
||||
{
|
||||
if (!_payloadLogging) return;
|
||||
if (_settings == null || !_settings.GetBool("PayloadLogging", false)) return;
|
||||
try
|
||||
{
|
||||
var logsDir = Path.Combine(AppContext.BaseDirectory, "data", "logs");
|
||||
@@ -1209,7 +1207,7 @@ public class AnthropicService
|
||||
var timestamp = DateTimeOffset.UtcNow.ToUnixTimeSeconds();
|
||||
var baseName = $"{timestamp}-{sessionId}-{chainId}-iter{iteration}-payload";
|
||||
|
||||
if (_payloadLoggingGzip)
|
||||
if (_settings?.GetBool("PayloadLoggingGzip", false) ?? false)
|
||||
{
|
||||
var filePath = Path.Combine(logsDir, baseName + ".json.gz");
|
||||
using var fs = File.Create(filePath);
|
||||
|
||||
Reference in new issue
Block a user