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:
Meleki committed 2026-03-14 22:59:33 +01:00
1 parent 1effc6d00f
commit 02f5fe2faf
11 files changed
+422 -69

No files matched your search

+19 -4
View File
@@ -15,6 +15,7 @@ public class TelegramService
private readonly DatabaseService _db;
private readonly ChatService _chatService;
private readonly AnthropicService _anthropic;
private readonly OpenAiService _openAi;
private readonly ServerSettingsService _settings;
public TelegramService(
@@ -22,12 +23,14 @@ public class TelegramService
DatabaseService db,
ChatService chatService,
AnthropicService anthropic,
OpenAiService openAi,
ServerSettingsService settings)
{
_httpFactory = httpFactory;
_db = db;
_chatService = chatService;
_anthropic = anthropic;
_openAi = openAi;
_settings = settings;
}
@@ -197,11 +200,23 @@ public class TelegramService
Content = userText
});
var reply = await _anthropic.ChatNonStreaming(ctx, history, onIteration: async (iteration) =>
string reply;
if (!string.IsNullOrEmpty(ctx.Provider))
{
if (iteration % 3 == 0)
await SendChatAction(chatId, botToken, "typing");
});
reply = await _openAi.ChatNonStreaming(ctx, history, onIteration: async (iteration) =>
{
if (iteration % 3 == 0)
await SendChatAction(chatId, botToken, "typing");
});
}
else
{
reply = await _anthropic.ChatNonStreaming(ctx, history, onIteration: async (iteration) =>
{
if (iteration % 3 == 0)
await SendChatAction(chatId, botToken, "typing");
});
}
await SendLongMessage(chatId, botToken, reply);
}