{"version":3,"file":"openai.mjs","sources":["../../src/openai.ts"],"sourcesContent":["/**\n * @deprecated This module is deprecated and will be removed in a future version.\n * Please use the vendor-neutral `llm.ts` module instead.\n *\n * All exports from this file are re-exported from `llm.ts` for backward compatibility.\n *\n * BREAKING CHANGE in v0.13.0: The health check response format has changed from\n * { details: { openAI: { configured: true, ok: true } } }\n * to\n * { details: { llmProvider: { configured: true, ok: true } } }\n *\n * This module now handles both formats for backward compatibility, but will be removed in a future version.\n */\n\nimport { getBackendSrv } from \"@grafana/runtime\";\nimport { LLM_PLUGIN_ROUTE } from \"./constants\";\n\n// Re-export everything from llm.ts except enabled\nexport * from \"./llm\";\n\n// Override enabled function to handle both old and new formats\nexport const enabled = async (): Promise<boolean> => {\n  try {\n    const settings = await getBackendSrv().get(`${LLM_PLUGIN_ROUTE}/settings`);\n    if (!settings.enabled) {\n      return false;\n    }\n\n    const health = await getBackendSrv().get(`${LLM_PLUGIN_ROUTE}/health`);\n    const details = health.details;\n\n    // Handle both new and old formats\n    if (details.llmProvider) {\n      return details.llmProvider.configured && details.llmProvider.ok;\n    }\n    if (details.openAI) {\n      return details.openAI.configured && details.openAI.ok;\n    }\n    return false;\n  } catch (e) {\n    return false;\n  }\n};\n"],"names":["enabled"],"mappings":";;;;AAqBO,MAAMA,YAAU,YAA8B;AACnD,EAAA,IAAI;AACF,IAAA,MAAM,WAAW,MAAM,aAAA,GAAgB,GAAA,CAAI,CAAA,EAAG,gBAAgB,CAAA,SAAA,CAAW,CAAA;AACzE,IAAA,IAAI,CAAC,SAAS,OAAA,EAAS;AACrB,MAAA,OAAO,KAAA;AAAA,IACT;AAEA,IAAA,MAAM,SAAS,MAAM,aAAA,GAAgB,GAAA,CAAI,CAAA,EAAG,gBAAgB,CAAA,OAAA,CAAS,CAAA;AACrE,IAAA,MAAM,UAAU,MAAA,CAAO,OAAA;AAGvB,IAAA,IAAI,QAAQ,WAAA,EAAa;AACvB,MAAA,OAAO,OAAA,CAAQ,WAAA,CAAY,UAAA,IAAc,OAAA,CAAQ,WAAA,CAAY,EAAA;AAAA,IAC/D;AACA,IAAA,IAAI,QAAQ,MAAA,EAAQ;AAClB,MAAA,OAAO,OAAA,CAAQ,MAAA,CAAO,UAAA,IAAc,OAAA,CAAQ,MAAA,CAAO,EAAA;AAAA,IACrD;AACA,IAAA,OAAO,KAAA;AAAA,EACT,SAAS,CAAA,EAAG;AACV,IAAA,OAAO,KAAA;AAAA,EACT;AACF;;;;"}