User-spezifische API-Key-Auswahl, globales is_active entfernt
Backend:
- is_active komplett entfernt, durch is_public (Admin-Toggle) ersetzt
- Neues selected_api_key_id auf users-Tabelle
- AnthropicService: globaler _token entfernt, apiToken pro Request
- Token-Durchreichung: StreamChat → ProcessStream → RunAgentChat →
RunPreparer/RunReview/RunFinalizer, ExecuteTool, send_to_session
- ChatEndpoint: User-Key aus DB laden, an StreamChat übergeben
- TelegramService: Key per bot.UserId auflösen
- CronjobService: Key per job.UserId auflösen
- Neue Endpoints: GET /api/api-keys/available, PUT /api/api-keys/select/{keyId},
GET /api/api-keys/selected, PUT /api/admin/api-keys/{keyId}/public,
POST /api/admin/api-keys/check-all
- Program.cs: AnthropicService ohne Token-Parameter
Frontend:
- API-Keys-Page: Public-Toggle (Globe/Lock) statt Activate/Deactivate
- Alle prüfen Button für Batch-Key-Check
- Chat: Key-Auswahl für alle User (nicht nur Admin)
- Dummy-Badge wenn kein Key ausgewählt
- Fallback-Badge bei Key ohne Usage-Daten
- Key-Switch-Modal: apiGetAvailableKeys + apiSelectApiKey
This commit is contained in:
1 parent
cc46cf2bbc
commit
dde0fede7d
18 files changed
+340
-193
No files matched your search
@@ -7,7 +7,7 @@ public class ApiKeyRecord
|
||||
public string Provider { get; set; } // anthropic, gemini, openai, ...
|
||||
public string Name { get; set; } // Anzeigename z.B. "Tausi Pro Key"
|
||||
public string ApiKey { get; set; } // Der eigentliche Key
|
||||
public bool IsActive { get; set; } // Nur einer pro Provider aktiv
|
||||
public bool IsPublic { get; set; } // Für alle User sichtbar/auswählbar
|
||||
public string Status { get; set; } // ok, invalid, rate_limited, quota_exceeded, error
|
||||
public string Plan { get; set; } // Pro, Max, Pro/Max, API Console, Unknown
|
||||
public double? Usage7d { get; set; }
|
||||
|
||||
@@ -21,6 +21,7 @@ public class ChatContext
|
||||
public AgentRecord Agent { get; set; }
|
||||
public SessionRecord Session { get; set; }
|
||||
public bool PlanMode { get; set; }
|
||||
public string ApiToken { get; set; }
|
||||
|
||||
// Preparer-Agent (vor dem Worker)
|
||||
public SubAgentContext Preparer { get; set; }
|
||||
|
||||
@@ -13,6 +13,7 @@ public class UserRecord
|
||||
public string Persona { get; set; }
|
||||
public string Settings { get; set; }
|
||||
public string DefaultPath { get; set; }
|
||||
public string SelectedApiKeyId { get; set; }
|
||||
|
||||
public string GetEffectivePersona()
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user