From 8e2b7c048e165e41ac135251809f9d3cc468640e Mon Sep 17 00:00:00 2001 From: John Richmond <5629+jr@users.noreply.github.com> Date: Thu, 29 May 2025 21:23:02 -0700 Subject: [PATCH] Remove default parameters UI (#50) The extension isn't using it, and it's probably not quite what we want. --- .../DefaultParameters.tsx | 826 ------------------ .../org/[[...organization-profile]]/Org.tsx | 10 +- 2 files changed, 1 insertion(+), 835 deletions(-) delete mode 100644 src/app/(authenticated)/org/[[...organization-profile]]/DefaultParameters.tsx diff --git a/src/app/(authenticated)/org/[[...organization-profile]]/DefaultParameters.tsx b/src/app/(authenticated)/org/[[...organization-profile]]/DefaultParameters.tsx deleted file mode 100644 index 64e33090ed..0000000000 --- a/src/app/(authenticated)/org/[[...organization-profile]]/DefaultParameters.tsx +++ /dev/null @@ -1,826 +0,0 @@ -/* eslint-disable react/no-unescaped-entities */ - -'use client'; - -import { useTranslations } from 'next-intl'; -import { useState, useMemo, useRef, useEffect } from 'react'; -import { useForm } from 'react-hook-form'; -import { toast } from 'sonner'; -import { - useQuery, - useQueryClient, - type QueryClient, -} from '@tanstack/react-query'; - -import { updateDefaultParameters } from '@/actions/defaultParameters'; -import { getOrganizationSettings } from '@/actions/organizationSettings'; -import { type OrganizationSettings } from '@/types'; -import { - Button, - Checkbox, - Form, - FormControl, - FormDescription, - FormField, - FormItem, - FormLabel, - Input, - Slider, -} from '@/components/ui'; -import { CheckCheck, FlaskConical, SlidersHorizontal } from 'lucide-react'; - -type DefaultParamsFormValues = { - experimentalPowerSteering: boolean; - terminalOutputLineLimit: number; - terminalCompressProgressBar: boolean; - inheritEnvVars: boolean; - terminalShellIntegrationDisabled: boolean; - terminalShellIntegrationTimeout: number; - terminalCommandDelay: number; - terminalZshClearEolMark: boolean; - enablePowerlevel10k: boolean; - maxOpenTabsContext: number; - maxWorkspaceFiles: number; - showRooIgnoredFiles: boolean; - maxReadFileLine: number; - enableCheckpoints: boolean; - useCustomTemperature: boolean; - temperature: number; - rateLimit: number; - enableEditingThroughDiffs: boolean; - matchPrecision: number; -}; - -const mergeWithDefaultValues = ( - defaultValues: DefaultParamsFormValues, - orgSettings?: OrganizationSettings, -): DefaultParamsFormValues => { - if (!orgSettings || !orgSettings.defaultSettings) { - return defaultValues; - } - - return { - ...defaultValues, - ...orgSettings.defaultSettings, - }; -}; - -const defaultFormValues: DefaultParamsFormValues = { - experimentalPowerSteering: true, - terminalOutputLineLimit: 500, - terminalCompressProgressBar: true, - inheritEnvVars: true, - terminalShellIntegrationDisabled: false, - terminalShellIntegrationTimeout: 5, - terminalCommandDelay: 0, - terminalZshClearEolMark: true, - enablePowerlevel10k: false, - maxOpenTabsContext: 20, - maxWorkspaceFiles: 200, - showRooIgnoredFiles: true, - maxReadFileLine: 500, - enableCheckpoints: true, - useCustomTemperature: true, - temperature: 0, - rateLimit: 0, - enableEditingThroughDiffs: true, - matchPrecision: 100, -} as const; - -type ParametersFormProps = { - orgSettings: OrganizationSettings; - queryClient: QueryClient; -}; - -const ParametersForm = ({ orgSettings, queryClient }: ParametersFormProps) => { - const t = useTranslations('ProviderWhitelist'); - - const [isSaving, setIsSaving] = useState(false); - const [readEntireFile, setReadEntireFile] = useState(false); - - const mergedValues = useMemo( - () => mergeWithDefaultValues(defaultFormValues, orgSettings), - [orgSettings], - ); - - const previousMaxReadFileLine = useRef( - mergedValues.maxReadFileLine === -1 ? 500 : mergedValues.maxReadFileLine, - ); - - const form = useForm({ - defaultValues: mergedValues, - }); - - const maxReadFileLineValue = form.watch('maxReadFileLine'); - - useEffect(() => { - previousMaxReadFileLine.current = - mergedValues.maxReadFileLine === -1 ? 500 : mergedValues.maxReadFileLine; - }, [mergedValues]); - - useEffect(() => { - setReadEntireFile(maxReadFileLineValue === -1); - - if (maxReadFileLineValue !== -1) { - previousMaxReadFileLine.current = maxReadFileLineValue; - } - }, [maxReadFileLineValue, form]); - - const handleReadEntireFileChange = (checked: boolean) => { - if (checked) { - const currentValue = form.getValues('maxReadFileLine'); - if (currentValue !== -1) { - previousMaxReadFileLine.current = currentValue; - } - form.setValue('maxReadFileLine', -1); - } else { - form.setValue('maxReadFileLine', previousMaxReadFileLine.current); - } - setReadEntireFile(checked); - }; - - const onSubmit = async (data: DefaultParamsFormValues) => { - setIsSaving(true); - - try { - const result = await updateDefaultParameters(data); - if (result.success) { - queryClient.invalidateQueries({ queryKey: ['organizationSettings'] }); - - toast('Settings saved', { - description: 'Default parameters have been updated successfully.', - }); - } else { - throw new Error(result.error || 'An unexpected error occurred.'); - } - } catch (error) { - console.error('Failed to update default parameters:', error); - toast.error('Error saving settings', { - description: 'Failed to update default parameters. Please try again.', - }); - } finally { - setIsSaving(false); - } - }; - - return ( - <> -
-
-

- {t('parameters_section_title')} -

-
-
-

- {t('parameters_section_description')} -

-
-
- -
-
- -

Checkpoints

-
-
- ( - - - - -
- Enable automatic checkpoints - - When enabled, Roo will automatically create - checkpoints during task execution, making it easy to - review changes or revert to earlier states. - -
-
- )} - /> -
-
-
-
- - - - - -

