"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.default = grabUserAIInfo; const types_1 = require("../types"); function grabUserAIInfo({ userConfig: passedConfig, }) { const userConfig = passedConfig ? passedConfig : undefined; if (!userConfig) return undefined; const targetAI = userConfig === null || userConfig === void 0 ? void 0 : userConfig.main.target_ai; if (!(targetAI === null || targetAI === void 0 ? void 0 : targetAI.name) || !(userConfig === null || userConfig === void 0 ? void 0 : userConfig.main.api_keys)) return undefined; const targetAIAPIKey = userConfig.main.api_keys[targetAI.name].key; if (!targetAIAPIKey) return undefined; const targetAIOption = types_1.AIOptions.find((aiOpt) => aiOpt.name == targetAI.name); targetAI.apiKey = targetAIAPIKey; if (targetAIOption === null || targetAIOption === void 0 ? void 0 : targetAIOption.baseUrl) { targetAI.baseUrl = targetAIOption.baseUrl; } return targetAI; }