Commit Graph

497 Commits

Author SHA1 Message Date
Jason
9471cb0d19 fix(mcp): update MCP wizard to support http type and improve args input
- Replace deprecated 'sse' type with 'http' (as per Claude Code official docs)
- Add HTTP-specific fields: url (required) and headers (optional)
- Implement dynamic UI: show different fields based on selected type
- Improve args input: support multi-line input (one argument per line)
- Add headers parsing supporting both 'KEY: VALUE' and 'KEY=VALUE' formats
- Update backend validation to enforce type-specific required fields
- Update i18n translations (zh/en) with new HTTP-related labels
2025-10-09 12:04:37 +08:00
Jason
d0fe9d7533 feat(mcp): add configuration wizard and simplify form modal
- Simplify McpFormModal to 3 inputs: title (required), description (optional), and JSON config (optional)
- Add JSON validation similar to ProviderForm (must be object, real-time error display)
- Create McpWizardModal component for quick configuration:
  - 5 input fields: type (stdio/sse), command (required), args, cwd, env
  - Real-time JSON preview
  - Emerald theme color (consistent with MCP button)
  - Z-index 70 (above McpFormModal's 60)
- Add "or use configuration wizard" link next to JSON config label
- Update i18n translations (zh/en) for form and wizard
- All changes pass TypeScript typecheck and Prettier formatting
2025-10-09 11:30:28 +08:00
Jason
59c13c3366 refactor(mcp): redesign MCP management panel UI
- Redesign MCP panel to match main interface style
- Add toggle switch for each MCP server to enable/disable
- Use emerald theme color consistent with MCP button
- Create card-based layout with one MCP per row
- Add dedicated form modal for add/edit operations
- Implement proper empty state with friendly prompts
- Add comprehensive i18n support (zh/en)
- Extend McpServer type to support enabled field
- Backend already supports enabled field via serde_json::Value

Components:
- McpPanel: Main panel container with header and list
- McpListItem: Card-based list item with toggle and actions
- McpFormModal: Independent modal for add/edit forms
- McpToggle: Emerald-themed toggle switch component

All changes passed TypeScript type checking and production build.
2025-10-09 11:04:36 +08:00
Jason
96a4b4fe95 refactor(mcp): switch to user-level config ~/.claude.json and remove project-level logic
- Read/write ~/.claude.json (preserve unknown fields) for mcpServers
- Remove settings.local.json and mcp.json handling
- Drop enableAllProjectMcpServers command and UI toggle
- Update types, Tauri APIs, and MCP panel to reflect new status fields
- Keep atomic write and command validation behaviors
2025-10-08 23:22:19 +08:00
Jason
e0e84ca58a i18n: add translations for MCP UI (zh/en)
- Add mcp.* keys for panel, actions, validation, messages
2025-10-08 22:35:10 +08:00
Jason
c6a062f64a feat(mcp): implement MCP management panel (list, form, templates)
- Add McpPanel with enable toggle, server list and add/edit form
- Quick template: mcp-fetch (uvx mcp-server-fetch)
- Command validation UI and open ~/.claude shortcut
- Wire MCP button in App to open panel
2025-10-08 22:35:07 +08:00
Jason
94192a3720 feat(mcp): add front-end API wrappers and types
- Add McpServer and McpStatus types
- Add window.api wrappers for MCP commands
- Extend vite-env.d.ts global typings for MCP APIs
2025-10-08 22:35:02 +08:00
Jason
e7a584c5ba feat(mcp): add Rust module and Tauri commands for Claude MCP
- Manage ~/.claude/settings.local.json and ~/.claude/mcp.json
- Atomic JSON read/write with preservation of unknown fields
- Commands: get_claude_mcp_status, read_claude_mcp_config, set_claude_mcp_enable_all_projects, upsert_claude_mcp_server, delete_claude_mcp_server, validate_mcp_command
- Register commands in Tauri invoke handler
- PATH-based command availability check (non-executing)
2025-10-08 22:34:58 +08:00
Jason
e9833e9a57 refactor: improve error handling and code formatting
- Enhanced error messages in Rust backend to include file paths
- Improved provider switching error handling with detailed messages
- Added MCP button placeholder in UI (functionality TODO)
- Applied code formatting across frontend components
- Extended error notification duration to 6s for better readability
2025-10-08 21:22:56 +08:00
Jason
6afc436946 fix(frontend): align Tauri invoke param names to backend (snake_case)
- pick_directory: pass `default_path` instead of `defaultPath` (src/lib/tauri-api.ts:156)
- export_config_to_file/import_config_from_file: pass `file_path` instead of `filePath` (src/lib/tauri-api.ts:394, 408)
- save_file_dialog: pass `default_name` instead of `defaultName` (src/lib/tauri-api.ts:418)

- reason: Tauri commands match params by exact name; camelCase caused missing args and runtime failures in directory picker, import/export, and save dialog
- verify: pnpm typecheck OK; cargo check OK; command signatures confirmed (pick_directory at src-tauri/src/commands.rs:584, export/import/save dialog at src-tauri/src/import_export.rs:84, 102, 140)
- follow-ups: run `pnpm format`; consider Clippy cleanups; short-circuit same provider switch
2025-10-08 21:11:00 +08:00
Jason
c89bf0c6f0 fix: correct i18n key references in ProviderForm
- Fix providerForm.websiteLabel -> providerForm.websiteUrl (line 1498)
- Fix codexConfig namespace to providerForm for API key placeholders (lines 1681-1682)
  - codexConfig.codexOfficialNoApiKey -> providerForm.codexOfficialNoApiKey
  - codexConfig.codexApiKeyAutoFill -> providerForm.codexApiKeyAutoFill

All i18n keys now properly reference existing locale definitions.
2025-10-08 18:12:03 +08:00
Jason
a6d461282d fix: custom endpoints not saved when creating new provider
When creating a new provider, custom endpoints added in the speed test
modal were not being saved properly. The issue was in ProviderForm.tsx
where the CustomEndpoint object was constructed without the optional
lastUsed field.

This caused inconsistency between:
- Edit mode: uses backend API (addCustomEndpoint) which correctly
  constructs complete CustomEndpoint objects
- Create mode: directly constructs objects in frontend, missing the
  lastUsed field

Fixed by explicitly setting lastUsed to undefined when constructing
custom endpoints in create mode, ensuring structural consistency with
the TypeScript CustomEndpoint interface.
2025-10-08 17:32:20 +08:00
Jason
75ce5a0723 refactor: replace 'Done' button with standard 'Save' button in endpoint speed test
- Import Save icon from lucide-react
- Replace endpointTest.done translation key with common.save for consistency
- Add Save icon to button with flex layout matching other save buttons in the app
2025-10-08 11:29:34 +08:00
Jason
3f3905fda0 i18n: localize provider preset names and sorting logic
- Replace hardcoded Chinese preset names with English versions (Claude Official, Zhipu GLM, Qwen Coder, ModelScope, Codex Official, KAT-Coder)
- Update ProviderList sorting to use locale-aware comparison based on current language (zh-CN for Chinese, en-US for English)
- Reorder presets: move KAT-Coder before PackyCode for better grouping
2025-10-08 11:02:09 +08:00
Jason
01da9a1eac - i18n: complete remaining internationalization across the UI
- Locales: add and align keys (common.enterValidValue, apiKeyInput.*, jsonEditor.*, claudeConfig.*); fix zh common.unknown mapping
- ProviderForm: localize labels/placeholders/hints/errors; unify JSON/auth validation to providerForm.*; add wizard CTA for Codex custom with i18n; cancel uses common.cancel
- CodexConfigEditor: i18n for quick wizard, labels/placeholders/hints, common config modal (title/help/buttons)
- ClaudeConfigEditor: i18n for main label, common-config toggle/button, modal title/help, footer buttons
- EndpointSpeedTest: localize failed/noEndpoints/done and aria labels
- ApiKeyInput: i18n for placeholder and show/hide aria
- JsonEditor: i18n linter messages
- PresetSelector: remove hardcoded defaults, use i18n keys
- UpdateBadge: i18n close aria
- Build/typecheck: pass; scan shows no visible hardcoded Chinese strings outside locales
2025-10-07 23:31:00 +08:00
Jason
420a4234de feat: improve endpoint speed test UI and accuracy
- Add color-coded latency indicators (green <300ms, yellow <500ms, orange <800ms, red >=800ms)
- Fix speed test button width to prevent layout shift during testing
- Clear latency data before each test to properly show loading state
- Add warmup request in speed test to avoid first packet penalty and improve accuracy
2025-10-07 20:51:12 +08:00
YoVinchen
ca488cf076 feat: Implement Speed Test Function
* feat: add unified endpoint speed test for API providers

Add a comprehensive endpoint latency testing system that allows users to:
- Test multiple API endpoints concurrently
- Auto-select the fastest endpoint based on latency
- Add/remove custom endpoints dynamically
- View latency results with color-coded indicators

Backend (Rust):
- Implement parallel HTTP HEAD requests with configurable timeout
- Handle various error scenarios (timeout, connection failure, invalid URL)
- Return structured latency data with status codes

Frontend (React):
- Create interactive speed test UI component with auto-sort by latency
- Support endpoint management (add/remove custom endpoints)
- Extract and update Codex base_url from TOML configuration
- Integrate with provider presets for default endpoint candidates

This feature improves user experience when selecting optimal API endpoints,
especially useful for users with multiple provider options or proxy setups.

* refactor: convert endpoint speed test to modal dialog

- Transform EndpointSpeedTest component into a modal dialog
- Add "Advanced" button next to base URL input to open modal
- Support ESC key and backdrop click to close modal
- Apply Linear design principles: minimal styling, clean layout
- Remove unused showBaseUrlInput variable
- Implement same modal pattern for both Claude and Codex

* fix: prevent modal cascade closing when ESC is pressed

- Add state checks to prevent parent modal from closing when child modals (endpoint speed test or template wizard) are open
- Update ESC key handler dependencies to track all modal states
- Ensures only the topmost modal responds to ESC key

* refactor: unify speed test panel UI with project design system

UI improvements:
- Update modal border radius from rounded-lg to rounded-xl
- Unify header padding from px-6 py-4 to p-6
- Change speed test button color to blue theme (bg-blue-500) for consistency
- Update footer background from bg-gray-50 to bg-gray-100
- Style "Done" button as primary action button with blue theme
- Adjust footer button spacing and hover states

Simplify endpoint display:
- Remove endpoint labels (e.g., "Current Address", "Custom 1")
- Display only URL for cleaner interface
- Clean up all label-related logic:
  * Remove label field from EndpointCandidate interface
  * Remove label generation in buildInitialEntries function
  * Remove label handling in useEffect merge logic
  * Remove label generation in handleAddEndpoint
  * Remove label parameters from claudeSpeedTestEndpoints
  * Remove label parameters from codexSpeedTestEndpoints

* refactor: improve endpoint list UI consistency

- Show delete button for all endpoints on hover for uniform UI
- Change selected state to use blue theme matching main interface:
  * Blue border (border-blue-500) for selected items
  * Light blue background (bg-blue-50/dark:bg-blue-900/20)
  * Blue indicator dot (bg-blue-500/dark:bg-blue-400)
- Switch from compact list (space-y-px) to card-based layout (space-y-2)
- Add rounded corners to each endpoint item for better visual separation

* feat: persist custom endpoints to settings.json

- Extend AppSettings to store custom endpoints for Claude and Codex
- Add Tauri commands: get/add/remove/update custom endpoints
- Update frontend API with endpoint persistence methods
- Modify EndpointSpeedTest to load/save custom endpoints via API
- Track endpoint last used time for future sorting/cleanup
- Store endpoints per app type in settings.json instead of localStorage

* - feat(types): add Provider.meta and ProviderMeta (snake_case) with custom_endpoints map

- feat(provider-form): persist custom endpoints on provider create by merging EndpointSpeedTest’s custom URLs into meta.custom_endpoints on submit

- feat(endpoint-speed-test): add onCustomEndpointsChange callback emitting normalized custom URLs; wire it for both Claude/Codex modals

- fix(api): send alias param names (app/appType/app_type and provider_id/providerId) in Tauri invokes to avoid “missing providerId” with older backends

- storage: custom endpoints are stored in ~/.cc-switch/config.json under providers[<id>].meta.custom_endpoints (not in settings.json)

- behavior: edit flow remains immediate writes; create flow now writes once via addProvider, removing the providerId dependency during creation

* feat: add endpoint candidates support and code formatting improvements

- Add endpointCandidates field to ProviderPreset and CodexProviderPreset interfaces
- Integrate preset endpoint candidates into speed test endpoint selection
- Add multiple endpoint options for PackyCode providers (Claude & Codex)
- Apply consistent code formatting (trailing commas, line breaks)
- Improve template value type safety and readability

* refactor: improve endpoint management button UX

Replace ambiguous "Advanced" text with intuitive "Manage & Test" label accompanied by Zap icon, making the endpoint management panel entry point more discoverable and self-explanatory for both Claude and Codex configurations.

* - merge: merge origin/main, resolve conflicts and preserve both feature sets
- feat(tauri): register import/export and file dialogs; keep endpoint speed test and custom endpoints
- feat(api): add updateTrayMenu and onProviderSwitched; wire import/export APIs
- feat(types): extend global API declarations (import/export)
- chore(presets): GLM preset supports both new and legacy model keys
- chore(rust): add chrono dependency; refresh lockfile

---------

Co-authored-by: Jason <farion1231@gmail.com>
2025-10-07 19:14:32 +08:00
WormW
3ad11acdb2 add: local config import and export (#84)
* add: local config import and export

* Fix import refresh flow and typings

* Clarify import refresh messaging

* Limit stored import backups

---------

Co-authored-by: Jason <farion1231@gmail.com>
2025-10-05 23:33:07 +08:00
zhangweiii
f8c40d591f feat: update GLM provider model configuration (#90)
- Update GLM-4.5 to GLM-4.6 as default Sonnet and Opus models
- Use new model naming convention (glm-4.5-air, glm-4.6)
- Align with latest GLM API model naming standards
2025-10-05 20:41:39 +08:00
QuentinHsu
ce593248fc fix: update layout for Claude app type provider display (#87)
* feat: add .node-version file with Node.js version 22.4.1

* fix: update layout for Claude app type provider display
2025-10-05 11:09:03 +08:00
Jason
e0908701b4 Remove deprecated VS Code Codex integration 2025-10-03 20:03:55 +08:00
Lakr
d86994eb7e feat: support kat-coder & template value (#77) 2025-10-02 22:14:35 +08:00
Jason
94e93137a2 chore: bump version to 3.4.0
- Add i18next internationalization with Chinese/English support
- Add Claude plugin sync alongside VS Code integration
- Extend provider presets with new models (DeepSeek-V3.2-Exp, Qwen3-Max, GLM-4.6)
- Support portable mode and single instance enforcement
- Add tray minimize and macOS Dock visibility management
- Improve Settings UI with scrollable layout and save icon
- Fix layout shifts and provider toggle consistency
- Remove unnecessary OpenAI auth requirement
- Update Windows MSI installer to target per-user LocalAppData
v3.4.0
2025-10-02 09:59:38 +08:00
Jason
db832a9654 fix: eliminate layout shift when switching app types with Claude plugin sync
- Separate sync button containers for Codex and Claude modes
- Only render the container in corresponding app type to prevent layout jumping
- Apply same fix pattern as commit 0bcc04a for VS Code sync button
2025-10-01 21:33:29 +08:00
Jason
45a639e73f feat: add optional apiKeyUrl field to provider presets
Allow third-party providers to specify a dedicated API key URL separate from the main website URL for easier key acquisition.
2025-10-01 21:28:09 +08:00
Jason
f74d641f86 Add Claude plugin sync alongside VS Code integration 2025-10-01 21:23:55 +08:00
Jason
fcfa9574e8 Update AI model versions in provider presets
- Update DeepSeek model from V3.1-Terminus to V3.2-Exp
- Update ModelScope model from GLM-4.5 to GLM-4.6
2025-09-30 22:19:20 +08:00
Jason
d739bb36e5 feat: add macOS Dock visibility management for tray mode
- Hide Dock icon when minimizing to tray
- Show Dock icon when restoring window from tray
- Apply appropriate activation policy (Accessory/Regular) based on window state
- Add error handling with logging for Dock operations
2025-09-29 17:03:13 +08:00
Jason
0bcc04adce fix: eliminate layout shift when switching between Claude and Codex
- Wrap VS Code sync button in fixed-width container to maintain stable layout
- Only render the container in Codex mode to avoid unnecessary space in Claude mode
- Change card transition from 'all' to specific properties (border-color, box-shadow) to prevent layout animations
- These changes prevent the horizontal position jumping of provider cards during app switching
2025-09-28 23:23:43 +08:00
Jason
fee0762e3e fix: improve Enable/In Use button consistency with fixed width and icons 2025-09-28 23:00:43 +08:00
Jason
1a8ae85e55 refactor: simplify language settings UI by removing description text and general section 2025-09-28 22:40:14 +08:00
Jason
c5aa244d65 feat: integrate language switcher into settings with modern segment control UI
- Move language switcher from header to settings modal for better organization
- Implement modern segment control UI instead of radio buttons for language selection
- Add language preference persistence in localStorage and backend settings
- Support instant language preview with cancel/revert functionality
- Remove standalone LanguageSwitcher component
- Improve initial language detection logic (localStorage -> browser -> default)
- Add proper i18n keys for language settings UI text
2025-09-28 22:23:49 +08:00
Jason
0bedbb2663 feat: change default language to Chinese with English fallback 2025-09-28 21:11:22 +08:00
TinsFox
5f3caa1484 feat: integrate i18next for internationalization support (#65)
* feat: integrate i18next for internationalization support

- Added i18next and react-i18next dependencies for localization.
- Updated various components to utilize translation functions for user-facing text.
- Enhanced user experience by providing multilingual support across the application.

* feat: improve i18n implementation with better translations and accessibility

- Add proper i18n keys for language switcher tooltips and aria-labels
- Replace hardcoded Chinese console error messages with i18n keys
- Add missing translation keys for new UI elements
- Improve accessibility with proper aria-label attributes

---------

Co-authored-by: Jason <farion1231@gmail.com>
2025-09-28 20:47:44 +08:00
farion1231
fd0e83ebd5 fix: remove unnecessary openai auth requirement from third-party config
Remove the env_key and requires_openai_auth fields from third-party provider config generation as they are not needed for custom API endpoints.
2025-09-28 09:53:55 +08:00
farion1231
e969bdbd73 feat: improve SettingsModal UX with scrolling and save icon
- Add scrollable content area with max height constraint
- Add Save icon to save button for better visual clarity
2025-09-27 11:20:37 +08:00
Jason
7435a34c66 update roadmap 2025-09-26 21:57:38 +08:00
ShaSan
5d2d15690c feat: support minimizing window to tray on close (#41)
fix: grant set_skip_taskbar permission through default capability

chore: align settings casing and defaults between Rust and frontend

Co-authored-by: Jason <farion1231@gmail.com>
2025-09-26 20:18:11 +08:00
farion1231
11ee8bddf7 refactor: consolidate chatgpt.config cleanup logic
Merged duplicate try-catch blocks that handle invalid chatgpt.config values.
Now handles all edge cases (scalar values, arrays, empty objects) in a single
unified check, reducing code duplication and improving performance by parsing
JSON only once.
2025-09-26 09:27:56 +08:00
Jason
186c361a79 refactor: reorganize documentation structure
- Remove docs/ from .gitignore to track documentation files
- Delete completed plan documents (encrypted-config-plan.md, updater-plan.md)
- Add roadmap.md with project milestones and future features
2025-09-25 23:51:48 +08:00
Jason
cc1caea36d Add support for qwen3-max 2025-09-24 22:28:32 +08:00
Jason
9ede0ad27d feat: add portable mode support and improve update handling
- Add portable.ini marker file creation in GitHub Actions for portable builds
- Implement is_portable_mode() command to detect portable execution
- Redirect portable users to GitHub releases page for manual updates
- Change update URL to point to latest releases page
- Integrate portable mode detection in Settings UI
2025-09-24 11:25:33 +08:00
farion1231
20f0dd7e1c fix: improve per-user MSI installer component tracking
- Change File KeyPath to "no" and use registry value as KeyPath instead
- Add registry entry for better component state tracking
- Enhance uninstall cleanup to remove LocalAppData files and folders
2025-09-23 20:55:30 +08:00
Jason
4dd07dfd85 Switch MSI installer to per-user LocalAppData target 2025-09-23 14:41:28 +08:00
Jason
8c01be42fa feat: add single instance plugin to prevent multiple app instances
Integrates tauri_plugin_single_instance to ensure only one instance of the application
runs at a time. When attempting to launch a second instance, it will focus the existing
window instead.
2025-09-23 10:02:23 +08:00
Jason
aaf1af0743 release: bump version to v3.3.1
Add support for DeepSeek-V3.1-Terminus model with emergency hotfix release
v3.3.1
2025-09-22 23:31:59 +08:00
Jason
aeb0007957 feat: add support for DeepSeek-V3.1-Terminus 2025-09-22 23:20:50 +08:00
Jason
077d491720 release: bump version to 3.3.0
Update version across all package files and add comprehensive changelog for v3.3.0 release featuring VS Code integration, shared config snippets, enhanced Codex wizard, and cross-platform improvements.
v3.3.0
2025-09-22 22:50:07 +08:00
Jason
7e9930fe50 fix: stabilize provider action button width and improve visual consistency
- Set fixed width (76px) for enable/active buttons to prevent layout shift
- Hide play icon in active state to optimize space usage
- Add center alignment and nowrap to ensure consistent appearance
2025-09-22 22:16:47 +08:00
Jason
b17d915086 refactor: optimize React state updates and improve UI text clarity
- Use functional setState to ensure proper state updates in ProviderForm
- Improve Chinese UI text consistency in CodexConfigEditor:
  - Change "API 基础地址" to "API 请求地址" for clarity
  - Simplify "供应商官网" to "官网地址"
  - Update placeholder text for consistency
- Move requires_openai_auth to model_providers section in Codex config template
2025-09-22 16:25:58 +08:00