feat: GitHub Code Search als Agent-Tool + Dashboard-Badges

- UseGitHubSearch Property im AgentRecord (Default: false)
- DB-Migration: use_github_search Spalte in agents
- Checkbox im Agent-Formular (Standard: unchecked)
- Tool nur aktiv wenn Agent-Checkbox UND GitHubToken konfiguriert
- includeGitHubSearch Parameter durch StreamChat/AddToolsToPayload
- Dashboard-Badges: 🔮 Auto-Kontext + 🐙 GitHub Search
This commit is contained in:
Meleki committed 2026-03-13 08:26:15 +01:00
1 parent bca5e5145a
commit 89122e2170
10 files changed
+22 -8

No files matched your search

+3 -3
View File
@@ -96,6 +96,7 @@ public class AnthropicService
bool allowUserChoice = true,
bool planMode = false,
bool useAutoContext = true,
bool useGitHubSearch = false,
CancellationToken workCt = default,
CancellationToken hardCt = default,
CancellationToken sseCt = default,
@@ -177,7 +178,7 @@ public class AnthropicService
payload["system"] = systemPrompt;
var hasRemote = remoteMgr?.GetBySessionId(sessionId) != null;
AddToolsToPayload(payload, workspace, agentId, useMemory, webSearchVersion, toolChoice, iterations, allowUserChoice, planMode, includeRemote: hasRemote);
AddToolsToPayload(payload, workspace, agentId, useMemory, webSearchVersion, toolChoice, iterations, allowUserChoice, planMode, includeRemote: hasRemote, includeGitHubSearch: useGitHubSearch && _toolService.HasGitHubToken);
var client = CreateClient();
var json = JsonSerializer.Serialize(payload, new JsonSerializerOptions { WriteIndented = true });
@@ -1619,13 +1620,12 @@ public class AnthropicService
/// <summary>
/// Fügt Tool-Definitionen und WebSearch zum Payload hinzu.
/// </summary>
private void AddToolsToPayload(Dictionary<string, object> payload, string workspace, string agentId, bool useMemory, string webSearchVersion, string toolChoice, int iteration, bool allowUserChoice = false, bool planMode = false, bool includeRemote = false)
private void AddToolsToPayload(Dictionary<string, object> payload, string workspace, string agentId, bool useMemory, string webSearchVersion, string toolChoice, int iteration, bool allowUserChoice = false, bool planMode = false, bool includeRemote = false, bool includeGitHubSearch = false)
{
var hasWorkspace = !string.IsNullOrEmpty(workspace);
var includeMemory = useMemory && _memoryService != null && !string.IsNullOrEmpty(agentId);
var includeMemorySearch = _vectorSearch != null && _vectorSearch.GetEmbeddingCount() > 0;
var includeSendToSession = _db != null && _chatService != null;
var includeGitHubSearch = _toolService.HasGitHubToken;
var hasTools = hasWorkspace || includeMemory || includeRemote || includeMemorySearch || includeSendToSession || includeGitHubSearch;
var hasWebSearch = !string.IsNullOrEmpty(webSearchVersion);