{"version":3,"file":"customQuery.cjs","names":[],"sources":["../../src/customQuery.ts"],"sourcesContent":["import { generateText, type SystemModelMessage } from 'ai';\nimport type { AIConfig, AIOptions, Messages } from './aiSdk';\n\nexport type CustomQueryOptions = {\n  messages: Messages;\n  system?: string | SystemModelMessage | SystemModelMessage[];\n  aiConfig: AIConfig;\n};\n\nexport type CustomQueryResultData = {\n  fileContent: string;\n  tokenUsed: number;\n};\n\nexport const aiDefaultOptions: AIOptions = {\n  model: 'gpt-4o-mini',\n  // Keep default options\n};\n\n/**\n * CustomQuery a content declaration file by constructing a prompt for AI models.\n * The prompt includes details about the project's locales, file paths of content declarations,\n * and requests for identifying issues or inconsistencies.\n */\nexport const customQuery = async ({\n  messages,\n  system,\n  aiConfig,\n}: CustomQueryOptions): Promise<CustomQueryResultData | undefined> => {\n  // Use the AI SDK to generate the completion\n  const { text: newContent, usage } = await generateText({\n    ...aiConfig,\n    system,\n    messages,\n  });\n\n  return {\n    fileContent: newContent,\n    tokenUsed: usage?.totalTokens ?? 0,\n  };\n};\n"],"mappings":";;;;;AAcA,MAAa,mBAA8B,EACzC,OAAO,eAER;;;;;;AAOD,MAAa,cAAc,OAAO,EAChC,UACA,QACA,eACoE;CAEpE,MAAM,EAAE,MAAM,YAAY,UAAU,2BAAmB;EACrD,GAAG;EACH;EACA;EACD,CAAC;AAEF,QAAO;EACL,aAAa;EACb,WAAW,OAAO,eAAe;EAClC"}