From 75001e78f1f2a65b7235ca633f849ca6b8b949c3 Mon Sep 17 00:00:00 2001 From: Ayush8923 <80516839+Ayush8923@users.noreply.github.com> Date: Mon, 29 Jun 2026 17:23:16 +0530 Subject: [PATCH 1/6] feat(config): add effort field in the config form --- .../prompt-editor/ConfigEditorPane.tsx | 33 +++++++++++++++++-- app/components/ui/Select.tsx | 2 +- app/lib/constants.ts | 11 +++++++ app/lib/types/configs.ts | 11 ++----- 4 files changed, 46 insertions(+), 11 deletions(-) diff --git a/app/components/prompt-editor/ConfigEditorPane.tsx b/app/components/prompt-editor/ConfigEditorPane.tsx index a09788d2..d3eb2f65 100644 --- a/app/components/prompt-editor/ConfigEditorPane.tsx +++ b/app/components/prompt-editor/ConfigEditorPane.tsx @@ -13,13 +13,18 @@ import { getModelsForType, isGpt5Model, } from "@/app/lib/models"; -import { PROVIDER_TYPES, PROVIDES_OPTIONS } from "@/app/lib/constants"; +import { + DEFAULT_EFFORT, + EFFORT_OPTIONS, + PROVIDER_TYPES, + PROVIDES_OPTIONS, +} from "@/app/lib/constants"; import GuardrailsSection from "./GuardrailsSection"; import SaveConfigModal from "./SaveConfigModal"; import LoadConfigDropdown from "./LoadConfigDropdown"; import ConfigNameSection from "./ConfigNameSection"; import ToolsSection from "./ToolsSection"; -import { Button } from "@/app/components/ui"; +import { Button, Select } from "@/app/components/ui"; const inputClass = "w-full px-3 py-2 rounded-md text-sm focus:outline-none border border-border bg-bg-primary text-text-primary"; @@ -165,6 +170,19 @@ export default function ConfigEditorPane({ }); }; + const handleEffortChange = (effort: string) => { + onConfigChange({ + ...configBlob, + completion: { + ...configBlob.completion, + params: { + ...params, + effort: effort as CompletionConfig["params"]["effort"], + }, + }, + }); + }; + const handleAddTool = () => { const newTools = [ ...tools, @@ -323,6 +341,17 @@ export default function ConfigEditorPane({ )} +
+ + handleEffortChange(e.target.value)} - options={EFFORT_OPTIONS} - /> -
+ {isGpt5 && ( +
+ +
- {!isGpt5 && ( -
- - - handleTemperatureChange(parseFloat(e.target.value)) - } - className="w-full accent-accent-primary" - /> -
- 0 - 2 -
-
- )} - - {isGpt5 && ( -
- - setValue(e.target.value)} + options={spec.options.map((opt) => ({ + value: opt, + label: opt, + }))} + /> + {spec.description && ( +

+ {spec.description} +

+ )} +
+ ); + } + if (spec.type === "float" || spec.type === "int") { + const numeric = Number(value); + const min = spec.min ?? 0; + const max = spec.max ?? 1; + const step = spec.type === "int" ? 1 : 0.01; + return ( +
+ + + setValue( + spec.type === "int" + ? parseInt(e.target.value, 10) + : parseFloat(e.target.value), + ) + } + className="w-full accent-accent-primary" + /> +
+ {min} + {max} +
+
+ ); + } + if (spec.type === "string") { + return ( +
+ + setValue(e.target.value)} + className={inputClass} + /> +
+ ); + } + if (spec.type === "boolean") { + return ( +
+ setValue(e.target.checked)} + /> + +
+ ); + } + return null; + })} + handleConfigChange({ + params: { + tools: [ + ...tools, + { + type: "file_search", + knowledge_base_ids: [""], + max_num_results: 20, + }, + ], + }, + }) + } + onRemoveTool={(index) => + handleConfigChange({ + params: { tools: tools.filter((_, i) => i !== index) }, + }) + } + onUpdateTool={(index, field, value) => + handleConfigChange({ + params: { + tools: tools.map((t, i) => + i === index ? { ...t, [field]: value } : t, + ), + }, + }) + } /> - {selectedCommit.temperature != null && ( - - )} + {selectedCommit.modelParams && + Object.entries(selectedCommit.modelParams).map( + ([key, value]) => ( + + ), + )} {selectedCommit.tools && selectedCommit.tools.length > 0 && (
diff --git a/app/components/prompt-editor/ToolsSection.tsx b/app/components/prompt-editor/ToolsSection.tsx index b528582d..4f27ef1e 100644 --- a/app/components/prompt-editor/ToolsSection.tsx +++ b/app/components/prompt-editor/ToolsSection.tsx @@ -7,7 +7,7 @@ import { Tool } from "@/app/lib/types/promptEditor"; interface ToolsSectionProps { tools: Tool[]; - isGpt5: boolean; + showMaxResults: boolean; onAddTool: () => void; onRemoveTool: (index: number) => void; onUpdateTool: ( @@ -19,7 +19,7 @@ interface ToolsSectionProps { export default function ToolsSection({ tools, - isGpt5, + showMaxResults, onAddTool, onRemoveTool, onUpdateTool, @@ -62,7 +62,7 @@ export default function ToolsSection({ />
- {!isGpt5 && ( + {showMaxResults && (