Skip to content

Commit 3e08359

Browse files
author
1bcMax
committed
fix: prettier formatting in web-search-provider files
1 parent ad35908 commit 3e08359

2 files changed

Lines changed: 15 additions & 17 deletions

File tree

src/web-search-provider.test.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
import { afterEach, describe, expect, it, vi } from "vitest";
22

3-
import {
4-
BLOCKRUN_EXA_PROVIDER_ID,
5-
blockrunExaWebSearchProvider,
6-
} from "./web-search-provider.js";
3+
import { BLOCKRUN_EXA_PROVIDER_ID, blockrunExaWebSearchProvider } from "./web-search-provider.js";
74

85
describe("blockrun-exa web search provider", () => {
96
afterEach(() => {

src/web-search-provider.ts

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,10 @@ function resolveDescription(entry: SearchResultRecord): string {
8080

8181
const highlights = entry.highlights;
8282
if (Array.isArray(highlights)) {
83-
const text = highlights.map(readString).filter((item): item is string => Boolean(item)).join("\n");
83+
const text = highlights
84+
.map(readString)
85+
.filter((item): item is string => Boolean(item))
86+
.join("\n");
8487
if (text) return text;
8588
}
8689

@@ -89,20 +92,20 @@ function resolveDescription(entry: SearchResultRecord): string {
8992

9093
function extractResults(payload: unknown): SearchResultRecord[] {
9194
if (Array.isArray(payload)) {
92-
return payload
93-
.map(asObject)
94-
.filter((entry): entry is SearchResultRecord => Boolean(entry));
95+
return payload.map(asObject).filter((entry): entry is SearchResultRecord => Boolean(entry));
9596
}
9697

9798
const direct = asObject(payload);
9899
if (!direct) return [];
99100

100-
const candidates = [direct.results, asObject(direct.data)?.results, asObject(direct.response)?.results];
101+
const candidates = [
102+
direct.results,
103+
asObject(direct.data)?.results,
104+
asObject(direct.response)?.results,
105+
];
101106
for (const candidate of candidates) {
102107
if (!Array.isArray(candidate)) continue;
103-
return candidate
104-
.map(asObject)
105-
.filter((entry): entry is SearchResultRecord => Boolean(entry));
108+
return candidate.map(asObject).filter((entry): entry is SearchResultRecord => Boolean(entry));
106109
}
107110

108111
return [];
@@ -171,10 +174,7 @@ async function runBlockrunExaSearch(args: Record<string, unknown>): Promise<unkn
171174
return errorPayload("missing_query", "web_search (blockrun-exa) requires a non-empty query.");
172175
}
173176

174-
const count = Math.min(
175-
readPositiveInteger(args.count) ?? DEFAULT_RESULT_COUNT,
176-
MAX_RESULT_COUNT,
177-
);
177+
const count = Math.min(readPositiveInteger(args.count) ?? DEFAULT_RESULT_COUNT, MAX_RESULT_COUNT);
178178
const category = readString(args.category);
179179
const includeDomains =
180180
readStringList(args.include_domains) ??
@@ -249,7 +249,8 @@ export const blockrunExaWebSearchProvider: WebSearchProviderPlugin = {
249249
},
250250
category: {
251251
type: "string",
252-
description: "Optional Exa category filter such as news, company, github, pdf, or research paper.",
252+
description:
253+
"Optional Exa category filter such as news, company, github, pdf, or research paper.",
253254
},
254255
domains: {
255256
type: "array",

0 commit comments

Comments
 (0)