import { Injectable } from "@nestjs/common";import { Firecrawl } from "firecrawl";@Injectable()export class FirecrawlService { private readonly client: Firecrawl; constructor() { this.client = new Firecrawl({ apiKey: process.env.FIRECRAWL_API_KEY }); } async search(query: string, limit = 5) { return this.client.search(query, { limit }); } async scrape(url: string) { return this.client.scrape(url); } async interact(url: string, prompts: string[]) { const result = await this.client.scrape(url, { formats: ['markdown'] }); const scrapeId = result.metadata?.scrapeId; const responses = []; for (const prompt of prompts) { const response = await this.client.interact(scrapeId, { prompt }); responses.push(response); } await this.client.stopInteraction(scrapeId); return responses; }}