docs: Dokumentation an aktuellen Code-Stand anpassen
Neue Features dokumentiert: Claude CLI Integration, DB Explorer, MCP-Server (Internal API), Key-Scanner-System (KeyPatterns, KeyCheckDispatcher, GitHubEventScannerService), Multi-Provider Key-Checker (OpenAI, Google, Stripe), AnthropicService partial-class Aufteilung, 2 neue Tools (github_code_search, serper_web_search → 19 Tools), OpenAI als Provider, typing-phrases.js, AppPaths, payload-preview Endpoint. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
1 parent
d1c8aa62f2
commit
486a1be6b5
3 files changed
+239
-64
No files matched your search
+194
-45
@@ -1,6 +1,6 @@
|
||||
# ARCHITECTURE.md – Gott
|
||||
|
||||
**Gott** ist eine selbst-gehostete AI-Chat-Plattform, gebaut auf **.NET 10** mit **Anthropic Claude API** als Haupt-Provider sowie **OpenAI-kompatiblen Providern** (Nvidia, Pollinations, Gemini). Sie bietet Multi-User-Support, persistente Agent-Memory, 17 Tools (Dateien, Shell, Suche, Memory, Remote-Execution), semantische Suche via lokalen Embeddings, Telegram-Integration, Cronjobs, Remote-Verbindungen und eine Krea-Bildgenerierung – alles über ein Vanilla-JavaScript-Frontend gesteuert.
|
||||
**Gott** ist eine selbst-gehostete AI-Chat-Plattform, gebaut auf **.NET 10** mit **Anthropic Claude API** als Haupt-Provider (inkl. Claude CLI-Integration) sowie **OpenAI-kompatiblen Providern** (Nvidia, Pollinations, Gemini, OpenAI). Sie bietet Multi-User-Support, persistente Agent-Memory, 19 Tools (Dateien, Shell, Suche, Memory, Remote-Execution, Web-Search, GitHub Code Search), semantische Suche via lokalen Embeddings, Telegram-Integration, Cronjobs, Remote-Verbindungen, Krea-Bildgenerierung und einen Multi-Provider Key-Scanner – alles über ein Vanilla-JavaScript-Frontend gesteuert.
|
||||
|
||||
---
|
||||
|
||||
@@ -33,18 +33,23 @@
|
||||
19. [Multi-Agent System (Preparer + Review + Finalizer)](#multi-agent-system-preparer--review--finalizer)
|
||||
20. [Interaktive Rückfragen (ask_user_choice)](#interaktive-rückfragen-ask_user_choice)
|
||||
21. [Plan-Modus](#plan-modus)
|
||||
22. [Nachrichten teilen (Shared Messages)](#nachrichten-teilen-shared-messages)
|
||||
23. [Workspace & File-Explorer](#workspace--file-explorer)
|
||||
24. [Avatar-System](#avatar-system)
|
||||
25. [LaTeX/Math-Rendering](#latexmath-rendering)
|
||||
26. [Windows Desktop App](#windows-desktop-app)
|
||||
27. [OpenClaw Import](#openclaw-import)
|
||||
28. [Remote-Verbindungen](#remote-verbindungen)
|
||||
29. [Semantische Suche (Embedding)](#semantische-suche-embedding)
|
||||
30. [API-Key-Verwaltung](#api-key-verwaltung)
|
||||
31. [Deployment](#deployment)
|
||||
32. [Konfiguration](#konfiguration)
|
||||
33. [Datenbank-Migrationen](#datenbank-migrationen)
|
||||
22. [Web-Search](#web-search)
|
||||
23. [Nachrichten teilen (Shared Messages)](#nachrichten-teilen-shared-messages)
|
||||
24. [Workspace & File-Explorer](#workspace--file-explorer)
|
||||
25. [Avatar-System](#avatar-system)
|
||||
26. [LaTeX/Math-Rendering](#latexmath-rendering)
|
||||
27. [Windows Desktop App](#windows-desktop-app)
|
||||
28. [OpenClaw Import](#openclaw-import)
|
||||
29. [Remote-Verbindungen](#remote-verbindungen)
|
||||
30. [Semantische Suche (Embedding)](#semantische-suche-embedding)
|
||||
31. [API-Key-Verwaltung](#api-key-verwaltung)
|
||||
32. [Key-Scanner-System](#key-scanner-system)
|
||||
33. [Claude CLI Integration](#claude-cli-integration)
|
||||
34. [Datenbank-Explorer](#datenbank-explorer)
|
||||
35. [MCP-Server-Integration (Internal API)](#mcp-server-integration-internal-api)
|
||||
36. [Deployment](#deployment)
|
||||
37. [Konfiguration](#konfiguration)
|
||||
38. [Datenbank-Migrationen](#datenbank-migrationen)
|
||||
|
||||
---
|
||||
|
||||
@@ -61,20 +66,23 @@
|
||||
│ Auth │ Chat │ Hist │ Sess │Agent │ Tele │ Cron │ Krea │Adm │
|
||||
│ │ SSE │ │ │ │ gram │ jobs │ Img │ in │
|
||||
│ │ │ │ │ │ │ │ │Keys│
|
||||
│ │ CLI │ │ │ │ │ │ │DbEx│
|
||||
├──────┴──────┴──────┴──────┴──────┴──────┴──────┴──────┴────┤
|
||||
│ Services Layer │
|
||||
│ AnthropicService · OpenAiService · ChatService · ToolService│
|
||||
│ DatabaseService · MemoryService · SkillService · SseHelper │
|
||||
│ EmbeddingService · VectorSearchService │
|
||||
│ ClaudeCliService · DatabaseService · MemoryService · SkillService│
|
||||
│ SseHelper · EmbeddingService · VectorSearchService │
|
||||
│ RemoteConnectionManager · TelegramService │
|
||||
│ CronjobService · KreaService │
|
||||
│ CronjobService · KreaService · KeyCheckDispatcher │
|
||||
│ KeyScannerService · GitHubEventScannerService │
|
||||
├─────────────────────────────────────────────────────────────┤
|
||||
│ SQLite (data/gott.db) via Dapper │
|
||||
│ ONNX Runtime (Embeddings) │
|
||||
│ Filesystem (data/agents/, data/skills/) │
|
||||
├─────────────────────────────────────────────────────────────┤
|
||||
│ Anthropic Claude API (claude-sonnet/opus/haiku) │
|
||||
│ OpenAI-kompatible APIs (Nvidia, Pollinations, Gemini) │
|
||||
│ Claude CLI (OAuth-basiert, kein API-Key nötig) │
|
||||
│ OpenAI-kompatible APIs (Nvidia, Pollinations, Gemini, OpenAI) │
|
||||
│ Krea API (Bildgenerierung) │
|
||||
│ Telegram Bot API │
|
||||
└─────────────────────────────────────────────────────────────┘
|
||||
@@ -89,7 +97,7 @@
|
||||
| **Runtime** | .NET 10 (ohne Nullable, ohne Implicit Usings) |
|
||||
| **Web** | ASP.NET Minimal API, Kestrel |
|
||||
| **Datenbank** | SQLite via Microsoft.Data.Sqlite + Dapper |
|
||||
| **AI** | Anthropic Claude API (Streaming SSE + Non-Streaming), OpenAI-kompatible APIs (Nvidia, Pollinations, Gemini) |
|
||||
| **AI** | Anthropic Claude API (Streaming SSE + Non-Streaming), Claude CLI (OAuth), OpenAI-kompatible APIs (Nvidia, Pollinations, Gemini, OpenAI) |
|
||||
| **Images** | SixLabors.ImageSharp (Resize, Thumbnails) |
|
||||
| **Cron** | Cronos (Cron-Expression-Parsing) |
|
||||
| **Frontend** | Vanilla JavaScript SPA (kein Framework) |
|
||||
@@ -136,10 +144,14 @@ gott/
|
||||
│ ├── DatabaseService.Integrations.cs # Telegram, Cronjobs, API Keys, OpenClaw Import
|
||||
│ ├── AuthService.cs # Token-basierte Authentifizierung
|
||||
│ ├── ChatService.cs # Kontext-Aufbau, History-Builder
|
||||
│ ├── AnthropicService.cs # Claude API (Streaming + Non-Streaming)
|
||||
│ ├── OpenAiService.cs # OpenAI-kompatible Provider (Nvidia, Pollinations, Gemini)
|
||||
│ ├── AnthropicService.cs # Claude API – Haupt-Service (partial class)
|
||||
│ ├── AnthropicService.Streaming.cs # Claude API – Streaming-Logic (StreamChat)
|
||||
│ ├── AnthropicService.Agents.cs # Claude API – Sub-Agent-Logic (Preparer, Review, Finalizer)
|
||||
│ ├── AnthropicService.Cli.cs # Claude API – CLI-basiertes Streaming (StreamChatViaCli)
|
||||
│ ├── ClaudeCliService.cs # Claude Code CLI Wrapper (OAuth-basiert, kein API-Key nötig)
|
||||
│ ├── OpenAiService.cs # OpenAI-kompatible Provider (Nvidia, Pollinations, Gemini, OpenAI)
|
||||
│ ├── SseHelper.cs # Shared SSE-Utilities (WriteSseEvent, TryWriteSse, FinalizeChain)
|
||||
│ ├── ToolService.cs # Tool-Definitionen + Ausführung (17 Tools)
|
||||
│ ├── ToolService.cs # Tool-Definitionen + Ausführung (19 Tools)
|
||||
│ ├── SystemPromptBuilder.cs # Modularer System-Prompt aus Blöcken
|
||||
│ ├── MemoryService.cs # Agent-Gedächtnis (Dateisystem)
|
||||
│ ├── SkillService.cs # Skill-Verwaltung (Dateisystem)
|
||||
@@ -152,28 +164,37 @@ gott/
|
||||
│ ├── KreaService.cs # Krea Image Generation API
|
||||
│ ├── ImageService.cs # Bild-Resize + WebP-Konvertierung (512px + 256px Thumbnail)
|
||||
│ ├── StreamingTracker.cs # Tracking aktiver Streams + CancellationTokenSource für Stop
|
||||
│ ├── WorkspaceHelper.cs # Workspace-Pfad-Auflösung (relativ → absolut)
|
||||
│ ├── WorkspaceHelper.cs # Workspace-Pfad-Auflösung (relativ → absolut)
|
||||
│ ├── AppPaths.cs # Zentrale Pfade (WwwRoot) – Dev vs. Publish-Modus
|
||||
│ ├── KeyScannerService.cs # API-Key-Scanner (GitHub Code Search, GitHub Issues/PRs, HuggingFace Hub, Google/Serper)
|
||||
│ ├── GitHubEventScannerService.cs # Echtzeit-Scanner: GitHub Public Events API (PushEvent-Diffs nach Keys scannen)
|
||||
│ ├── KeyPatterns.cs # Zentrale Key-Pattern-Definitionen für alle Scanner (Regex + Typ-Erkennung)
|
||||
│ ├── KeyCheckDispatcher.cs # Zentraler Dispatcher für Key-Checks aller Provider (normalisiertes Ergebnis)
|
||||
│ ├── AnthropicKeyChecker.cs # Anthropic Key-Validierung + Usage-Header-Auswertung
|
||||
│ ├── OpenAiKeyChecker.cs # OpenAI Key-Validierung (Models-Endpoint, Rate-Limits)
|
||||
│ ├── GoogleKeyChecker.cs # Google/Gemini Key-Validierung (Models + Quota-Check)
|
||||
│ ├── StripeKeyChecker.cs # Stripe Key-Validierung (Balance, Account-Info)
|
||||
│ └── ServerSettingsService.cs # Server-Settings Verwaltung (In-Memory-Cache + DB)
|
||||
│
|
||||
├── Endpoints/ # HTTP API (Minimal API)
|
||||
│ ├── AuthEndpoint.cs # Login, Logout, Me
|
||||
│ ├── ChatEndpoint.cs # POST /api/chat (SSE Streaming)
|
||||
│ ├── HistoryEndpoint.cs # History, Archive, Attachments, Marks
|
||||
│ ├── SessionEndpoint.cs # CRUD + SystemPrompt, Exec, Git-Status
|
||||
│ ├── AgentEndpoint.cs # CRUD
|
||||
│ ├── WorkspaceEndpoint.cs # File-Tree, File-Read/Write, Browse, Agent-Files
|
||||
│ ├── AuthEndpoint.cs # Login, Logout, Me, Autologin
|
||||
│ ├── ChatEndpoint.cs # POST /api/chat (SSE Streaming + CLI-Fallback)
|
||||
│ ├── HistoryEndpoint.cs # History, Archive, Attachments, Marks, Chain-Details
|
||||
│ ├── SessionEndpoint.cs # CRUD + SystemPrompt, SystemPromptBlocks, PayloadPreview, Streaming, Exec, Git-Status
|
||||
│ ├── AgentEndpoint.cs # CRUD + Available (inkl. public agents)
|
||||
│ ├── WorkspaceEndpoint.cs # File-Tree, File-Read/Write, Browse, Agent-Files, Raw-Download
|
||||
│ ├── TelegramEndpoint.cs # Bot-CRUD, Webhook, Session-Config, Registration
|
||||
│ ├── OpenClawEndpoint.cs # OpenClaw Session Import
|
||||
│ ├── OpenClawEndpoint.cs # OpenClaw Session Import
|
||||
│ ├── CronjobEndpoint.cs # CRUD + Toggle, Manual Run
|
||||
│ ├── KreaEndpoint.cs # Generate, List, File-Serve
|
||||
│ ├── SkillEndpoint.cs # List, Agent-Skill-Mapping, Output-Files
|
||||
│ ├── ModelsEndpoint.cs # Provider-Modelle (nvidia, pollinations, gemini, refresh)
|
||||
│ ├── ModelsEndpoint.cs # Provider-Modelle (nvidia, pollinations, gemini, openai, refresh)
|
||||
│ ├── SharedEndpoint.cs # Nachrichten teilen (öffentliche Links)
|
||||
│ ├── AdminEndpoint.cs # Admin: User-CRUD, Impersonate (Admin-only)
|
||||
│ ├── ApiKeysEndpoint.cs # Admin: API-Key-CRUD, Activate/Deactivate, Check, Scan, Adopt (Admin-only)
|
||||
│ ├── AdminEndpoint.cs # Admin: User-CRUD, Impersonate, Login-Link (Admin-only)
|
||||
│ ├── ApiKeysEndpoint.cs # Admin: API-Key-CRUD, Check, CheckAll, Scan, Event-Scanner, Adopt + User: Available, Select (Admin-only / User)
|
||||
│ ├── RemoteEndpoint.cs # Remote-Verbindungen: WebSocket, Assign/Unassign, PowerShell-Script
|
||||
│ ├── InternalEndpoint.cs # Interne API für MCP-Server (Remote-Execute, Ask-User-Choice, Memory-CRUD, Token-gesichert)
|
||||
│ ├── DatabaseExplorerEndpoint.cs # Admin: DB-Tabellen lesen (Tables, TableData) (Admin-only)
|
||||
│ ├── ServerSettingsEndpoint.cs # Admin: Server-Settings lesen/schreiben (Admin-only)
|
||||
│ ├── ProfileEndpoint.cs # Profil, Persona, Passwort
|
||||
│ ├── SettingsEndpoint.cs # User-Settings (JSON blob)
|
||||
@@ -236,17 +257,20 @@ gott/
|
||||
│ │ ├── emoji.userdata.js # Häufig genutzte Emojis
|
||||
│ │ ├── tooltip.js # Tooltip-System
|
||||
│ │ ├── title.js # Tab-Titel-Management + Embedding-Warnung
|
||||
│ │ ├── typing-phrases.js # Zufällige Typing-Indicator-Texte (Wienerisch)
|
||||
│ │ ├── pages/ # Seiten-Komponenten
|
||||
│ │ │ ├── chat-page.js # Haupt-Chat-Ansicht (inkl. Remote-Button, Usage-Badge-Overlay, Key-Switch-Modal)
|
||||
│ │ │ ├── dashboard.js # Dashboard / Home (inkl. API-Keys-Link)
|
||||
│ │ │ ├── dashboard.js # Dashboard / Home (inkl. API-Keys-Link, DB-Explorer-Link)
|
||||
│ │ │ ├── session-page.js # Session-Einstellungen
|
||||
│ │ │ ├── agent-page.js # Agent-Editor
|
||||
│ │ │ ├── telegram-bot-page.js # Telegram-Bot-Editor
|
||||
│ │ │ ├── cronjob-page.js # Cronjob-Verwaltung
|
||||
│ │ │ ├── profile-page.js # Profil-Bearbeitung
|
||||
│ │ │ ├── admin-page.js # Admin: Benutzerverwaltung
|
||||
│ │ │ ├── api-keys-page.js # Admin: API-Key-Verwaltung + Check + GitHub-Scanner
|
||||
│ │ │ ├── api-keys-page.js # Admin: API-Key-Verwaltung + Check + GitHub-Scanner + Event-Scanner
|
||||
│ │ │ ├── db-explorer-page.js # Admin: Datenbank-Explorer (Tabellen + Daten)
|
||||
│ │ │ ├── settings-page.js # App-Einstellungen
|
||||
│ │ │ ├── server-settings-page.js # Admin: Servereinstellungen
|
||||
│ │ │ ├── login-page.js # Login-Formular
|
||||
│ │ │ └── shared-page.js # Öffentliche geteilte Nachricht
|
||||
│ │ └── lib/ # Vendor-Libraries
|
||||
@@ -404,9 +428,9 @@ RemoteConnectionManager → AuthService → DatabaseService → EnsureDefaultUse
|
||||
→ ImageService, StreamingTracker, MemoryService, SkillService
|
||||
→ EmbeddingService → VectorSearchService
|
||||
→ ToolService → ChatService
|
||||
→ AnthropicService (Token aus DB: api_keys) → OpenAiService (+ LoadModelsAsync)
|
||||
→ AnthropicService (Token aus DB: api_keys) → ClaudeCliService → OpenAiService (+ LoadModelsAsync)
|
||||
→ TelegramService → KreaService
|
||||
→ CronjobService (BackgroundService) + EmbeddingBackgroundService (BackgroundService)
|
||||
→ CronjobService (BackgroundService) + EmbeddingBackgroundService (BackgroundService) + GitHubEventScannerService (BackgroundService)
|
||||
```
|
||||
|
||||
### Services
|
||||
@@ -416,10 +440,12 @@ RemoteConnectionManager → AuthService → DatabaseService → EnsureDefaultUse
|
||||
| `DatabaseService` | Singleton | SQLite CRUD, Schema-Init, Migrationen, alle DB-Operationen |
|
||||
| `AuthService` | Singleton | Token-Erzeugung/-Validierung, Passwort-Hashing (SHA256) |
|
||||
| `ChatService` | Singleton | Chat-Kontext aufbauen, History aus DB rekonstruieren |
|
||||
| `AnthropicService` | Singleton | Claude API Kommunikation (Streaming SSE + Non-Streaming), passive Usage-Aktualisierung nach jedem Request |
|
||||
| `OpenAiService` | Singleton | OpenAI-kompatible Provider (Nvidia, Pollinations, Gemini) mit Tool-Calling, Streaming + Non-Streaming, Modell-Caching |
|
||||
| `ToolService` | Singleton | Tool-Definitionen bereitstellen, Tool-Aufrufe ausführen |
|
||||
| `AnthropicService` | Singleton | Claude API Kommunikation (partial class: Core, Streaming, Agents, Cli), passive Usage-Aktualisierung nach jedem Request |
|
||||
| `ClaudeCliService` | Singleton | Claude Code CLI Wrapper (OAuth-basiert, kein API-Key nötig), prüft CLI-Verfügbarkeit beim Start |
|
||||
| `OpenAiService` | Singleton | OpenAI-kompatible Provider (Nvidia, Pollinations, Gemini, OpenAI) mit Tool-Calling, Streaming + Non-Streaming, Modell-Caching |
|
||||
| `ToolService` | Singleton | Tool-Definitionen bereitstellen, Tool-Aufrufe ausführen (19 Tools) |
|
||||
| `WorkspaceHelper` | Static | Workspace-Pfad-Auflösung (relativ → absolut), Path-Traversal-Schutz |
|
||||
| `AppPaths` | Static | Zentrale Pfade (WwwRoot), Dev-Modus vs. Publish-Modus Erkennung |
|
||||
| `SystemPromptBuilder` | Static | Modularer System-Prompt aus konfigurierbaren Blöcken + Reminder-Generierung |
|
||||
| `MemoryService` | Singleton | Agent-Gedächtnis auf Dateisystem (MEMORY.md, IDENTITY.md etc.) |
|
||||
| `SkillService` | Singleton | Skill-Discovery und -Management aus Dateisystem |
|
||||
@@ -434,7 +460,13 @@ RemoteConnectionManager → AuthService → DatabaseService → EnsureDefaultUse
|
||||
| `ImageService` | Singleton | Bild-Resize + WebP-Konvertierung (512px + 256px Thumbnail) für Avatare und Session-Bilder |
|
||||
| `StreamingTracker` | Singleton | Trackt aktive Streams + CancellationTokenSource pro Session für Stop-Button |
|
||||
| `KeyScannerService` | Singleton | API-Key-Scanner (GitHub Code Search, GitHub Issues/PRs, HuggingFace Hub, Google/Serper), täglicher Scan |
|
||||
| `GitHubEventScannerService` | Background | Echtzeit-Scanner: GitHub Public Events API (PushEvent-Diffs nach geleakten Keys), 30s Poll-Intervall |
|
||||
| `KeyPatterns` | Static | Zentrale Key-Pattern-Definitionen für alle Scanner (Regex, Typ-Erkennung, Display-Names) |
|
||||
| `KeyCheckDispatcher` | Static | Zentraler Dispatcher für Key-Checks aller Provider, normalisiertes UnifiedKeyCheckResult |
|
||||
| `AnthropicKeyChecker` | Static | Anthropic Key-Validierung via API-Request, Usage-Header-Auswertung (Plan, 7d/5h Usage) |
|
||||
| `OpenAiKeyChecker` | Static | OpenAI Key-Validierung (GET /v1/models, Rate-Limits, Organization) |
|
||||
| `GoogleKeyChecker` | Static | Google/Gemini Key-Validierung (Models-Listing + Quota-Check via GenerateContent) |
|
||||
| `StripeKeyChecker` | Static | Stripe Key-Validierung (Balance, Account-Info, Payouts/Charges) |
|
||||
| `ServerSettingsService` | Singleton | Server-Settings Verwaltung (In-Memory-Cache + DB), Cleanup obsoleter Settings |
|
||||
|
||||
### Endpoints (API)
|
||||
@@ -446,8 +478,8 @@ Alle Endpoints folgen dem **Minimal API**-Pattern mit Extension Methods (`MapXxx
|
||||
| **Auth** | `/api/auth/` | `POST login`, `POST logout`, `GET me`, `GET autologin` |
|
||||
| **Chat** | `/api/chat` | `POST` (SSE Streaming), `POST stop` |
|
||||
| **History** | `/api/history` | `GET history`, `GET poll`, `POST archive`, `GET archives`, `GET archive/{id}`, `GET attachments/{id}`, `PUT messages/{id}/mark`, `PUT messages/{id}/delete`, `GET chains/{id}` |
|
||||
| **Sessions** | `/api/sessions/` | CRUD + `GET system-prompt`, `GET system-prompt-blocks`, `GET streaming`, `POST exec`, `GET git-status` (Liste inkl. inline Git-Status + Thumbnail) |
|
||||
| **Agents** | `/api/agents/` | CRUD (Liste inkl. inline Skills + Thumbnail) |
|
||||
| **Sessions** | `/api/sessions/` | CRUD + `GET system-prompt`, `GET system-prompt-blocks`, `GET payload-preview`, `GET streaming`, `POST exec`, `GET git-status` (Liste inkl. inline Git-Status + Thumbnail) |
|
||||
| **Agents** | `/api/agents/` | CRUD + `GET available` (inkl. public agents, inline Skills + Thumbnail) |
|
||||
| **Admin** | `/api/admin/` | `GET users`, `POST users`, `PUT users/{id}`, `PUT users/{id}/password`, `DELETE users/{id}`, `POST users/{id}/impersonate`, `POST users/{id}/login-link` (Admin-only) |
|
||||
| **Workspace** | `/api/workspace/` | `GET tree`, `GET/PUT file`, `GET browse`, `POST mkdir`, `DELETE dir`, `POST browse/mkdir`, `GET agent/tree`, `GET/PUT agent/file`, `POST agent/mkdir`, `GET raw` |
|
||||
| **Telegram** | `/api/telegram/` | Bot-CRUD (`/bots`, `/bots/available`), `POST webhook/{botId}` (unauthenticated), Session-Config, Webhook-Management |
|
||||
@@ -459,9 +491,11 @@ Alle Endpoints folgen dem **Minimal API**-Pattern mit Extension Methods (`MapXxx
|
||||
| **Settings** | `/api/settings` | `GET`, `PUT` |
|
||||
| **Backup** | `/api/backup` | `POST` (Admin only, tar.gz Download) |
|
||||
| **Shared** | `/api/shared/`, `/api/messages/{id}/share` | Share erstellen, öffentlich abrufen, auflisten, löschen |
|
||||
| **Models** | `/api/models/` | `GET nvidia`, `GET pollinations`, `GET gemini`, `POST refresh` |
|
||||
| **API Keys** | `/api/admin/api-keys/` | CRUD + `PUT activate/deactivate`, `POST check`, `POST scan`, `GET scan/status`, `GET scanned`, `POST scanned/{id}/adopt`, `POST scanned/{id}/recheck`, `DELETE scanned/{id}` (Admin-only) |
|
||||
| **Models** | `/api/models/` | `GET nvidia`, `GET pollinations`, `GET gemini`, `GET openai`, `POST refresh` |
|
||||
| **API Keys** | `/api/admin/api-keys/` | CRUD + `PUT {id}/public`, `POST check`, `POST check-all`, `POST scan`, `GET scan/status`, `GET scanned`, `GET scanned/summary`, `POST scanned/recheck-all`, `POST scanned/{id}/recheck`, `POST scanned/{id}/adopt`, `DELETE scanned/{id}`, `GET event-scanner/status`, `GET event-scanner/log`, `GET scanner/logs` (Admin) + `/api/api-keys/` `GET available`, `PUT select/{keyId}`, `GET selected` (User) |
|
||||
| **Remote** | `/api/remote` | WebSocket-Endpoint für Remote-Clients, `GET connections`, `POST assign/unassign`, `GET /remote.ps1` |
|
||||
| **Internal** | `/api/internal/` | `POST remote-execute`, `POST ask-user-choice`, `POST memory-read/write/list` (Token-gesichert für MCP-Server) + `POST /api/chat/choice-respond` (normale Auth) |
|
||||
| **DB Explorer** | `/api/admin/db/` | `GET tables`, `GET tables/{name}` (Admin-only) |
|
||||
| **Info** | `/api/info` | `GET` (Build-Zeitstempel + Embedding-Verfügbarkeit) |
|
||||
| **ServerSettings** | `/api/admin/server-settings` | `GET`, `PUT` (Admin-only, liest/schreibt `appsettings.Production.json`) |
|
||||
|
||||
@@ -523,6 +557,8 @@ Das Frontend ist eine **Single-Page Application** ohne Build-Step, komplett in V
|
||||
| `#/profile` | `profile-page.js` | Profil |
|
||||
| `#/settings` | `settings-page.js` | App-Einstellungen |
|
||||
| `#/admin` | `admin-page.js` | Benutzerverwaltung (Admin-only) |
|
||||
| `#/api-keys` | `api-keys-page.js` | API-Key-Verwaltung + GitHub-Scanner + Event-Scanner (Admin) |
|
||||
| `#/db-explorer` | `db-explorer-page.js` | Datenbank-Explorer (Admin-only) |
|
||||
| `#/server-settings` | `server-settings-page.js` | Servereinstellungen (Admin-only) |
|
||||
| `#/login` | `login-page.js` | Login |
|
||||
| `#/shared/{token}` | `shared-page.js` | Öffentliche geteilte Nachricht (kein Auth) |
|
||||
@@ -546,6 +582,7 @@ Das Frontend ist eine **Single-Page Application** ohne Build-Step, komplett in V
|
||||
- **files.js** – File-Upload, Workspace-Refs
|
||||
- **session.js** – Session-State-Management (currentSessionId, currentAgentId, getCurrentAgentId())
|
||||
- **file-explorer.js** – Workspace File-Explorer Panel (Dateien, Ordner erstellen/löschen, Folder-Browser)
|
||||
- **typing-phrases.js** – Zufällige Typing-Indicator-Texte (Wienerisch/Österreichisch)
|
||||
- **avatar-editor.js** – Wiederverwendbares Avatar-Editor-Modal (Upload, Paste, AI-Generate, Scale)
|
||||
- **commands-ui.js** – Custom-Commands UI-Komponente
|
||||
|
||||
@@ -620,9 +657,9 @@ Der Chat-Flow von User-Input bis zur gerenderten Antwort:
|
||||
3. ChatEndpoint:
|
||||
a) User-Message + Attachments in DB speichern
|
||||
b) ChatService.PrepareContext() → Agent, Model, System-Prompt, Chain
|
||||
c) API-Key auflösen: `GetAgentApiKeyRecord(userId, agentId)` – Anthropic ohne Key → Fehler, OpenAI ohne Key → OK (keyless Provider)
|
||||
c) API-Key auflösen: `GetAgentApiKeyRecord(userId, agentId)` – Anthropic ohne Key → CLI-Fallback oder Fehler, OpenAI ohne Key → OK (keyless Provider)
|
||||
d) ChatService.BuildHistoryFromDb() → vollständige Message-History
|
||||
e) Model-Routing: Anthropic → AnthropicService.StreamChat(), OpenAI-Provider (nvidia:/pollinations:/gemini:) → OpenAiService.StreamChat()
|
||||
e) Model-Routing: Anthropic → AnthropicService.StreamChat() (oder StreamChatViaCli() bei CLI-Modus), OpenAI-Provider (nvidia:/pollinations:/gemini:/openai:) → OpenAiService.StreamChat()
|
||||
↓
|
||||
4. Agentic Loop (AnthropicService oder OpenAiService):
|
||||
┌─────────────────────────────────────────┐
|
||||
@@ -756,6 +793,15 @@ Dieses Tool wird **nicht ausgeführt**, sondern als SSE-Event an den Client weit
|
||||
|
||||
Nutzt Anthropics eingebaute Web-Suche als Server-Side-Tool.
|
||||
|
||||
### GitHub Code Search + Serper Web Search (eigene Tools)
|
||||
|
||||
| Tool | Beschreibung |
|
||||
|-----------------------|-----------------------------------------------------|
|
||||
| `github_code_search` | Durchsucht öffentliche GitHub-Repos nach Code (GitHub Code Search API) |
|
||||
| `serper_web_search` | Internet-Suche via Google (Serper.dev API) |
|
||||
|
||||
Diese Tools werden zusätzlich zur Anthropic Web-Suche bereitgestellt und direkt vom ToolService ausgeführt.
|
||||
|
||||
### Plan-Modus: Read-only Tools
|
||||
|
||||
Im Plan-Modus werden nur folgende Tools bereitgestellt: `read_file`, `list_files`, `glob`, `grep`, `execute`, `todo_write`, `memory_*`, `memory_search`, `remote_execute`, `ask_user_choice`. Write-Tools (`write_file`, `edit_file`, `delete_file`) werden gefiltert.
|
||||
@@ -1831,6 +1877,109 @@ Durchsucht mehrere Quellen nach geleakten API-Keys:
|
||||
|
||||
---
|
||||
|
||||
## Key-Scanner-System
|
||||
|
||||
Das Key-Scanner-System besteht aus drei Komponenten, die zusammenarbeiten:
|
||||
|
||||
### KeyPatterns (static)
|
||||
|
||||
Zentrale Definition aller Key-Patterns (Regex + Suchbegriffe + Typ-Erkennung). Wird von `KeyScannerService` und `GitHubEventScannerService` gemeinsam genutzt.
|
||||
|
||||
**Unterstützte Key-Typen:** Anthropic (OAuth + API), OpenAI (Project + Service + Legacy), Google/Gemini, AWS, GitHub (PAT + OAuth), GitLab, HuggingFace, Stripe (Live + Test), SendGrid, Slack, Krea AI.
|
||||
|
||||
### KeyCheckDispatcher (static)
|
||||
|
||||
Zentraler Dispatcher für Key-Checks aller Provider. Normalisiert die Provider-spezifischen Ergebnisse in ein einheitliches `UnifiedKeyCheckResult` mit standardisiertem DB-Status (`valid`, `invalid`, `rate_limited`, `quota_exceeded`, `error`).
|
||||
|
||||
**Provider-Checker:**
|
||||
| Provider | Checker | Prüfmethode |
|
||||
|----------|---------|-------------|
|
||||
| `anthropic` | `AnthropicKeyChecker` | Minimale API-Anfrage + Usage-Header-Auswertung |
|
||||
| `openai` | `OpenAiKeyChecker` | GET /v1/models + Rate-Limit-Headers |
|
||||
| `google` | `GoogleKeyChecker` | GET /v1/models + Quota-Check (GenerateContent) |
|
||||
| `stripe` | `StripeKeyChecker` | GET /v1/balance + Account-Info |
|
||||
|
||||
### GitHubEventScannerService (BackgroundService)
|
||||
|
||||
Echtzeit-Scanner: Pollt die GitHub Public Events API alle 30 Sekunden, filtert PushEvents und scannt Commit-Diffs nach geleakten API-Keys.
|
||||
|
||||
- **Konfiguration:** `GitHubEventScanner` (bool, aktiviert/deaktiviert), `GitHubToken` (für höhere Rate-Limits)
|
||||
- **Deduplication:** Ringbuffer für Event-IDs (max 10.000)
|
||||
- **Performance:** Max 30 Commit-Diffs pro Poll-Zyklus, Diffs > 100KB werden übersprungen
|
||||
- **Live-Log:** Internes Ringbuffer (max 50 Einträge), abrufbar über `GET /api/admin/api-keys/event-scanner/log`
|
||||
- **Status:** `GET /api/admin/api-keys/event-scanner/status` → isRunning, lastPoll, eventsPerHour
|
||||
|
||||
---
|
||||
|
||||
## Claude CLI Integration
|
||||
|
||||
Die Claude Code CLI kann als alternativer Streaming-Weg verwendet werden (OAuth-basiert, kein API-Key nötig).
|
||||
|
||||
### Architektur
|
||||
|
||||
- **ClaudeCliService** – Wrapper für die Claude Code CLI (`~/.claude/local/claude`). Prüft beim Start ob die CLI verfügbar ist.
|
||||
- **AnthropicService.Cli.cs** – `StreamChatViaCli()`: Streaming-Chat über die CLI statt der HTTP-API. Verwendet das lokale OAuth-Token aus `~/.claude/.credentials.json`.
|
||||
|
||||
### Ablauf
|
||||
|
||||
1. `ChatEndpoint` prüft ob kein API-Key vorhanden und die CLI verfügbar ist
|
||||
2. Bei Verfügbarkeit wird `StreamChatViaCli()` statt `StreamChat()` aufgerufen
|
||||
3. Die CLI wird als Kindprozess gestartet mit JSON-Streaming-Output
|
||||
4. SSE-Events werden identisch zum HTTP-API-Streaming generiert
|
||||
|
||||
### Voraussetzungen
|
||||
|
||||
- Claude Code CLI installiert (`~/.claude/local/claude`)
|
||||
- Gültiges OAuth-Token in `~/.claude/.credentials.json`
|
||||
|
||||
---
|
||||
|
||||
## Datenbank-Explorer
|
||||
|
||||
Admin-only-Feature zum direkten Inspizieren der SQLite-Datenbank über die Web-UI.
|
||||
|
||||
### Backend
|
||||
|
||||
`DatabaseExplorerEndpoint.cs` bietet zwei Endpoints:
|
||||
- `GET /api/admin/db/tables` – Listet alle Tabellen mit Spalten- und Zeilenanzahl
|
||||
- `GET /api/admin/db/tables/{name}` – Liest Tabellendaten (mit Paging: `?limit=100&offset=0`, Sortierung: `?sort=column&order=desc`)
|
||||
|
||||
### Frontend
|
||||
|
||||
`db-explorer-page.js` (`#/db-explorer`) – Admin-only Seite mit klickbarer Tabellenliste und Daten-Grid. Erreichbar über das Dashboard (Button "Datenbank").
|
||||
|
||||
---
|
||||
|
||||
## MCP-Server-Integration (Internal API)
|
||||
|
||||
`InternalEndpoint.cs` stellt eine interne API bereit, die von externen MCP-Servern genutzt werden kann.
|
||||
|
||||
### Authentifizierung
|
||||
|
||||
- Beim Start wird ein einmaliger `InternalToken` generiert (GUID)
|
||||
- Alle `/api/internal/*`-Endpoints erfordern `X-Internal-Token`-Header
|
||||
- Ausnahme: `POST /api/chat/choice-respond` nutzt normale Cookie-Auth
|
||||
|
||||
### Endpoints
|
||||
|
||||
| Endpoint | Funktion |
|
||||
|----------|----------|
|
||||
| `POST /api/internal/remote-execute` | Shell-Befehl auf Remote-Client ausführen (via WebSocket) |
|
||||
| `POST /api/internal/ask-user-choice` | Short-Poll für User-Choice-Antworten (202 = pending, 200 = answered) |
|
||||
| `POST /api/chat/choice-respond` | Frontend: User-Antwort auf Choice-Frage speichern |
|
||||
| `POST /api/internal/memory-read` | Memory-Datei eines Agents lesen |
|
||||
| `POST /api/internal/memory-write` | Memory-Datei schreiben/appenden |
|
||||
| `POST /api/internal/memory-list` | Memory-Dateien eines Agents auflisten |
|
||||
|
||||
### User-Choice-Flow (CLI-Modus)
|
||||
|
||||
1. MCP-Server ruft `ask-user-choice` auf → gibt Frage + Optionen an Frontend
|
||||
2. Frontend zeigt Choice-Buttons
|
||||
3. User klickt → `choice-respond` speichert Antwort
|
||||
4. MCP-Server pollt `ask-user-choice` → erhält Antwort
|
||||
|
||||
---
|
||||
|
||||
## Deployment
|
||||
|
||||
**WICHTIG:** Das Deployment ist ein **manueller Vorgang**, der durch den Benutzer auf dem Server durchgeführt werden muss. Das System führt kein automatisches Deployment durch.
|
||||
|
||||
Reference in new issue
Block a user