style: format with oxfmt
This commit is contained in:
parent
92ed27d039
commit
4040dc8f59
@ -391,9 +391,7 @@ async function runSearxngSearch(params: {
|
|||||||
const results = Array.isArray(data.results) ? data.results : [];
|
const results = Array.isArray(data.results) ? data.results : [];
|
||||||
|
|
||||||
// Sort by score descending and take top N results
|
// Sort by score descending and take top N results
|
||||||
const sorted = results
|
const sorted = results.sort((a, b) => (b.score ?? 0) - (a.score ?? 0)).slice(0, params.count);
|
||||||
.sort((a, b) => (b.score ?? 0) - (a.score ?? 0))
|
|
||||||
.slice(0, params.count);
|
|
||||||
|
|
||||||
const mapped = sorted.map((entry) => ({
|
const mapped = sorted.map((entry) => ({
|
||||||
title: entry.title ?? "",
|
title: entry.title ?? "",
|
||||||
@ -562,7 +560,8 @@ export function createWebSearchTool(options?: {
|
|||||||
execute: async (_toolCallId, args) => {
|
execute: async (_toolCallId, args) => {
|
||||||
const perplexityAuth =
|
const perplexityAuth =
|
||||||
provider === "perplexity" ? resolvePerplexityApiKey(perplexityConfig) : undefined;
|
provider === "perplexity" ? resolvePerplexityApiKey(perplexityConfig) : undefined;
|
||||||
const searxngBaseUrl = provider === "searxng" ? resolveSearxngBaseUrl(searxngConfig) : undefined;
|
const searxngBaseUrl =
|
||||||
|
provider === "searxng" ? resolveSearxngBaseUrl(searxngConfig) : undefined;
|
||||||
|
|
||||||
// For SearXNG, we don't need an API key, just a base URL
|
// For SearXNG, we don't need an API key, just a base URL
|
||||||
const apiKey =
|
const apiKey =
|
||||||
|
|||||||
@ -165,7 +165,9 @@ export const ToolPolicySchema = ToolPolicyBaseSchema.superRefine((value, ctx) =>
|
|||||||
export const ToolsWebSearchSchema = z
|
export const ToolsWebSearchSchema = z
|
||||||
.object({
|
.object({
|
||||||
enabled: z.boolean().optional(),
|
enabled: z.boolean().optional(),
|
||||||
provider: z.union([z.literal("brave"), z.literal("perplexity"), z.literal("searxng")]).optional(),
|
provider: z
|
||||||
|
.union([z.literal("brave"), z.literal("perplexity"), z.literal("searxng")])
|
||||||
|
.optional(),
|
||||||
apiKey: z.string().optional(),
|
apiKey: z.string().optional(),
|
||||||
maxResults: z.number().int().positive().optional(),
|
maxResults: z.number().int().positive().optional(),
|
||||||
timeoutSeconds: z.number().int().positive().optional(),
|
timeoutSeconds: z.number().int().positive().optional(),
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user