feat: API Key pro Agent statt pro User
- Neue Tabelle agent_api_keys (user_id, agent_id, key_id) - Migration: bestehende selected_api_key_id auf alle Agents verteilt - Backend: GetAgentApiKeyRecord(userId, agentId) in Chat, Telegram, Cronjobs - Endpoints: select/selected mit ?agentId Query-Parameter - Frontend: currentAgentId aus Session, alle Key-Calls agent-aware - DeleteApiKey bereinigt agent_api_keys statt users.selected_api_key_id
This commit is contained in:
1 parent
b04b1a2cf9
commit
1effc6d00f
10 files changed
+128
-43
No files matched your search
@@ -168,11 +168,11 @@ public class TelegramService
|
||||
return;
|
||||
}
|
||||
|
||||
// API-Key des Bot-Owners auflösen
|
||||
var userApiKey = await _db.GetUserSelectedApiKey(botUserId);
|
||||
// API-Key des Bot-Owners für diesen Agent auflösen
|
||||
var userApiKey = await _db.GetAgentApiKeyRecord(botUserId, ctx.AgentId);
|
||||
if (userApiKey == null)
|
||||
{
|
||||
await SendMessage(chatId, botToken, "❌ Kein API-Key ausgewählt. Der Bot-Besitzer muss im Web-UI einen Key auswählen.");
|
||||
await SendMessage(chatId, botToken, "❌ Kein API-Key für diesen Agent zugewiesen. Der Bot-Besitzer muss im Web-UI einen Key zuweisen.");
|
||||
return;
|
||||
}
|
||||
ctx.ApiToken = userApiKey.ApiKey;
|
||||
|
||||
Reference in new issue
Block a user