Provider-Abstraktion: Agents unterstützen jetzt OpenAI + Anthropic
Backend: - ChatEndpoint: Globaler OpenAI-Fallback entfernt, Key-Check pro Provider - TelegramService/CronjobService: Provider-Weiche statt hardcoded Anthropic - AnthropicService: Preparer/Review/Finalizer sind Provider-aware - OpenAiService: Neue ChatNonStreaming()-Methode für agentic loop - ToolService: send_to_session lädt Key des Ziel-Agents - SubAgentContext: Provider-Feld hinzugefügt - ChatService: BuildSubAgentContext setzt Provider Frontend: - Key-Switch-Modal: 'Kein Key'-Option zum Entfernen der Zuweisung - ApiKeysEndpoint: keyId='none' löscht Key-Zuweisung
This commit is contained in:
1 parent
1effc6d00f
commit
02f5fe2faf
11 files changed
+422
-69
No files matched your search
@@ -15,6 +15,7 @@ public class CronjobService : BackgroundService
|
||||
private readonly DatabaseService _db;
|
||||
private readonly ChatService _chatService;
|
||||
private readonly AnthropicService _anthropicService;
|
||||
private readonly OpenAiService _openAiService;
|
||||
private readonly TelegramService _telegramService;
|
||||
private readonly ILogger<CronjobService> _logger;
|
||||
|
||||
@@ -22,12 +23,14 @@ public class CronjobService : BackgroundService
|
||||
DatabaseService db,
|
||||
ChatService chatService,
|
||||
AnthropicService anthropicService,
|
||||
OpenAiService openAiService,
|
||||
TelegramService telegramService,
|
||||
ILogger<CronjobService> logger)
|
||||
{
|
||||
_db = db;
|
||||
_chatService = chatService;
|
||||
_anthropicService = anthropicService;
|
||||
_openAiService = openAiService;
|
||||
_telegramService = telegramService;
|
||||
_logger = logger;
|
||||
}
|
||||
@@ -109,8 +112,12 @@ public class CronjobService : BackgroundService
|
||||
Content = job.Prompt
|
||||
});
|
||||
|
||||
// Non-Streaming Chat ausführen
|
||||
var responseText = await _anthropicService.ChatNonStreaming(ctx, history);
|
||||
// Non-Streaming Chat ausführen – Provider-Weiche
|
||||
string responseText;
|
||||
if (!string.IsNullOrEmpty(ctx.Provider))
|
||||
responseText = await _openAiService.ChatNonStreaming(ctx, history);
|
||||
else
|
||||
responseText = await _anthropicService.ChatNonStreaming(ctx, history);
|
||||
|
||||
// Session-Timestamp aktualisieren
|
||||
await _db.UpdateSessionTimestamp(job.SessionId);
|
||||
@@ -172,7 +179,11 @@ public class CronjobService : BackgroundService
|
||||
["content"] = new List<object> { new { type = "text", text = summary } }
|
||||
}
|
||||
};
|
||||
var notifyResponse = await _anthropicService.ChatNonStreaming(notifyCtx, notifyHistory);
|
||||
string notifyResponse;
|
||||
if (!string.IsNullOrEmpty(notifyCtx.Provider))
|
||||
notifyResponse = await _openAiService.ChatNonStreaming(notifyCtx, notifyHistory);
|
||||
else
|
||||
notifyResponse = await _anthropicService.ChatNonStreaming(notifyCtx, notifyHistory);
|
||||
|
||||
await _db.UpdateSessionTimestamp(job.NotifySessionId);
|
||||
|
||||
|
||||
Reference in new issue
Block a user