Supercharge your AI agents with data from the web and beyond. Building the library for superintelligence. 🔥
TypeScript aiai-agentsai-crawlerai-scrapingai-searchcrawlerdata-extractionhtml-to-markdownllmmarkdownscraperscrapingweb-crawlerweb-dataweb-data-extractionweb-scraperweb-scrapingweb-searchwebscraping
feat(api): include jobId in search response metadata (#2618)
tom4a6ed31acb3d
diff --git a/apps/api/src/controllers/v1/search.ts b/apps/api/src/controllers/v1/search.tsindex 54b5d4ae1..4f684acb3 100644--- a/apps/api/src/controllers/v1/search.ts+++ b/apps/api/src/controllers/v1/search.ts@@ -256,6 +256,7 @@ export async function searchController(let responseData: SearchResponse = {success: true,data: [],+ id: jobId,};const middlewareTime = controllerStartTime - middlewareStartTime;const isSearchPreview =diff --git a/apps/api/src/controllers/v1/types.ts b/apps/api/src/controllers/v1/types.tsindex 3d87d64b3..72c9679ad 100644--- a/apps/api/src/controllers/v1/types.ts+++ b/apps/api/src/controllers/v1/types.ts@@ -1528,6 +1528,7 @@ export type SearchResponse =success: true;warning?: string;data: Document[];+ id: string;};export type TokenUsage = {diff --git a/apps/api/src/controllers/v1/x402-search.ts b/apps/api/src/controllers/v1/x402-search.tsindex 42fd81976..d53948fad 100644--- a/apps/api/src/controllers/v1/x402-search.ts+++ b/apps/api/src/controllers/v1/x402-search.ts@@ -199,6 +199,7 @@ export async function x402SearchController(let responseData: SearchResponse = {success: true,data: [],+ id: jobId,};const startTime = new Date().getTime();const isSearchPreview =diff --git a/apps/api/src/controllers/v2/search.ts b/apps/api/src/controllers/v2/search.tsindex 2b7add643..37334c5c0 100644--- a/apps/api/src/controllers/v2/search.ts+++ b/apps/api/src/controllers/v2/search.ts@@ -608,6 +608,7 @@ export async function searchController(data: searchResponse,scrapeIds,creditsUsed: credits_billed,+ id: jobId,});} else {// Sync mode: process scraped documents@@ -733,6 +734,7 @@ export async function searchController(success: true,data: searchResponse,creditsUsed: credits_billed,+ id: jobId,});} catch (error) {if (error instanceof z.ZodError) {diff --git a/apps/api/src/controllers/v2/types.ts b/apps/api/src/controllers/v2/types.tsindex 5f94b5738..b0280bd81 100644--- a/apps/api/src/controllers/v2/types.ts+++ b/apps/api/src/controllers/v2/types.ts@@ -1732,12 +1732,14 @@ export type SearchResponse =warning?: string;data: Document[];creditsUsed: number;+ id: string;}| {success: true;warning?: string;data: import("../../lib/entities").SearchV2Response;creditsUsed: number;+ id: string;}| {success: true;@@ -1749,6 +1751,7 @@ export type SearchResponse =images?: string[];};creditsUsed: number;+ id: string;};export type TokenUsage = {diff --git a/apps/api/src/controllers/v2/x402-search.ts b/apps/api/src/controllers/v2/x402-search.tsindex 72d48b2cf..6a1a793a4 100644--- a/apps/api/src/controllers/v2/x402-search.ts+++ b/apps/api/src/controllers/v2/x402-search.ts@@ -540,6 +540,7 @@ export async function x402SearchController(data: searchResponse,scrapeIds,creditsUsed: credits_billed,+ id: jobId,});} else {// Sync mode: process scraped documents@@ -624,6 +625,7 @@ export async function x402SearchController(success: true,data: searchResponse,creditsUsed: credits_billed,+ id: jobId,});} catch (error) {if (error instanceof z.ZodError) {