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
bug fix: update "Max Context Window Length" properly
Forhad Hosain73684f7e7cb0
diff --git a/packages/app/src/builder-ui/components/GenAILLM.class.ts b/packages/app/src/builder-ui/components/GenAILLM.class.tsindex 5308b11e..8b6daddb 100644--- a/packages/app/src/builder-ui/components/GenAILLM.class.ts+++ b/packages/app/src/builder-ui/components/GenAILLM.class.ts@@ -241,6 +241,11 @@ export class GenAILLM extends Component {const currentModel = modelSelect?.value || this.data.model;const provider = LLMRegistry.getModelProvider(currentModel);+ // Update context size to ensure maxContextWindowLength has proper max value+ if (modelSelect) {+ LLMFormController.updateContextSize(modelSelect);+ }+// Automatically switch search options based on providerthis.autoSwitchSearchOptions(provider, form);diff --git a/packages/app/src/builder-ui/helpers/LLMFormController.helper.ts b/packages/app/src/builder-ui/helpers/LLMFormController.helper.tsindex 9fc1e209..f03ce14f 100644--- a/packages/app/src/builder-ui/helpers/LLMFormController.helper.ts+++ b/packages/app/src/builder-ui/helpers/LLMFormController.helper.ts@@ -288,6 +288,28 @@ export class LLMFormController {}// #endregion+ // #region update the max context window length field+ const maxContextWindowLengthElm = formElm.querySelector(+ '#maxContextWindowLength',+ ) as HTMLInputElement;++ if (maxContextWindowLengthElm && allowedMaxContextTokens) {+ const currentValue = maxContextWindowLengthElm.valueAsNumber || 0;++ // Update the max attribute for the range input+ this.replaceValidationRules({+ fieldElm: maxContextWindowLengthElm,+ attribute: 'max',+ targetValue: allowedMaxContextTokens,+ inputType: 'range',+ });++ // Ensure current value doesn't exceed the new max+ const validMaxContextWindowLength = Math.min(allowedMaxContextTokens, currentValue);+ this.setRangeInputValue(formElm, 'maxContextWindowLength', `${validMaxContextWindowLength}`);+ }+ // #endregion+// #region update the web search context size informationconst allowedWebSearchContextTokens = LLMRegistry.getWebSearchContextTokens(model);