Skip to content

Supercharge your AI agents with data from the web and beyond. Building the library for superintelligence. 🔥

Update search.ts

Nicolas98d82c4cec4b
diff --git a/apps/api/src/controllers/search.ts b/apps/api/src/controllers/search.ts
index a73c625a8..7474aae82 100644
--- a/apps/api/src/controllers/search.ts
+++ b/apps/api/src/controllers/search.ts
@@ -43,8 +43,21 @@ export async function searchHelper(
});
let justSearch = pageOptions.fetchPageContent === false;
+
if (justSearch) {
+ const billingResult = await billTeam(
+ team_id,
+ res.length
+ );
+ if (!billingResult.success) {
+ return {
+ success: false,
+ error:
+ "Failed to bill team. Insufficient credits or subscription not found.",
+ returnCode: 402,
+ };
+ }
return { success: true, data: res, returnCode: 200 };
}