feat: Serper Web Search als Agent-Tool
- ToolService: serper_web_search Tool-Definition + ExecuteSerperWebSearch() Google-Suche via Serper.dev API mit Titel, Link, Snippet Knowledge Graph + Answer Box + organische Ergebnisse - AgentRecord: UseSerperSearch Property (Default: false) - DB-Migration: use_serper_search Spalte - AnthropicService + ChatService: useSerperSearch Parameter durchreichen - ChatEndpoint + AgentEndpoint: useSerperSearch in API - Frontend: Checkbox, Badge (Serper Search), laden/speichern - Aktivierung: Agent-Checkbox + SerperApiKey in Server-Einstellungen
This commit is contained in:
1 parent
558ded1ed5
commit
192f41e91e
11 files changed
+150
-12
No files matched your search
@@ -66,6 +66,7 @@ public static class AgentEndpoint
|
||||
a.UseMemory,
|
||||
a.UseAutoContext,
|
||||
a.UseGitHubSearch,
|
||||
a.UseSerperSearch,
|
||||
a.UseWebSearch,
|
||||
a.WebSearchVersion,
|
||||
a.AllowUserChoice,
|
||||
@@ -123,6 +124,7 @@ public static class AgentEndpoint
|
||||
UseMemory = !body.TryGetProperty("useMemory", out var um) || um.GetBoolean(),
|
||||
UseAutoContext = !body.TryGetProperty("useAutoContext", out var uac) || uac.GetBoolean(),
|
||||
UseGitHubSearch = body.TryGetProperty("useGitHubSearch", out var ughs) && ughs.GetBoolean(),
|
||||
UseSerperSearch = body.TryGetProperty("useSerperSearch", out var usps) && usps.GetBoolean(),
|
||||
UseWebSearch = body.TryGetProperty("webSearchVersion", out var wsv) && !string.IsNullOrEmpty(wsv.GetString()),
|
||||
WebSearchVersion = body.TryGetProperty("webSearchVersion", out var wsv2) ? wsv2.GetString() ?? "" : "",
|
||||
AllowUserChoice = !body.TryGetProperty("allowUserChoice", out var auc) || auc.GetBoolean(),
|
||||
@@ -166,6 +168,7 @@ public static class AgentEndpoint
|
||||
if (body.TryGetProperty("useMemory", out var um)) agent.UseMemory = um.GetBoolean();
|
||||
if (body.TryGetProperty("useAutoContext", out var uac)) agent.UseAutoContext = uac.GetBoolean();
|
||||
if (body.TryGetProperty("useGitHubSearch", out var ughs)) agent.UseGitHubSearch = ughs.GetBoolean();
|
||||
if (body.TryGetProperty("useSerperSearch", out var usps)) agent.UseSerperSearch = usps.GetBoolean();
|
||||
if (body.TryGetProperty("webSearchVersion", out var wsv))
|
||||
{
|
||||
agent.WebSearchVersion = wsv.GetString() ?? "";
|
||||
|
||||
@@ -216,7 +216,7 @@ public static class ChatEndpoint
|
||||
else
|
||||
{
|
||||
// Standard: Anthropic
|
||||
await anthropic.StreamChat(res, ctx.ModelId, ctx.SystemPrompt, messages, ctx.ChainId, ctx.Workspace, sessionId, agentId: ctx.AgentId, userId: userId, useMemory: ctx.UseMemory, webSearchVersion: ctx.WebSearchVersion, maxIterations: ctx.MaxIterations, toolChoice: effectiveToolChoice, review: ctx.Review, finalizer: ctx.Finalizer, allowUserChoice: ctx.Agent?.AllowUserChoice ?? true, planMode: ctx.PlanMode, useAutoContext: ctx.Agent?.UseAutoContext ?? true, useGitHubSearch: ctx.Agent?.UseGitHubSearch ?? false, workCt: workCt, hardCt: hardCt, sseCt: sseCt, remoteMgr: remoteMgr);
|
||||
await anthropic.StreamChat(res, ctx.ModelId, ctx.SystemPrompt, messages, ctx.ChainId, ctx.Workspace, sessionId, agentId: ctx.AgentId, userId: userId, useMemory: ctx.UseMemory, webSearchVersion: ctx.WebSearchVersion, maxIterations: ctx.MaxIterations, toolChoice: effectiveToolChoice, review: ctx.Review, finalizer: ctx.Finalizer, allowUserChoice: ctx.Agent?.AllowUserChoice ?? true, planMode: ctx.PlanMode, useAutoContext: ctx.Agent?.UseAutoContext ?? true, useGitHubSearch: ctx.Agent?.UseGitHubSearch ?? false, useSerperSearch: ctx.Agent?.UseSerperSearch ?? false, workCt: workCt, hardCt: hardCt, sseCt: sseCt, remoteMgr: remoteMgr);
|
||||
}
|
||||
}
|
||||
finally
|
||||
|
||||
Reference in new issue
Block a user