From 89631bdab07600c5cb031af1fe52fb31df775053 Mon Sep 17 00:00:00 2001 From: leokun Date: Mon, 24 Aug 2026 18:06:49 +0800 Subject: [PATCH] fix: adjust secondary button height and enhance MultiCombobox input behavior --- apps/desktop/src/api.ts | 1 + .../desktop/src/components/ProviderEditor.tsx | 4 +- .../components/cursor/CursorModelEditor.tsx | 4 +- .../src/components/ui/Controls.module.scss | 4 +- .../components/ui/FormControls.module.scss | 28 +++ .../src/components/ui/FormControls.tsx | 14 +- apps/desktop/src/components/ui/Select.tsx | 2 +- apps/desktop/src/components/ui/icons.ts | 1 + apps/desktop/src/i18n/generated/catalog.json | 28 ++- apps/desktop/src/i18n/locales/en-US.json | 2 + apps/desktop/src/i18n/locales/zh-CN.json | 2 + apps/desktop/src/pages/ProvidersPage.tsx | 2 +- server/src/control/service.rs | 203 +++++++++++++----- server/src/cursor/request/context.rs | 147 +++++++++++++ server/src/cursor/session.rs | 25 ++- server/src/cursor/tools/edit.rs | 7 + server/src/cursor/tools/mod.rs | 71 +++++- server/src/cursor/tools/schedule.rs | 68 ++++++ server/src/cursor/tools/tests.rs | 139 ++++++++++++ server/src/model/provider.rs | 2 +- server/src/provider/router.rs | 2 +- server/src/store/providers.rs | 82 ++++++- 22 files changed, 754 insertions(+), 84 deletions(-) create mode 100644 server/src/cursor/tools/schedule.rs create mode 100644 server/src/cursor/tools/tests.rs diff --git a/apps/desktop/src/api.ts b/apps/desktop/src/api.ts index 33b6f21..7f9fec3 100644 --- a/apps/desktop/src/api.ts +++ b/apps/desktop/src/api.ts @@ -8,6 +8,7 @@ export interface Provider { name: string; provider_type: ProviderType; base_url: string; + api_key?: string; has_api_key: boolean; custom_headers: Record; extra_params: Record; diff --git a/apps/desktop/src/components/ProviderEditor.tsx b/apps/desktop/src/components/ProviderEditor.tsx index 42bd828..9369f0e 100644 --- a/apps/desktop/src/components/ProviderEditor.tsx +++ b/apps/desktop/src/components/ProviderEditor.tsx @@ -1,5 +1,5 @@ import type { ProviderInput, ProviderType } from "../api"; -import { FormField, TextInput } from "./ui/FormControls"; +import { FormField, SecretTextInput, TextInput } from "./ui/FormControls"; import { JsonEditor } from "./ui/JsonEditor"; import { Select } from "./ui/Select"; import { claudeIcon, openAiIcon } from "./ui/icons"; @@ -23,7 +23,7 @@ export function ProviderEditor({ value, headersText, extraText, editing, onChang { value: "anthropic", label: "Anthropic", icon: claudeIcon }, ]} onChange={(provider_type) => patch({ provider_type: provider_type as ProviderType })} /> patch({ base_url: event.target.value })} /> - patch({ api_key: event.target.value })} /> + patch({ api_key: event.target.value })} /> ; diff --git a/apps/desktop/src/components/cursor/CursorModelEditor.tsx b/apps/desktop/src/components/cursor/CursorModelEditor.tsx index e6be7e3..753858c 100644 --- a/apps/desktop/src/components/cursor/CursorModelEditor.tsx +++ b/apps/desktop/src/components/cursor/CursorModelEditor.tsx @@ -1,5 +1,5 @@ import type { ModelInput, Provider, ProviderInput, ProviderType } from "../../api"; -import { FormField, TextInput } from "../ui/FormControls"; +import { FormField, SecretTextInput, TextInput } from "../ui/FormControls"; import { Checkbox } from "../ui/Checkbox"; import { JsonEditor } from "../ui/JsonEditor"; import { Combobox, MultiCombobox, Select } from "../ui/Select"; @@ -72,7 +72,7 @@ export function CursorModelEditor({ draft, providers, editing, modelOptions, dis
{!editing && draft.providerMode === "new" && <> setProvider({ base_url: event.target.value })} /> - setProvider({ api_key: event.target.value })} /> + setProvider({ api_key: event.target.value })} /> } ; } +export function SecretTextInput({ className, ...props }: InputHTMLAttributes) { + const [visible, setVisible] = useState(false); + return
+ + +
; +} + export function FormField({ label, hint, className, children }: { label: string; hint?: string; className?: string; children: React.ReactNode }) { return