Comparing version 1.1.7 to 1.1.8
@@ -22,2 +22,3 @@ import { LLMConfig } from './llm-config'; | ||
g4f?: LLMConfig; | ||
customAI?: LLMConfig; | ||
pexels?: MaterialSite; | ||
@@ -24,0 +25,0 @@ videoScript?: string; |
@@ -14,32 +14,27 @@ "use strict"; | ||
const getLLMConfig = (config) => { | ||
let llmConfig = { ...config.defalut }; | ||
const provider = config.provider.toLowerCase(); | ||
switch (provider) { | ||
case 'moonshot': | ||
llmConfig = { ...llmConfig, ...config.moonshot }; | ||
break; | ||
case 'openai': | ||
llmConfig = { ...llmConfig, ...config.openai }; | ||
break; | ||
case 'azure': | ||
llmConfig = { ...llmConfig, ...config.azure }; | ||
break; | ||
case 'gemini': | ||
llmConfig = { ...llmConfig, ...config.gemini }; | ||
break; | ||
case 'g4f': | ||
llmConfig = { ...llmConfig, ...config.g4f }; | ||
break; | ||
default: | ||
throw new Error('llm provider is not set, please set it in the config file.'); | ||
let llmConfig = { ...config.default }; | ||
const providerConfigs = { | ||
moonshot: config.moonshot, | ||
openai: config.openai, | ||
azure: config.azure, | ||
gemini: config.gemini, | ||
g4f: config.g4f, | ||
custom: config.customAI, | ||
}; | ||
if (provider in providerConfigs) { | ||
const providerConfig = providerConfigs[provider]; | ||
if (providerConfig) { | ||
llmConfig = { ...llmConfig, ...providerConfig }; | ||
} | ||
} | ||
if (llmConfig.apiKey == '') { | ||
throw new Error(`${provider}: api_key is not set, please set it in the config file.`); | ||
else { | ||
throw new Error('LLM provider is not set in the config file.'); | ||
} | ||
if (llmConfig.modelName == '') { | ||
throw new Error(`${provider}: model_name is not set, please set it in the config file.`); | ||
const requiredFields = ['apiKey', 'modelName', 'baseUrl']; | ||
for (const field of requiredFields) { | ||
if (!llmConfig[field]) { | ||
throw new Error(`${provider}: ${field} is not set in the config file.`); | ||
} | ||
} | ||
if (llmConfig.baseUrl == '') { | ||
throw new Error(`${provider}: base_url is not set, please set it in the config file.`); | ||
} | ||
return llmConfig; | ||
@@ -46,0 +41,0 @@ }; |
{ | ||
"name": "ffaivideo", | ||
"version": "1.1.7", | ||
"version": "1.1.8", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
192191
2338