diff --git a/CLAUDE.md b/CLAUDE.md index 2716815ba2..0728605824 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -7,7 +7,6 @@ This file provides guidance to AI coding assistants when working with code in th - **Keep it clear**: Write code that is easy to read, maintain, and explain. - **Match the house style**: Reuse existing patterns, naming, and conventions. - **Search smart**: Prefer `ast-grep` for semantic queries; fall back to `rg`/`grep` when needed. -- **Build with HeroUI**: Use HeroUI for every new UI component; never add `antd` or `styled-components`. - **Log centrally**: Route all logging through `loggerService` with the right context—no `console.log`. - **Research via subagent**: Lean on `subagent` for external docs, APIs, news, and references. - **Always propose before executing**: Before making any changes, clearly explain your planned approach and wait for explicit user approval to ensure alignment and prevent unwanted modifications. @@ -41,7 +40,6 @@ This file provides guidance to AI coding assistants when working with code in th - **Services** (`src/main/services/`): MCPService, KnowledgeService, WindowService, etc. - **Build System**: Electron-Vite with experimental rolldown-vite, yarn workspaces. - **State Management**: Redux Toolkit (`src/renderer/src/store/`) for predictable state. -- **UI Components**: HeroUI (`@heroui/*`) for all new UI elements. ### Logging ```typescript diff --git a/src/renderer/src/components/ErrorBoundary.tsx b/src/renderer/src/components/ErrorBoundary.tsx index 12e9ab5935..7e05d7c035 100644 --- a/src/renderer/src/components/ErrorBoundary.tsx +++ b/src/renderer/src/components/ErrorBoundary.tsx @@ -1,4 +1,4 @@ -import { Button } from '@heroui/button' +import { Button } from 'antd' import { formatErrorMessage } from '@renderer/utils/error' import { Alert, Space } from 'antd' import type { ComponentType, ReactNode } from 'react' @@ -24,10 +24,10 @@ const DefaultFallback: ComponentType = (props: FallbackProps): Re type="error" action={ - - diff --git a/src/renderer/src/pages/paintings/components/ProviderSelect.tsx b/src/renderer/src/pages/paintings/components/ProviderSelect.tsx index e047d878bf..a148e044de 100644 --- a/src/renderer/src/pages/paintings/components/ProviderSelect.tsx +++ b/src/renderer/src/pages/paintings/components/ProviderSelect.tsx @@ -1,4 +1,4 @@ -import { Select, SelectItem } from '@heroui/react' +import { Select } from 'antd' import { ProviderAvatarPrimitive } from '@renderer/components/ProviderAvatar' import { getProviderLogo } from '@renderer/config/providers' import ImageStorage from '@renderer/services/ImageStorage' @@ -54,46 +54,46 @@ const ProviderSelect: FC = ({ provider, options, onChange, return ( + {providerName} + + ) + }} + /> ) } diff --git a/src/renderer/src/pages/settings/AgentSettings/AccessibleDirsSetting.tsx b/src/renderer/src/pages/settings/AgentSettings/AccessibleDirsSetting.tsx index a24c6cdb21..cb31766344 100644 --- a/src/renderer/src/pages/settings/AgentSettings/AccessibleDirsSetting.tsx +++ b/src/renderer/src/pages/settings/AgentSettings/AccessibleDirsSetting.tsx @@ -1,4 +1,4 @@ -import { Button, Tooltip } from '@heroui/react' +import { Button, Tooltip } from 'antd' import { loggerService } from '@logger' import type { AgentBaseWithId, UpdateAgentBaseForm, UpdateAgentFunctionUnion } from '@renderer/types' import { Plus } from 'lucide-react' @@ -65,21 +65,21 @@ export const AccessibleDirsSetting = ({ base, update }: AccessibleDirsSettingPro - diff --git a/src/renderer/src/pages/settings/AgentSettings/AdvancedSettings.tsx b/src/renderer/src/pages/settings/AgentSettings/AdvancedSettings.tsx index 4241543605..a9309377e0 100644 --- a/src/renderer/src/pages/settings/AgentSettings/AdvancedSettings.tsx +++ b/src/renderer/src/pages/settings/AgentSettings/AdvancedSettings.tsx @@ -1,4 +1,4 @@ -import { Input, Tooltip } from '@heroui/react' +import { InputNumber, Tooltip } from 'antd' import type { useUpdateAgent } from '@renderer/hooks/agents/useUpdateAgent' import type { useUpdateSession } from '@renderer/hooks/agents/useUpdateSession' import type { @@ -31,34 +31,33 @@ const defaultConfiguration: AgentConfigurationState = AgentConfigurationSchema.p export const AdvancedSettings: React.FC = ({ agentBase, update }) => { const { t } = useTranslation() const [configuration, setConfiguration] = useState(defaultConfiguration) - const [maxTurnsInput, setMaxTurnsInput] = useState(String(defaultConfiguration.max_turns)) + const [maxTurnsInput, setMaxTurnsInput] = useState(defaultConfiguration.max_turns) useEffect(() => { if (!agentBase) { setConfiguration(defaultConfiguration) - setMaxTurnsInput(String(defaultConfiguration.max_turns)) + setMaxTurnsInput(defaultConfiguration.max_turns) return } const parsed: AgentConfigurationState = AgentConfigurationSchema.parse(agentBase.configuration ?? {}) setConfiguration(parsed) - setMaxTurnsInput(String(parsed.max_turns)) + setMaxTurnsInput(parsed.max_turns) }, [agentBase]) const commitMaxTurns = useCallback(() => { if (!agentBase) return - const parsedValue = Number.parseInt(maxTurnsInput, 10) - if (!Number.isFinite(parsedValue)) { - setMaxTurnsInput(String(configuration.max_turns)) + if (!Number.isFinite(maxTurnsInput)) { + setMaxTurnsInput(configuration.max_turns) return } - const sanitized = Math.max(1, parsedValue) + const sanitized = Math.max(1, maxTurnsInput) if (sanitized === configuration.max_turns) { - setMaxTurnsInput(String(configuration.max_turns)) + setMaxTurnsInput(configuration.max_turns) return } const next: AgentConfigurationState = { ...configuration, max_turns: sanitized } setConfiguration(next) - setMaxTurnsInput(String(sanitized)) + setMaxTurnsInput(sanitized) update({ id: agentBase.id, configuration: next } satisfies UpdateAgentBaseForm) }, [agentBase, configuration, maxTurnsInput, update]) @@ -71,27 +70,23 @@ export const AdvancedSettings: React.FC = ({ agentBase, u + }> {t('agent.settings.advance.maxTurns.label')} -
- + setMaxTurnsInput(value ?? 1)} onBlur={commitMaxTurns} - onKeyDown={(event) => { - if (event.key === 'Enter') { - commitMaxTurns() - } - }} + onPressEnter={commitMaxTurns} aria-label={t('agent.settings.advance.maxTurns.label')} + style={{ width: '100%' }} /> - {t('agent.settings.advance.maxTurns.helper')} + {t('agent.settings.advance.maxTurns.helper')}
diff --git a/src/renderer/src/pages/settings/AgentSettings/AgentSettingsPopup.tsx b/src/renderer/src/pages/settings/AgentSettings/AgentSettingsPopup.tsx index 589e7f48cd..a65c880b7f 100644 --- a/src/renderer/src/pages/settings/AgentSettings/AgentSettingsPopup.tsx +++ b/src/renderer/src/pages/settings/AgentSettings/AgentSettingsPopup.tsx @@ -1,4 +1,3 @@ -import { Alert, Spinner } from '@heroui/react' import { TopView } from '@renderer/components/TopView' import { useAgent } from '@renderer/hooks/agents/useAgent' import { useUpdateAgent } from '@renderer/hooks/agents/useUpdateAgent' @@ -11,6 +10,8 @@ import PluginSettings from './PluginSettings' import PromptSettings from './PromptSettings' import { AgentLabel, LeftMenu, Settings, StyledMenu, StyledModal } from './shared' import ToolingSettings from './ToolingSettings' +import { Center } from '@renderer/components/Layout' +import { Alert, Spin } from 'antd' interface AgentSettingPopupShowParams { agentId: string @@ -71,18 +72,25 @@ const AgentSettingPopupContainer: React.FC = ({ tab, ag const ModalContent = () => { if (isLoading) { // TODO: use skeleton for better ux - return - } - if (error) { return ( -
- -
+
+ +
) } + + if (error) { + return ( +
+ +
+ ) + } + if (!agent) { return null } + return (
diff --git a/src/renderer/src/pages/settings/AgentSettings/DescriptionSetting.tsx b/src/renderer/src/pages/settings/AgentSettings/DescriptionSetting.tsx index 6ed63a773c..7af55a9f25 100644 --- a/src/renderer/src/pages/settings/AgentSettings/DescriptionSetting.tsx +++ b/src/renderer/src/pages/settings/AgentSettings/DescriptionSetting.tsx @@ -1,9 +1,9 @@ -import { Textarea } from '@heroui/react' import type { AgentBaseWithId, UpdateAgentBaseForm, UpdateAgentFunctionUnion } from '@renderer/types' import { useCallback, useState } from 'react' import { useTranslation } from 'react-i18next' import { SettingsItem, SettingsTitle } from './shared' +import TextArea from 'antd/es/input/TextArea' export interface DescriptionSettingProps { base: AgentBaseWithId | undefined | null @@ -24,11 +24,12 @@ export const DescriptionSetting = ({ base, update }: DescriptionSettingProps) => if (!base) return null return ( - + {t('common.description')} -