SmythOS Studio: Open-Source Visual AI Agent Builder and deployable runtime stack from SmythOS. Start with an intuitive drag-and-drop workspace, extend with custom code, and deploy your agents anywhere — local, cloud, or edge — with full governance and control.
JavaScript a2aagentic-aiai-agentsdevtoolsmcp-clientn8n-alternativeno-codeopen-sourceorchestrationsmythosvisual-builder
remove keyOptions implementation of model template from code
Forhad Hosaincb5670fe2a73
diff --git a/packages/app/src/backend/services/LLMHelper/index.ts b/packages/app/src/backend/services/LLMHelper/index.tsindex e5bcd08f..f8d3dfaf 100644--- a/packages/app/src/backend/services/LLMHelper/index.ts+++ b/packages/app/src/backend/services/LLMHelper/index.ts@@ -7,6 +7,7 @@ import { getTeamSettingsObj } from '../../services/team-data.service';import { vault } from '../SmythVault.class';import { LLMService } from './LLMService.class';+// TODO: Refactor this function to be more readable and maintainable.async function getUserLLMModels(req: Request) {const models = {};try {@@ -27,23 +28,19 @@ async function getUserLLMModels(req: Request) {modelTpl = { ...modelTpl, ...aliasOptions }; //override the model config with the alias config}- // get the key options- const modelKeyOptions = modelTpl.keyOptions || {};- delete modelTpl.keyOptions;+ let enabled =+ typeof LLMModels[modelId].enabled === 'function'+ ? LLMModels[modelId].enabled({ user: req.user, team: req._team })+ : modelTpl.enabled;const provider = modelTpl?.provider?.toLowerCase();const hasAPIKey = !!keys[provider?.toLowerCase()];- if (hasAPIKey) {- modelTpl = { ...modelTpl, ...modelKeyOptions }; //override the model config with the key config- modelTpl.hasKey = true;+ // If the credentials are only 'vault' and the team doesn't have their own API key, disable the model.+ if (modelTpl.credentials === 'vault' && !hasAPIKey) {+ enabled = false;}- let enabled =- typeof LLMModels[modelId].enabled === 'function'- ? LLMModels[modelId].enabled({ user: req.user, team: req._team })- : modelTpl.enabled;-// Skip legacy models for users with built-in model access to avoid confusionif (_hasBuiltInModels(req) && modelId.startsWith('legacy/')) {enabled = false;diff --git a/packages/runtime/src/core/config/models.config.ts b/packages/runtime/src/core/config/models.config.tsindex b51999ff..19f0359c 100644--- a/packages/runtime/src/core/config/models.config.ts+++ b/packages/runtime/src/core/config/models.config.ts@@ -17,12 +17,6 @@ interface BaseModelConfig {tokens: number;completionTokens: number;enabled: boolean;- keyOptions: {- tokens: number;- completionTokens: number;- maxReasoningTokens?: number;- enabled: boolean;- };credentials: string;interface?: string;default?: boolean;