Skip to content

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.

simplify reasoning effort display logic

Forhad Hosain2863f4b20e0e
diff --git a/packages/app/src/builder-ui/components/GenAILLM.class.ts b/packages/app/src/builder-ui/components/GenAILLM.class.ts
index b281a03b..769a34b1 100644
--- a/packages/app/src/builder-ui/components/GenAILLM.class.ts
+++ b/packages/app/src/builder-ui/components/GenAILLM.class.ts
@@ -393,36 +393,6 @@ export class GenAILLM extends Component {
}
// #endregion
- // #region Update reasoningEffort visibility based on model type
- const reasoningEffortField = form?.querySelector(
- '[data-field-name="reasoningEffort"]',
- ) as HTMLElement;
-
- if (this.gpt5ReasoningModels.includes(currentElement.value)) {
- // For GPT-5 models, always show reasoningEffort regardless of useReasoning state
- if (reasoningEffortField) {
- reasoningEffortField.classList.remove('hidden');
- // Update reasoning effort options for the new model
- this.updateReasoningEffortOptions(currentElement.value);
- }
- } else if (this.groqReasoningModels.includes(currentElement.value)) {
- // For Groq reasoning models, only show when useReasoning is checked
- if (reasoningEffortField) {
- if (useReasoningElm && useReasoningElm.checked) {
- reasoningEffortField.classList.remove('hidden');
- this.updateReasoningEffortOptions(currentElement.value);
- } else {
- reasoningEffortField.classList.add('hidden');
- }
- }
- } else {
- // For other models, hide reasoningEffort
- if (reasoningEffortField) {
- reasoningEffortField.classList.add('hidden');
- }
- }
- // #endregion
-
// #region Update verbosity field visibility based on model
this.updateVerbosityFieldVisibility(currentElement.value, form);
// #endregion
@@ -825,17 +795,6 @@ export class GenAILLM extends Component {
this.getReasoningEffortOptions(this.data.model || this.defaultModel),
),
options: this.getReasoningEffortOptions(this.data.model || this.defaultModel),
- attributes: {
- 'data-show-when': [
- {
- models: this.groqReasoningModels,
- field: { useReasoning: true },
- },
- {
- models: this.gpt5ReasoningModels,
- },
- ],
- },
help: 'Controls the level of effort the model will put into reasoning. GPT-OSS models support low/medium/high levels, while Qwen models support none/default.',
tooltipClasses: 'w-56 ',
arrowClasses: '-ml-11',
@@ -1394,6 +1353,7 @@ export class GenAILLM extends Component {
) as HTMLElement;
const reasoningOptions = this.getReasoningEffortOptions(currentModel);
+ // Handle reasoning effort field visibility for both GPT-5 and Groq models
if (reasoningOptions.length > 0) {
if (this.gpt5ReasoningModels.includes(currentModel)) {
// For GPT-5 models: Always show reasoningEffort regardless of useReasoning state
@@ -1413,6 +1373,11 @@ export class GenAILLM extends Component {
reasoningEffortField.classList.add('hidden');
}
}
+ } else {
+ // Hide for all other models (GPT-4, etc.)
+ if (reasoningEffortField) {
+ reasoningEffortField.classList.add('hidden');
+ }
}
} else {
// If no reasoning options available, hide the field
diff --git a/packages/app/src/builder-ui/helpers/LLMFormController.helper.ts b/packages/app/src/builder-ui/helpers/LLMFormController.helper.ts
index fdd8e6da..5adde80e 100644
--- a/packages/app/src/builder-ui/helpers/LLMFormController.helper.ts
+++ b/packages/app/src/builder-ui/helpers/LLMFormController.helper.ts
@@ -50,109 +50,6 @@ export class LLMFormController {
}
}
}
-
- // Handle conditional requirements after basic model support check
- this.handleConditionalRequirements(modelField);
- }
-
- /**
- * Handles data-show-when attribute to show/hide fields based on conditional logic.
- * Supports model-based conditions and field value-based conditions.
- *
- * @param modelField - The model select element
- */
- public static handleConditionalRequirements(modelField: HTMLSelectElement) {
- const formGroupElms = modelField
- .closest('.form')
- .querySelectorAll('.form-group, .form-group-div');
- const selectedModel = modelField.value;
- const formElm = modelField.closest('.form');
-
- if (!formGroupElms || formGroupElms.length === 0 || !formElm) return;
-
- for (const formGroupElm of formGroupElms) {
- const fieldElm = formGroupElm.querySelector('[data-show-when]');
-
- if (!fieldElm) continue;
-
- const conditionAttr = fieldElm.getAttribute('data-show-when');
- if (!conditionAttr) continue;
-
- let shouldShow = true;
-
- try {
- // Parse the condition - format: "model:gpt-4,claude-3" or "field:fieldId:true" or combined "model:gpt-4;field:enableFeature:true"
- const conditions = conditionAttr.split(';').map((cond) => cond.trim());
-
- for (const condition of conditions) {
- const [type, ...params] = condition.split(':');
-
- if (type === 'model') {
- // Model-based condition: check if current model is in the list
- const requiredModels =
- params[0]?.split(',').map((model) => model.trim().toLowerCase()) || [];
- if (
- requiredModels.length > 0 &&
- !requiredModels.includes(selectedModel?.toLowerCase())
- ) {
- shouldShow = false;
- break;
- }
- } else if (type === 'field') {
- // Field-based condition: check field value
- const [fieldId, expectedValue] = params;
- if (fieldId && expectedValue !== undefined) {
- const targetFieldElm = formElm.querySelector(`#${fieldId}`) as HTMLInputElement;
-
- if (targetFieldElm) {
- let actualValue: string | boolean;
-
- // Handle different input types
- if (targetFieldElm.type === 'checkbox') {
- actualValue = targetFieldElm.checked;
- } else if (targetFieldElm.type === 'radio') {
- const radioGroup = formElm.querySelectorAll(
- `input[name="${targetFieldElm.name}"]:checked`,
- );
- actualValue =
- radioGroup.length > 0 ? (radioGroup[0] as HTMLInputElement).value : '';
- } else {
- actualValue = targetFieldElm.value;
- }
-
- // Convert expected value to proper type for comparison
- let convertedExpectedValue: string | boolean = expectedValue;
- if (expectedValue.toLowerCase() === 'true') {
- convertedExpectedValue = true;
- } else if (expectedValue.toLowerCase() === 'false') {
- convertedExpectedValue = false;
- }
-
- if (actualValue !== convertedExpectedValue) {
- shouldShow = false;
- break;
- }
- } else {
- // If target field doesn't exist, hide the conditional field
- shouldShow = false;
- break;
- }
- }
- }
- }
- } catch (error) {
- console.warn('Error parsing data-show-when:', conditionAttr, error);
- // On error, default to showing the field to avoid breaking the form
- shouldShow = true;
- }
-
- // Apply visibility
- if (shouldShow) {
- formGroupElm.classList.remove('hidden');
- } else {
- formGroupElm.classList.add('hidden');
- }
- }
}
public static updateFieldsInfo(modelField: HTMLSelectElement) {