You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(settings): auto-detect running CLIProxyAPI and show import banner (#190)
## Summary
Follow-up to #178 (CLIProxyAPI preset). When Settings > Models mounts,
probe `http://127.0.0.1:8317/v1/models` — if CPA is running locally and
not yet configured, show a one-click Import banner at the top of the
provider list.
Pattern borrowed from EasyCLI (official CPA GUI) and ProxyPal (1k★
SolidJS+Tauri wrapper). Both show the running CPA prominently on first
load; users click once and are done.
## Flow
1. Models tab mounts → `useEffect` fires once
2. Skip if localStorage `cpa-detection-dismissed-v1` is set or any
existing provider points at `localhost:8317`
3. Call `window.codesign.config.testEndpoint({ wire: 'anthropic',
baseUrl: 'http://127.0.0.1:8317', apiKey: '' })` — CPA has wildcard CORS
+ the IPC bridges through main process anyway
4. On success, render `LocalCpaImportCard` (Zap icon + title + body +
Import/Dismiss buttons)
5. "Import" reuses existing `customProviderPreset` state →
`AddCustomProviderModal` pre-filled with CPA preset. Modal's
auto-discovery fills defaultModel. User clicks Save. Done.
## Test plan
- [ ] `pnpm typecheck` green
- [ ] `pnpm lint` green
- [ ] Manual: install + run CPA → open Settings → see banner
- [ ] Manual: click Import → modal opens with preset → save → banner
disappears and does not reappear
- [ ] Manual: click Dismiss → banner disappears and does not reappear on
subsequent Settings opens
- [ ] Manual: no CPA running → no banner (silent failure)
## PR chain
Depends on #178. Base is `feat/cpa-preset` so the diff stays focused on
this change. Will rebase to `main` after #178 merges.
---------
Signed-off-by: hqhq1025 <1506751656@qq.com>
Co-authored-by: Sun-sunshine06 <Sun-sunshine06@users.noreply.github.com>
feat(settings): auto-detect running CLIProxyAPI and show import banner
7
+
8
+
When the Models tab mounts, probes `http://127.0.0.1:8317/v1/models` via the existing `testEndpoint` IPC bridge. If CLIProxyAPI is running and no provider is already configured at that address, displays a `LocalCpaImportCard` banner above the provider list offering one-click import into `AddCustomProviderModal`. The banner is dismissible and the preference persists to `localStorage` via key `cpa-detection-dismissed-v1`.
0 commit comments