AI-native knowledge base & Evernote/Obsidian alternative with instant sync & native MCP. Free on Cloudflare or self-hosted via Docker.
HTML ai-agentcloudflarecloudflare-d1cloudflare-r2cloudflare-workersdockerelectronevernoteevernote-alternativeknowledge-basemcpnote-takingobsidian-alternativeoffline-firstpersonal-knowledge-basepwaself-hostedsqlitetiptapweb-clipper
refactor(settings): tighten shortcuts and the add-model dialog
tianma-ifb30eb8951a77
diff --git a/apps/web/src/components/settings/AiModelCard.tsx b/apps/web/src/components/settings/AiModelCard.tsxindex 7cde9f0f..f83399d7 100644--- a/apps/web/src/components/settings/AiModelCard.tsx+++ b/apps/web/src/components/settings/AiModelCard.tsx@@ -23,7 +23,6 @@ import { Collapsible, CollapsibleContent, CollapsibleTrigger } from "@/componentimport {Dialog,DialogContent,- DialogDescription,DialogFooter,DialogHeader,DialogTitle,@@ -224,8 +223,7 @@ export const AiModelCard = () => {<DialogContent className="max-h-[calc(100vh-2rem)] overflow-y-auto sm:max-w-2xl"><form className="grid gap-5" onSubmit={(event: FormEvent) => { event.preventDefault(); if (!canAddProvider) return; createMutation.mutate(); }}><DialogHeader>- <DialogTitle>{t("aiModel.addProvider")}</DialogTitle>- <DialogDescription>{t("aiModel.addProviderDescription")}</DialogDescription>+ <DialogTitle className="text-xs font-normal">{t("aiModel.addProvider")}</DialogTitle></DialogHeader>{!encryptionConfigured ? (<p className="flex items-start gap-2 rounded-lg border border-amber-200 bg-amber-50 p-3 text-xs leading-5 text-amber-800">@@ -234,11 +232,11 @@ export const AiModelCard = () => {) : null}<div className="grid gap-4 sm:grid-cols-2"><Field label={t("aiModel.displayName")}>- <Input value={displayName} onChange={(event) => setDisplayName(event.target.value)} required maxLength={80} />+ <Input className="h-9 text-xs" value={displayName} onChange={(event) => setDisplayName(event.target.value)} required maxLength={80} /></Field><Field label={t("aiModel.provider")}><Select value={provider} onValueChange={(value) => handleProviderChange(value as AiProvider)}>- <SelectTrigger className="h-10"><SelectValue /></SelectTrigger>+ <SelectTrigger className="h-9 text-xs font-normal"><SelectValue /></SelectTrigger><SelectContent><SelectItem value="openai-compatible">{t("aiModel.providers.openai-compatible")}</SelectItem><SelectItem value="anthropic">{t("aiModel.providers.anthropic")}</SelectItem>@@ -247,16 +245,16 @@ export const AiModelCard = () => {</Select></Field><div className="sm:col-span-2">- <Field label={t("aiModel.baseUrl")}><Input value={baseUrl} onChange={(event) => setBaseUrl(event.target.value)} required inputMode="url" /></Field>+ <Field label={t("aiModel.baseUrl")}><Input className="h-9 text-xs" value={baseUrl} onChange={(event) => setBaseUrl(event.target.value)} required inputMode="url" /></Field></div><div className="sm:col-span-2"><Field label={t("aiModel.apiKey")} hint={t("aiModel.apiKeyCreateHint")}>- <Input type="password" value={apiKey} onChange={(event) => setApiKey(event.target.value)} required autoComplete="new-password" />+ <Input className="h-9 text-xs" type="password" value={apiKey} onChange={(event) => setApiKey(event.target.value)} required autoComplete="new-password" /></Field></div><div className="sm:col-span-2">- <Field label={t("aiModel.initialModelId")} hint={t("aiModel.initialModelIdHint")}>- <Input value={initialModelId} onChange={(event) => setInitialModelId(event.target.value)} />+ <Field label={t("aiModel.initialModelId")}>+ <Input className="h-9 text-xs" value={initialModelId} onChange={(event) => setInitialModelId(event.target.value)} /></Field></div></div>@@ -266,9 +264,9 @@ export const AiModelCard = () => {</p>) : null}<DialogFooter className="gap-2 sm:space-x-0">- <Button type="button" variant="outline" onClick={() => handleAddDialogChange(false)}>{t("common.cancel")}</Button>+ <Button type="button" variant="outline" className="text-xs font-normal" onClick={() => handleAddDialogChange(false)}>{t("common.cancel")}</Button><DisabledActionTooltip label={!canAddProvider ? addDisabledReason : undefined}>- <Button type="submit" variant="solid" disabled={!canAddProvider || createMutation.isPending}>+ <Button type="submit" variant="solid" className="text-xs font-normal" disabled={!canAddProvider || createMutation.isPending}>{createMutation.isPending ? <Loader2 className="h-4 w-4 animate-spin" /> : null}{t("aiModel.createProvider")}</Button></DisabledActionTooltip>diff --git a/apps/web/src/components/settings/ShortcutSettingsItem.tsx b/apps/web/src/components/settings/ShortcutSettingsItem.tsxindex 860a438f..31fde932 100644--- a/apps/web/src/components/settings/ShortcutSettingsItem.tsx+++ b/apps/web/src/components/settings/ShortcutSettingsItem.tsx@@ -87,21 +87,25 @@ export const ShortcutSettingsItem = ({ shortcutSettings, onShortcutSettingsChangreturn (<div className="overflow-hidden rounded-xl border border-slate-200 bg-card">- <div className="divide-y divide-slate-100">- {shortcutActionOptions.map((item) => {+ <div className="grid grid-cols-1 gap-px bg-slate-100 sm:grid-cols-2">+ {shortcutActionOptions.map((item, index) => {const recording = recordingAction === item.value;+ const lastAlone = index === shortcutActionOptions.length - 1 && shortcutActionOptions.length % 2 === 1;return (<divkey={item.value}- className="flex min-h-16 flex-col items-start gap-3 px-4 py-3 sm:flex-row sm:items-center sm:justify-between sm:gap-4"+ className={cn(+ "flex h-12 items-center justify-between gap-3 bg-card px-4",+ lastAlone && "sm:col-span-2",+ )}>- <div className={cn("min-w-0", SETTINGS_ITEM_TITLE_CLASSNAME)}>{item.label}</div>+ <div className={cn("min-w-0 truncate", SETTINGS_ITEM_TITLE_CLASSNAME)}>{item.label}</div><Buttonref={recording ? captureButtonRef : null}type="button"variant={recording ? "solid" : "outline"}- className={cn("h-9 w-full min-w-32 px-3 font-mono text-xs font-normal sm:w-auto", !recording && "bg-card")}+ className={cn("h-8 min-w-24 shrink-0 px-3 font-mono text-xs font-normal", !recording && "bg-card")}onClick={() => {setRecordingAction(item.value);setCaptureMessage("");diff --git a/packages/shared/src/i18n/en-US.ts b/packages/shared/src/i18n/en-US.tsindex e53a8c42..56d2c212 100644--- a/packages/shared/src/i18n/en-US.ts+++ b/packages/shared/src/i18n/en-US.ts@@ -1073,10 +1073,8 @@ export const enUS = {servicesTitle: "Model services",defaultProviderName: "Model provider {{ordinal}}",addProvider: "Add model service",- addProviderDescription: "Connect a model API, then discover or add more models after the service is created.",createProvider: "Add service",initialModelId: "Initial model ID (optional)",- initialModelIdHint: "Leave this blank to discover available models after creating the service.",deleteProviderConfirm: "Delete “{{name}}” and all of its models?",editConnection: "Edit connection",connectionDescription: "Change the endpoint and credential used by “{{name}}”. Testing uses the current form without saving it.",diff --git a/packages/shared/src/i18n/ja.ts b/packages/shared/src/i18n/ja.tsindex a93f0ff6..780d920e 100644--- a/packages/shared/src/i18n/ja.ts+++ b/packages/shared/src/i18n/ja.ts@@ -1073,10 +1073,8 @@ export const ja = {servicesTitle: "モデルサービス",defaultProviderName: "モデル提供元 {{ordinal}}",addProvider: "モデルサービスを追加",- addProviderDescription: "モデル API を接続します。サービス作成後に、さらにモデルを検出または追加できます。",createProvider: "サービスを追加",initialModelId: "最初のモデル ID(任意)",- initialModelIdHint: "空欄のままなら、サービス作成後に利用可能なモデルを検出できます。",deleteProviderConfirm: "「{{name}}」とそのすべてのモデルを削除しますか?",editConnection: "接続を編集",connectionDescription: "「{{name}}」が使うエンドポイントと認証情報を変更します。テストは保存せず、現在のフォーム内容を使います。",diff --git a/packages/shared/src/i18n/zh-CN.ts b/packages/shared/src/i18n/zh-CN.tsindex 55fe085b..bc2833fc 100644--- a/packages/shared/src/i18n/zh-CN.ts+++ b/packages/shared/src/i18n/zh-CN.ts@@ -1073,10 +1073,8 @@ export const zhCN = {servicesTitle: "模型服务",defaultProviderName: "模型服务商{{ordinal}}",addProvider: "添加模型服务",- addProviderDescription: "连接一个模型 API;创建后可以继续发现或添加更多模型。",createProvider: "添加服务",initialModelId: "首个模型 ID(可选)",- initialModelIdHint: "可以留空,创建服务后再发现可用模型。",deleteProviderConfirm: "确定删除“{{name}}”及其全部模型吗?",editConnection: "编辑连接",connectionDescription: "修改“{{name}}”使用的接口和凭据。测试会使用当前表单内容,不会自动保存。",