Context

-
-

- Control what information is included in the AI's context window, - affecting token usage and response quality -

- -
- ( - -
- Open tabs context limit - {field.value} -
- - - field.onChange(value[0]) - } - className="w-full" - /> - - - Maximum number of VSCode open tabs to include in - context. Higher values provide more context but increase - token usage. - -
- )} - /> - - ( - -
- Workspace files context limit - {field.value} -
- - - field.onChange(value[0]) - } - className="w-full" - /> - - - Maximum number of files to include in current working - directory details. Higher values provide more context - but increase token usage. - -
- )} - /> - - ( - - - - -
- - Show .rooignore'd files in lists and searches - - - When enabled, files matching patterns in .rooignore - will be shown in lists with a lock symbol. When - disabled, these files will be completely hidden from - file lists and searches. - -
-
- )} - /> - -
- File read auto-truncate threshold -
- ( - - - - field.onChange(Number(e.target.value)) - } - className="w-32" - disabled={readEntireFile} - value={readEntireFile ? '' : field.value} - /> - - - )} - /> - lines - - - - - Always read entire file - -
- - Roo reads this number of lines when the model omits - start/end values. If this number is less than the file's - total, Roo generates a line number index of code - definitions. Special cases: -1 instructs Roo to read the - entire file (without indexing), and 0 instructs it to read - no lines and provides line indexes only for minimal context. - Lower values minimize initial context usage, enabling - precise subsequent line-range reads. Explicit start/end - requests are not limited by this setting. - -
-
-
- -
-
- -

Model Settings

-
- -
- ( - - - - -
- Enable editing through diffs - - When enabled, Roo will be able to edit files more - quickly and will automatically reject truncated - full-file writes. Works best with the latest Claude - 3.7 Sonnet model. - -
-
- )} - /> - - ( - -
- Match precision - {field.value}% -
- - - field.onChange(value[0]) - } - className="w-full" - /> - - - This slider controls how precisely code sections must - match when applying diffs. Lower values allow more - flexible matching but increase the risk of incorrect - replacements. Use values below 100% with extreme - caution. - -
- )} - /> - - ( - - - - -
- Use custom temperature - - Controls randomness in the model's responses. - -
-
- )} - /> - - {form.watch('useCustomTemperature') && ( - ( - -
- Temperature - {field.value} -
- - - field.onChange(value[0]) - } - className="w-full" - /> - - - Higher values make output more random, lower values - make it more deterministic. - -
- )} - /> - )} - - ( - -
- Rate limit - {field.value}s -
- - - field.onChange(value[0]) - } - className="w-full" - /> - - - Minimum time between API requests. - -
- )} - /> -
-
- - {/* Terminal Settings Section */} -
-
- - - - -

