MCPcopy Index your code
hub / github.com/chartdb/chartdb / validateConfiguration

Function validateConfiguration

src/lib/data/sql-export/export-sql-script.ts:723–741  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

721};
722
723const validateConfiguration = () => {
724 const apiKey = window?.env?.OPENAI_API_KEY ?? OPENAI_API_KEY;
725 const baseUrl = window?.env?.OPENAI_API_ENDPOINT ?? OPENAI_API_ENDPOINT;
726 const modelName = window?.env?.LLM_MODEL_NAME ?? LLM_MODEL_NAME;
727
728 // If using custom endpoint and model, don't require OpenAI API key
729 if (baseUrl && modelName) {
730 return { useCustomEndpoint: true };
731 }
732
733 // If using OpenAI's service, require API key
734 if (apiKey) {
735 return { useCustomEndpoint: false };
736 }
737
738 throw new Error(
739 'Configuration Error: Either provide an OpenAI API key or both a custom endpoint and model name'
740 );
741};
742
743export const exportSQL = async (
744 diagram: Diagram,

Callers 1

exportSQLFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected