* fix: prevent OOM when handling large base64 image data
- Add memory-safe parseDataUrl utility using string operations instead of regex
- Truncate large base64 data in ErrorBlock detail modal to prevent freezing
- Update ImageViewer, FileStorage, messageConverter to use shared parseDataUrl
- Deprecate parseDataUrlMediaType in favor of shared utility
- Add GB support to formatFileSize
- Add comprehensive unit tests for parseDataUrl (18 tests)
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
* refactor: simplify parseDataUrl API to return DataUrlParts | null
- Change return type from discriminated union to simple nullable type
- Update all call sites to use optional chaining (?.)
- Update tests to use toBeNull() for failure cases
- More idiomatic and consistent with codebase patterns (e.g., parseJSON)
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
---------
Co-authored-by: Claude <noreply@anthropic.com>
* refactor: switch workflows from yarn to pnpm
Replace Yarn usage with pnpm in CI workflows to standardize package
management and leverage pnpm's store/cache behavior.
- Use pnpm/action-setup to install pnpm (v) instead of enabling corepack
and preparing Yarn.
- Retrieve pnpm store path and update cache actions to cache the pnpm
store and use pnpm-lock.yaml for cache keys and restores.
- Replace yarn commands with pnpm equivalents across workflows:
install, i18n:sync/translate, format, build:* and tsx invocation.
- Avoid committing lockfile changes by resetting pnpm-lock.yaml instead
of yarn.lock when checking for changes.
- Update install flags: use pnpm install --frozen-lockfile / --install
semantics where appropriate.
These changes unify dependency tooling, improve caching correctness,
and ensure CI uses pnpm-specific lockfile and cache paths.
* build: switch pre-commit hook to pnpm lint-staged
Update .husky/pre-commit to run pnpm lint-staged instead of yarn.
This aligns the pre-commit hook with the project's package manager
and ensures lint-staged runs using pnpm's environment and caching.
* chore(ci): remove pinned pnpm version from GH Action steps
Remove the explicit `with: version: 9` lines from multiple GitHub Actions workflows
(auto-i18n.yml, nightly-build.yml, pr-ci.yml, update-app-upgrade-config.yml,
sync-to-gitcode.yml, release.yml). The workflows still call `pnpm/action-setup@v4`
but no longer hardcode a pnpm version.
This simplifies maintenance and allows the action to resolve an appropriate pnpm
version (or use its default) without needing updates whenever the pinned
version becomes outdated. It reduces churn when bumping pnpm across CI configs
and prevents accidental pin drift between workflow files.
* build: Update pnpm to 10.27.0 and add onlyBuiltDependencies config
* Update @cherrystudio/openai to 6.15.0 and consolidate overrides
* Add @langchain/core to overrides
* Add override for openai-compatible 1.0.27
* build: optimize pnpm config and add missing dependencies
- Comment out shamefully-hoist in .npmrc for better pnpm compatibility
- Add React-related packages to optimizeDeps in electron.vite.config.ts
- Add missing peer dependencies and packages that were previously hoisted
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
* build: refine pnpm configuration and dependency management
- Simplify .npmrc to only essential electron mirror config
- Move platform-specific dependencies to devDependencies
- Pin sharp version to 0.34.3 for consistency
- Update sharp-libvips versions to 1.2.4
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
* reduce app size
* format
* build: remove unnecessary disableOxcRecommendation option from react plugin configuration
* docs: Replace yarn commands with pnpm in documentation and scripts
* Revert "build: optimize pnpm config and add missing dependencies"
This reverts commit acffad31f8.
* build: import dependencies from yarn.lock
* build: Add some phantom dependencies and reorganize dependencies
* build: Keep consistent by removing types of semver
It's not in the previous package.json
* build: Add some phantom dependencies
Keep same version with yarn.lock
* build: Add form-data dependency version 4.0.4
* Add chalk dependency
* build: downgrade some dependencies
Reference: .yarn-state-copy.yml. These phantom dependencies should use top-level package of that version in node_modules
* build: Add phantom dependencies
* build: pin tiptap dependencies to exact versions
Ensure consistent dependency resolution by removing caret ranges and pinning all @tiptap packages to exact version 3.2.0
* chore: pin embedjs dependencies to exact versions
* build: pin @modelcontextprotocol/sdk to exact version 1.23.0
Remove caret from version specifier to prevent automatic upgrades and ensure consistent dependencies
* chore: update @types/node dependency to 22.17.2
Update package.json and pnpm-lock.yaml to use @types/node version 22.17.2 instead of 22.19.3 to maintain consistency across dependencies
* build: move some dependencies to dev deps and pin dependency versions to exact numbers
Remove caret (^) from version ranges to ensure consistent dependency resolution across environments
* chore: move dependencies from prod to dev and update lockfile
Move @ant-design/icons, chalk, form-data, and open from dependencies to devDependencies
Update pnpm-lock.yaml to reflect dependency changes
* build: update package dependencies
- Add new dependencies: md5, @libsql/win32-x64-msvc, @strongtz/win32-arm64-msvc, bonjour-service, emoji-picker-element-data, gray-matter, js-yaml
- Remove redundant dependencies from devDependencies
* build: add cors, katex and pako dependencies
add new dependencies to support cross-origin requests, mathematical notation rendering and data compression
* move some js deps to dev deps
* test: update snapshot tests for Spinner and InputEmbeddingDimension
* chore: exclude .zed directory from biome formatting
* Update @ai-sdk/openai-compatible patch hash
* chore: update @kangfenmao/keyv-storage to version 0.1.3 in package.json and pnpm-lock.yaml
---------
Co-authored-by: icarus <eurfelux@gmail.com>
Co-authored-by: beyondkmp <beyondkmp@gmail.com>
Co-authored-by: Claude Sonnet 4.5 <noreply@anthropic.com>
Co-authored-by: kangfenmao <kangfenmao@qq.com>
Add `isolation: isolate` to NotesSidebar container to create a new
stacking context, preventing sticky folder elements (z-index: 1000+)
from overlapping MinApp webview when switching pages.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-authored-by: Claude <noreply@anthropic.com>
I have corrected several typos and refined the terminology in the ro-ro.json file for better linguistic accuracy. This update ensures translation consistency throughout the user interface.
* fix: preserve thinking time when stopping reply
Fixes#11886
Signed-off-by: Calvin <calvinvwei@gmail.com>
* fix: also preserve thinking time when stopping during thinking
This extends the previous fix to also handle the case when the user
stops the reply while thinking is still in progress (not just after
thinking is complete).
Signed-off-by: Calvin <calvinvwei@gmail.com>
* fix: auto-complete thinking when text output starts
This fixes the issue where the thinking timer continues running after
thinking is complete and text output begins. Some AI providers don't
send a reasoning-end event explicitly, so we now auto-complete thinking
when a text-start event is received with accumulated reasoning content.
Fixes#11796
Signed-off-by: Calvin <calvinvwei@gmail.com>
* refactor: extract emitThinkingCompleteIfNeeded to reduce duplication
Extract the shared logic for emitting THINKING_COMPLETE chunk into a
reusable method. This removes code duplication between text-start and
reasoning-end event handlers as suggested in code review.
Signed-off-by: Calvin <calvinvwei@gmail.com>
---------
Signed-off-by: Calvin <calvinvwei@gmail.com>
* feat(code-tools): add 302.AI as Claude Code provider
* feat(agent): add 302.AI anthropicApiHost to enable Agent support
302.AI now supports Claude Code (Agent) functionality by configuring
the anthropicApiHost endpoint. Users can use 302.AI's Claude models
(claude-sonnet-4-20250514, claude-opus-4-20250514) with Agent.
* feat(migrate): add migration 192 to set 302ai API host
- Add session-based user data persistence using Electron partitions
- Implement multi-tab support with tab management operations
- Add new tools: create_tab, list_tabs, close_tab, switch_tab
- Update existing tools (open, execute, fetch, reset) to support tabId parameter
- Refactor controller to manage sessions with multiple tabs
- Add comprehensive documentation in README.md
- Add TypeScript interfaces for SessionInfo and TabInfo
BREAKING CHANGE: Controller now manages sessions with tabs instead of single windows per session
* refactor(translate): remove default temperature setting
* refactor(translate): Remove temperature setting from language detection
prompt
* refactor: Set default translate languages from user settings
Initialize target language from user's language setting, falling back to
zh-CN if unknown. Set alter language to en-US by default. Remove
redundant logic that was duplicated in the effect.
* fix(translate): translate action won't trigger twice
* fix(translate): Fix getLanguageByLangcode to return built-in language
when not loaded
Previously, the function would always return UNKNOWN if the languages
were not loaded, even for built-in language codes. This change ensures
built-in languages are returned if found, regardless of the load state.
* fix: Expose translation languages loaded state and fix initialization
Add `isLoaded` flag to `useTranslate` hook to track when translation
languages are available. Use this flag to prevent premature
initialization in `ActionTranslate` component, ensuring language lookups
succeed before creating assistants and topics.
Add error logging for failed custom language loading and update fallback
warning messages for better debugging.
* fix: set initialized when finished
Fixes an Electron bug where zoom factor resets during route changes by listening to the 'did-navigate-in-page' event and reapplying the configured zoom factor.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-authored-by: Claude Sonnet 4.5 <noreply@anthropic.com>
* feat(i18n): add Romanian localization (ro-RO)
Added the ro-ro.json file to provide Romanian language support for the Cherry Studio interface.
This commit introduces a high-quality, professional translation for the Romanian language. The localization has been carefully reviewed to ensure linguistic accuracy and terminology consistency, so no further adjustments from other contributors are required at this stage. Thank you!
* chore: move ro-ro.json to translate folder and register in index.ts
Moved the Romanian translation file to the translate directory and updated the i18n index to support the automated workflow as requested.
* Delete src/renderer/src/i18n/locales/ro-ro.json
* chore: add ro-ro.json to translate folder
Finalized the relocation of the Romanian translation file to the translate directory to support the automated i18n workflow.
* chore(i18n): remove trailing comma in index.ts
Biome formatter removed trailing comma for consistency.
* feat(i18n): add Romanian (ro-RO) to language selector
Add Romanian language option in settings with Română label and 🇷🇴 flag.
* fix(i18n): add Romanian language support
- Add ro-RO to LanguageVarious type
- Add Romanian to language selector in settings
- Add emoji picker fallback to English (no Romanian CLDR data)
* feat: Add Romanian to auto-translation language map
* fix: Add Romanian language support in main
* fix: Add Romanian (ro-RO) locale support for AntdProvider
* fix: Add Romanian language support to smooth stream segmenter
* fix: Add Romanian translations for assistant preset groups
---------
Co-authored-by: George·Dong <GeorgeDong32@qq.com>
Co-authored-by: icarus <eurfelux@gmail.com>
Remove the confusing V2 naming from message thunk functions to avoid conflicts with the upcoming real V2 data refactoring.
Changes:
- Inline V2 function implementations directly into messageThunk.ts
- Replace V2 function calls with direct dbService calls
- Remove messageThunk.v2.ts file
- Remove misleading "V2 DATA&UI REFACTORING" header comments
The V2 suffix was originally added for agent session support, not for a data layer refactoring. This cleanup clears the naming space for the actual V2 refactoring work.
* fix(ovms): make ovms manager windows-only and lazy load it
Add platform check in OvmsManager constructor to throw error on non-Windows platforms
Lazy load ovmsManager instance and handle IPC registration only on Windows
Update will-quit handler to conditionally cleanup ovms resources
* feat(preload): add windows-only OVMS API and improve type safety
Extract OVMS API methods into a separate windowsOnlyApi object for better organization
Add explicit return type for getDeviceType method
* feat(system): add system utils and refine ovms support check
- Add new system utility functions for device type, hostname and CPU name
- Refactor OVMS support check to require both Windows and Intel CPU
- Update IPC handlers to use new system utils and provide proper OVMS fallbacks
* Revert "feat(preload): add windows-only OVMS API and improve type safety"
This reverts commit d7c5c2b9a4.
* feat(ovms): add support check for ovms provider
Add new IPC channel and handler to check if OVMS is supported on the current system. This replaces the previous device type and CPU name checks with a more maintainable solution.
* fix(OvmsManager): improve intel cpu check for ovms manager
Move isOvmsSupported check before class definition and update error message to reflect intel cpu requirement
* fix: use isOvmsSupported flag for ovms cleanup check
Replace platform check with feature flag to properly determine if ovms cleanup should run
* fix: improve warning message for undefined ovmsManager
* fix(system): handle edge cases in getCpuName function
Add error handling and null checks to prevent crashes when CPU information is unavailable
* feat(runtime): add ovms support check during app init
Add isOvmsSupported state to runtime store and check support status during app initialization. Move ovms support check from ProviderList component to useAppInit hook for centralized management.
* feat: add fuzzy search for file list with relevance scoring
- Add fuzzy option to DirectoryListOptions (default: true)
- Implement isFuzzyMatch for subsequence matching
- Add getFuzzyMatchScore for relevance-based sorting
- Remove searchByContent method (content-based search)
- Increase maxDepth to 10 and maxEntries to 20
* perf: optimize fuzzy search with ripgrep glob pre-filtering
- Add queryToGlobPattern to convert query to glob pattern
- Use ripgrep --iglob for initial filtering instead of loading all files
- Reduces memory footprint and improves performance for large directories
* feat: add greedy substring match fallback for fuzzy search
- Add isGreedySubstringMatch for flexible matching
- Fallback to greedy match when glob pre-filter returns empty
- Allows 'updatercontroller' to match 'updateController.ts'
* fix: improve greedy substring match algorithm
- Search from longest to shortest substring for better matching
- Fix issue where 'updatercontroller' couldn't match 'updateController'
* docs: add fuzzy search documentation (en/zh)
* refactor: extract MAX_ENTRIES_PER_SEARCH constant
* refactor: use logarithmic scaling for path length penalty
- Replace linear penalty (0.8 * length) with logarithmic scaling
- Prevents long paths from dominating the score
- Add PATH_LENGTH_PENALTY_FACTOR constant with explanation
* refactor: extract scoring constants with documentation
- Add named constants for scoring factors (SCORE_SEGMENT_MATCH, etc.)
- Update en/zh documentation with scoring strategy explanation
* refactor: move PATH_LENGTH_PENALTY_FACTOR to class level constant
* refactor: extract buildRipgrepBaseArgs helper method
- Reduce code duplication for ripgrep argument building
- Consolidate directory exclusion patterns and depth handling
* refactor: rename MAX_ENTRIES_PER_SEARCH to MAX_SEARCH_RESULTS
* fix: escape ! character in glob pattern for negation support
* fix: avoid duplicate scoring for filename starts and contains
* docs: clarify fuzzy search filtering and scoring strategies
* fix: limit word boundary bonus to single match
* fix: add dedicated scoring for greedy substring match
- Add getGreedyMatchScore function that rewards fewer fragments and tighter matches
- Add isFuzzyMatch validation before scoring in fuzzy glob path
- Use greedy scoring for fallback path to properly rank longest matches first
Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>
---------
Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>
* feat(tokenflux): add Anthropic host support using OpenRouter package
- Add anthropicApiHost to TokenFlux provider config
- Map TokenFlux to OpenRouter in STATIC_PROVIDER_MAPPING for full compatibility
* feat(tokenflux): update API URLs and add migration
- Update apiHost to https://api.tokenflux.ai/openai/v1
- Update anthropicApiHost to https://api.tokenflux.ai/anthropic
- Add migration 191 to update existing TokenFlux users
* fix(tokenflux): add to Anthropic compatible providers list
Enable Anthropic API host configuration in TokenFlux provider settings UI
- Added deprecation notices to various services and components, indicating they are scheduled for removal in v2.0.0.
- Noted that feature PRs affecting these files are currently blocked, and only critical bug fixes will be accepted during the migration phase.
- Provided context and status links for ongoing v2 refactoring efforts.
This change is part of the preparation for the upcoming major version update.
* fix(ollama): improve reasoningEffort handling in providerOptions
* fix(ollama): update reasoning effort handling and add support for gpt-oss models
* fix(ollama): update think option to support 'low', 'medium', and 'high' values
* fix(ollama): update comment to clarify accepted reasoning effort values for gpt-oss models
feat(AssistantsTab): prevent deleting last assistant and add error message
Add validation to prevent deleting the last assistant and show an error message when attempted. Also simplify the active assistant assignment logic when deleting an assistant.
- Replace Array.find() with Map.get() for modelStatus lookup
- Add useMemo to create modelStatusMap from modelStatuses array
- Stabilize onEditModel callback with useCallback to prevent memo invalidation
Fixes#12035
Signed-off-by: SherlockShemol <shemol@163.com>
- Changed ollama provider type from 'openai' to 'ollama' in SYSTEM_PROVIDERS_CONFIG.
- Incremented persisted reducer version from 189 to 190.
- Added migration logic for version 190 to update existing provider types in state.
Remove incorrect /anthropic suffix from aihubmix provider's anthropicApiHost configuration.
The correct API endpoint should be https://aihubmix.com/v1/messages, not https://aihubmix.com/anthropic/v1/messages.
Fixes issue where Claude API requests to aihubmix provider were failing due to incorrect URL path.