Terminal

-
- -
-

- Terminal Settings: Basic -

- - ( - -
- Terminal output limit - {field.value} -
- - - field.onChange(value[0]) - } - className="w-full" - /> - - - Maximum number of lines to include in terminal output - when executing commands. When exceeded lines will be - removed from the middle, saving tokens. - -
- )} - /> - - ( - - - - -
- Compress progress bar output - - When enabled, processes terminal output with carriage - returns (\r) to simulate how a real terminal would - display content. This removes intermediate progress - bar states, retaining only the final state, which - conserves context space for more relevant information. - -
-
- )} - /> - -

- Terminal Settings: Advanced -

-

- The following options may require a terminal restart to apply - the setting. -

- - ( - - - - -
- Inherit environment variables - - When enabled, the terminal will inherit environment - variables from VSCode's parent process, such as - user-profile-defined shell integration settings. This - directly toggles VSCode global setting - 'terminal.integrated.inheritEnv' - -
-
- )} - /> - - ( - - - - -
- - Disable terminal shell integration - - - Enable this if terminal commands aren't working - correctly or you see 'Shell Integration Unavailable' - errors. This uses a simpler method to run commands, - bypassing some advanced terminal features. - -
-
- )} - /> - - ( - -
- - Terminal shell integration timeout - - {field.value}s -
- - - field.onChange(value[0]) - } - className="w-full" - /> - - - Maximum time to wait for shell integration to initialize - before executing commands. For users with long shell - startup times, this value may need to be increased if - you see "Shell Integration Unavailable" errors in the - terminal. - -
- )} - /> - - ( - -
- Terminal command delay - - {field.value} - ms - -
- - - field.onChange(value[0]) - } - className="w-full" - /> - - - Delay in milliseconds to add after command execution. - The default setting of 0 disables the delay completely. - This can help ensure command output is fully captured in - terminals with timing issues. In most terminals it is - implemented by setting `PROMPT_COMMAND='sleep N'` and - Powershell appends `start-sleep` to the end of each - command. Originally was workaround for VSCode bug#237208 - and may not be needed. - -
- )} - /> - - ( - - - - -
- Clear ZSH EOL mark - - When enabled, clears the ZSH end-of-line mark by - setting PROMPT_EOL_MARK=''. This prevents issues with - command output interpretation when output ends with - special characters like '%'. - -
-
- )} - /> -
-
- -
-
- -

Experimental

-
-
- ( - - - - -
- - Use experimental "power steering" mode - - - When enabled, Roo will remind the model about the - details of its current mode definition more - frequently. This will lead to stronger adherence to - role definitions and custom instructions, but will use - more tokens per message. - -
-
- )} - /> -
-
- -
- - -
-
- -
- - ); -}; - -export const DefaultParameters = () => { - const queryClient = useQueryClient(); - - const { data: orgSettings } = useQuery({ - queryKey: ['getOrganizationSettings'], - queryFn: getOrganizationSettings, - }); - - if (!orgSettings) { - return ( -
-
- Loading settings... -
- ); - } - - return ; -}; diff --git a/src/app/(authenticated)/org/[[...organization-profile]]/Org.tsx b/src/app/(authenticated)/org/[[...organization-profile]]/Org.tsx index 474077d6bd..700ef6005c 100644 --- a/src/app/(authenticated)/org/[[...organization-profile]]/Org.tsx +++ b/src/app/(authenticated)/org/[[...organization-profile]]/Org.tsx @@ -2,9 +2,8 @@ import { useTranslations } from 'next-intl'; import { OrganizationProfile } from '@clerk/nextjs'; -import { ListTodo, SlidersHorizontal, Cloud } from 'lucide-react'; +import { ListTodo, Cloud } from 'lucide-react'; -import { DefaultParameters } from './DefaultParameters'; import { ProviderWhitelist } from './ProviderWhitelist'; import { CloudSettings } from './CloudSettings'; @@ -32,13 +31,6 @@ export const Org = () => { > - } - > - - );