Commit Graph

5700 Commits

Author SHA1 Message Date
fullex
8efb738753 refactor(StreamingService): implement immutable updates for session and message handling
- Updated the StreamingService to create new immutable instances of sessions and messages when adding blocks or applying updates. This change enhances cache notification mechanisms by ensuring that references are updated correctly.
- Improved the handling of block additions and message updates to maintain immutability, which aids in better state management and performance.
2026-01-09 13:24:17 +08:00
fullex
c1e0de1a9a revert: remove v2 message handling and MESSAGE_CREATED event
Reverts commits:
- 47f20c566 feat(Messages): implement MESSAGE_CREATED event
- 16596fd9b feat(Messages): implement v2 migration for message handling

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-09 12:09:32 +08:00
fullex
5512a3cb0a chore(types): add TODO for v2 refactor addressing architectural issues
- Documented key architectural concerns in the types index file, including file size, responsibility separation, and organization of utility functions and constants.
- Suggested migration of certain types to shared packages for better maintainability and clarity.
2026-01-07 21:08:12 +08:00
fullex
cd778f3574 Merge branch 'main' of github.com:CherryHQ/cherry-studio into v2 2026-01-07 21:02:43 +08:00
fullex
190f7ba2e1 refactor(database-patterns): enhance schema guidelines and file organization
- Added new section on schema file organization, detailing principles and decision criteria for merging or separating table files.
- Updated file naming conventions for single and multi-table files, as well as helper utilities.
- Refactored import paths in various schema files to use the new `_columnHelpers` module instead of the deprecated `columnHelpers`.
- Removed obsolete `customSql.ts`, `columnHelpers.ts`, `messageFts.ts`, `tag.ts`, `entityTag.ts`, and other related files to streamline the codebase.

This refactor improves clarity in database schema management and aligns file organization with best practices.
2026-01-07 20:46:09 +08:00
kangfenmao
90cd06d23d chore: release v1.7.11
Updated version number to 1.7.11 in package.json and electron-builder.yml. Added release notes highlighting the introduction of the MCP Hub with Auto mode and various bug fixes, including improvements to the Chat and Editor components.
2026-01-07 18:50:28 +08:00
kangfenmao
8d56bf80dd chore: update GitHub Actions workflow to enable corepack for pnpm installation
Replaced the pnpm action setup with a corepack enable command to streamline dependency management in the workflow.
2026-01-07 18:46:07 +08:00
kangfenmao
7766438853 Revert "fix(SearchService): Fix inability to retrieve search results from Bing, Baidu, and Google"
This reverts commit b83fbc0ace.
2026-01-07 18:40:39 +08:00
kangfenmao
3ec6e1167f chore: release v1.7.10 2026-01-07 17:31:35 +08:00
Le Bao
b83fbc0ace
fix(SearchService): Fix inability to retrieve search results from Bing, Baidu, and Google
This commit fixes a bug where search results could not be retrieved from Bing, Baidu, and Google.
The root cause of this issue was a discrepancy in page content when the Electron window was hidden versus when it was visible. Additionally, the previous use of `did-finish-load` caused page jitter within the window, leading to sporadic failures in fetching search content.
To resolve this, I've enabled offscreen rendering, ensuring consistent page content regardless of window visibility. Furthermore, I've switched to using the `ready-to-show` event to ensure the complete page DOM is available before attempting to retrieve content, thereby eliminating the search bug.
* feat(fetch): add request throttling (already present in the original, keeping it)
Co-authored-by: suyao <sy20010504@gmail.com>
2026-01-07 17:23:17 +08:00
SuYao
040f4daa98
fix: enable reasoning cot bug (#12342) 2026-01-07 17:11:41 +08:00
Phantom
d0a1512f23
fix: optimize action component state management to prevent duplicate loading spinners (#12318)
* refactor: separate message extraction from rendering

Extract `lastAssistantMessage` memoization separately from rendering
`MessageContent` component, improving code clarity and separation of
concerns.

* feat: Replace manual loading state with AssistantMessageStatus tracking

* refactor: Replace loading state with status enum in translation action

- Add LoadingOutlined icon for preparing state
- Remove AssistantMessageStatus dependency
- Simplify streaming detection using local status state

* feat: Add logging and status sync for translation action

* feat: Refactor action component state management to be consistent with
translate action

Replace separate `isContented` and `isLoading` states with a single
`status` state that tracks 'preparing', 'streaming', and 'finished'
phases. Sync status with assistant message status and update footer
loading prop accordingly.

* fix: Add missing pauseTrace import to ActionTranslate component

* fix: Add missing break statements in assistant message status handling

* fix: Move pauseTrace call inside abort completion condition
2026-01-07 16:51:25 +08:00
Zhaolin Liang
2777af77d8
fix: paragraph handle and plus button not selectable (#12320) 2026-01-07 16:45:15 +08:00
LiuVaayne
6d15b0dfd1
feat(mcp): add MCP Hub server for multi-server tool orchestration (#12192)
* feat(mcp): add hub server type definitions

- Add 'hub' to BuiltinMCPServerNames enum as '@cherry/hub'
- Create GeneratedTool, SearchQuery, ExecInput, ExecOutput types
- Add ExecutionContext and ConsoleMethods interfaces

Amp-Thread-ID: https://ampcode.com/threads/T-019b4e7d-86a3-770d-82f8-9e646e7e597e
Co-authored-by: Amp <amp@ampcode.com>

* feat(mcp): implement hub server core components

- generator.ts: Convert MCP tools to JS functions with JSDoc
- tool-registry.ts: In-memory cache with 10-min TTL
- search.ts: Comma-separated keyword search with ranking
- runtime.ts: Code execution with parallel/settle/console helpers

Amp-Thread-ID: https://ampcode.com/threads/T-019b4e7d-86a3-770d-82f8-9e646e7e597e
Co-authored-by: Amp <amp@ampcode.com>

* feat(mcp): integrate hub server with MCP infrastructure

- Create HubServer class with search/exec tools
- Implement mcp-bridge for calling tools via MCPService
- Register hub server in factory with dependency injection
- Initialize hub dependencies in MCPService constructor
- Add hub server description label for i18n

Amp-Thread-ID: https://ampcode.com/threads/T-019b4e7d-86a3-770d-82f8-9e646e7e597e
Co-authored-by: Amp <amp@ampcode.com>

* test(mcp): add unit tests for hub server

- generator.test.ts: Test schema conversion and JSDoc generation
- search.test.ts: Test keyword matching, ranking, and limits
- runtime.test.ts: Test code execution, helpers, and error handling

Amp-Thread-ID: https://ampcode.com/threads/T-019b4e7d-86a3-770d-82f8-9e646e7e597e
Co-authored-by: Amp <amp@ampcode.com>

* docs(mcp): add hub server documentation

- Document search/exec tool usage and parameters
- Explain configuration and caching behavior
- Include architecture diagram and file structure

Amp-Thread-ID: https://ampcode.com/threads/T-019b4e7d-86a3-770d-82f8-9e646e7e597e
Co-authored-by: Amp <amp@ampcode.com>

* ♻️ refactor(hub): simplify dependency injection for HubServer

- Remove HubServerDependencies interface and setHubServerDependencies from factory
- Add initHubBridge() to mcp-bridge for direct initialization
- Make HubServer constructor parameterless (uses pre-initialized bridge)
- MCPService now calls initHubBridge() directly instead of factory setter
- Add integration tests for full search → exec flow

* 📝 docs(hub): add comments explaining why hub is not in builtin list

- Add JSDoc to HubServer class explaining its purpose and design
- Add comment to builtinMCPServers explaining hub exclusion
- Hub is a meta-server for LLM code mode, auto-enabled internally

*  feat: add available tools section to HUB_MODE_SYSTEM_PROMPT

- Add shared utility for generating MCP tool function names (serverName_toolName format)
- Update hub server to use consistent function naming across search, exec and prompt
- Add fetchAllActiveServerTools to ApiService for renderer process
- Update parameterBuilder to include available tools in auto/hub mode prompt
- Use CacheService for 1-minute tools caching in hub server
- Remove ToolRegistry in favor of direct fetching with caching
- Update search ranking to include server name matching
- Fix tests to use new naming format

Amp-Thread-ID: https://ampcode.com/threads/T-019b6971-d5c9-7719-9245-a89390078647
Co-authored-by: Amp <amp@ampcode.com>

* ♻️ refactor: consolidate MCP tool name utilities into shared module

- Merge buildFunctionCallToolName from src/main/utils/mcp.ts into packages/shared/mcp.ts
- Create unified buildMcpToolName base function with options for prefix, delimiter, maxLength, existingNames
- Fix toCamelCase to normalize uppercase snake case (MY_SERVER → myServer)
- Fix maxLength + existingNames interaction to respect length limit when adding collision suffix
- Add comprehensive JSDoc documentation
- Update tests and hub.test.ts for new lowercase normalization behavior

*  feat: isolate hub exec worker and filter disabled tools

* 🐛 fix: inline hub worker source

* 🐛 fix: sync hub tool cache and map

* Update import path for buildFunctionCallToolName in BaseService

*  feat: refine hub mode system prompt

* 🐛 fix: propagate hub tool errors

* 📝 docs: clarify hub exec return

*  feat(hub): improve prompts and tool descriptions for better LLM success rate

- Rewrite HUB_MODE_SYSTEM_PROMPT_BASE with Critical Rules section
- Add Common Mistakes to Avoid section with examples
- Update exec tool description with IMPORTANT return requirement
- Improve search tool description clarity
- Simplify generator output with return reminder in header
- Add per-field @param JSDoc with required/optional markers

Fixes issue where LLMs forgot to return values from exec code

* ♻️ refactor(hub): return empty string when no tools available

*  feat(hub): add dedicated AUTO_MODE_SYSTEM_PROMPT for auto mode

- Create self-contained prompt teaching XML tool_use format
- Only shows search/exec tools (no generic examples)
- Add complete workflow example with common mistakes
- Update parameterBuilder to use getAutoModeSystemPrompt()
- User prompt comes first, then auto mode instructions
- Skip hub prompt when no tools available

* ♻️ refactor: move hub prompts to dedicated prompts-code-mode.ts

- Create src/renderer/src/config/prompts-code-mode.ts
- Move HUB_MODE_SYSTEM_PROMPT_BASE and AUTO_MODE_SYSTEM_PROMPT_BASE
- Move getHubModeSystemPrompt() and getAutoModeSystemPrompt()
- Extract shared buildToolsSection() helper
- Update parameterBuilder.ts import

* ♻️ refactor: add mcpMode support to promptToolUsePlugin

- Add mcpMode parameter to PromptToolUseConfig and defaultBuildSystemPrompt
- Pass mcpMode through middleware config to plugin builder
- Consolidate getAutoModeSystemPrompt into getHubModeSystemPrompt
- Update parameterBuilder to use getHubModeSystemPrompt

* ♻️ refactor: move getHubModeSystemPrompt to shared package

- Create @cherrystudio/shared workspace package with exports
- Move getHubModeSystemPrompt and ToolInfo to packages/shared/prompts
- Add @cherrystudio/shared dependency to @cherrystudio/ai-core
- Update promptToolUsePlugin to import from shared package
- Update renderer prompts-code-mode.ts to re-export from shared
- Add toolSetToToolInfoArray converter for type compatibility

* Revert "♻️ refactor: move getHubModeSystemPrompt to shared package"

This reverts commit 894b2fd487.

* Remove duplicate Tool Use Examples header from system prompt

* fix: add handleModeChange call in MCPToolsButton for manual mode activation

* style: update AssistantMCPSettings to use min-height instead of overflow for better layout control

* feat(i18n): add MCP server modes and truncate messages in multiple languages

- Introduced new "mode" options for MCP servers: auto, disabled, and manual with corresponding descriptions and labels.
- Added translations for "base64DataTruncated" and "truncated" messages across various language files.
- Enhanced user experience by providing clearer feedback on data truncation.

* Normalize tool names for search and exec in parser

* Clarify tool usage rules in code mode prompts and examples

* Clarify code execution instructions and update example usage

* refactor: simplify JSDoc description handling by removing unnecessary truncation

* refactor: optimize listAllActiveServerTools method to use Promise.allSettled for improved error handling and performance

---------

Co-authored-by: Amp <amp@ampcode.com>
Co-authored-by: kangfenmao <kangfenmao@qq.com>
2026-01-07 16:35:51 +08:00
beyondkmp
334b9bbe04
fix: disable differential package for nsis and dmg (#12335)
🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-07 16:22:40 +08:00
LiuVaayne
ed3401a016
⬆️ chore(deps): upgrade @anthropic-ai/claude-agent-sdk to 0.1.76 (#12317)
- Upgrade from 0.1.62 to 0.1.76 (latest stable)
- Remove version-specific patch (no longer needed)
2026-01-07 14:48:27 +08:00
Phantom
91b6ed81cc
fix(ProviderSettings): allow embedding model API check and optimize hooks (#12334) 2026-01-07 14:13:05 +08:00
Little White Dog
c940b5613f
fix: resolve ActionTranslate stalling after initialization (#12329)
* fix: resolve ActionTranslate stalling after initialization

Issue: When invoking translate from the selection assistant, the fetchResult function does not react to the completion of initialize, causing the ActionTranslate component to enter an infinite loading state.

Cause: In commit 680bda3993, the initialize effect hook was refactored into a callback function. This refactor omitted the notification that fetchResult should run after initialization, so fetchResult never executes post‑initialization.

Fix: Change the initialized flag from a ref to a state variable and have fetchResult listen to this state. This modification ensures the effect hook triggers fetchResult exactly once after initialization is complete.

* fix(ActionTranslate): fix missing dependency in useEffect hook

---------

Co-authored-by: icarus <eurfelux@gmail.com>
2026-01-07 11:53:10 +08:00
SuYao
6b0bb64795
fix: convert 'developer' role to 'system' for unsupported providers (#12325)
AI SDK v5 uses 'developer' role for reasoning models, but some providers
like Azure DeepSeek R1 only support 'system', 'user', 'assistant', 'tool'
roles, causing HTTP 422 errors.

This fix adds a custom fetch wrapper that converts 'developer' role back
to 'system' for providers that don't support it.

Fixes #12321

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Claude <noreply@anthropic.com>
2026-01-07 01:03:37 +08:00
Shemol
116ee6f94b
fix: TokenFlux models list empty in drawing panel (#12326)
Use fixed base URL for TokenFlux image API instead of provider.apiHost.

After migration 191, apiHost was changed to include /openai/v1 suffix
for chat API compatibility, but image API needs the base URL without
this suffix, causing /openai/v1/v1/images/models (wrong path).

Fixes #12284

Signed-off-by: SherlockShemol <shemol@163.com>
2026-01-06 22:19:03 +08:00
George·Dong
af7896b900
fix(prompts): standardize tool use example format to use 'A:' label consistently (#12313)
- Changed all 'Assistant:' labels to 'A:' in tool use examples for consistency
- Added missing blank line before final response in both files
- Affects promptToolUsePlugin.ts and prompt.ts
- Resolves #12310
2026-01-06 21:45:27 +08:00
beyondkmp
bb9b73557b
fix: use ipinfo lite API with token for IP country detection (#12312)
* fix: use ipinfo lite API with token for IP country detection

Switch from ipinfo.io/json to api.ipinfo.io/lite/me endpoint with
authentication token to improve reliability and avoid rate limiting.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>

* fix: use country_code field from ipinfo lite API response

The lite API returns country_code instead of country field.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-01-06 17:33:19 +08:00
Phantom
a5038ac844
fix: Add reasoning control for Deepseek hybrid inference models when reasoning effort is 'none' (#12314)
fix: Add reasoning control for Deepseek hybrid inference models when
reasoning effort is 'none'

It prevents warning
2026-01-06 17:28:34 +08:00
MyPrototypeWhat
d9f413b195
feat: implement core routing architecture with hybrid strategy (#11460) 2026-01-06 16:55:50 +08:00
beyondkmp
9e45f801a8
chore: optimize build excludes to reduce package size (#12311)
- Exclude config, patches directories
- Exclude app-upgrade-config.json
- Exclude unnecessary node_modules files (*.cpp, node-addon-api, prebuild-install)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-01-06 15:30:22 +08:00
yudong
313dac0f64
fix: Changed the ID of the doubao-seed-1-8 from '251215' to '251228' (#12307)
Co-authored-by: wangyudong <wangyudong@qiyi.com>
2026-01-06 15:17:22 +08:00
fullex
d60ed5d9e4 Merge branch 'main' of github.com:CherryHQ/cherry-studio into v2 2026-01-06 12:10:00 +08:00
MyPrototypeWhat
f1d5fbbbdc chore(dependencies): add @storybook/react and update pnpm-lock.yaml
- Added `@storybook/react` version 10.1.11 to the UI package's dependencies.
- Updated `pnpm-lock.yaml` to include the new `@storybook/react` package and ensure consistency across environments.

This commit enhances the UI component library by integrating Storybook for improved development and documentation.
2026-01-06 11:30:06 +08:00
MyPrototypeWhat
6833e30cef chore(dependencies): update package versions and restructure dependencies
- Removed outdated dependencies `js-yaml`, `bonjour-service`, and `emoji-picker-element-data` from `devDependencies`.
- Added `@radix-ui/primitive` and `@radix-ui/react-use-callback-ref` to `dependencies` in the UI package.
- Updated `pnpm-lock.yaml` to reflect changes in package versions and ensure consistency across environments.
- Cleaned up unnecessary resolutions in the UI package's `package.json`.

This commit enhances dependency management and ensures the project is aligned with the latest package versions.
2026-01-06 11:28:08 +08:00
fullex
26ea33f8c8 refactor(CacheService): change hook tracking from Set to Map for reference counting
- Updated the CacheService to replace the Set used for active hook tracking with a Map to maintain reference counts for each hook.
- Modified methods for registering and unregistering hooks to increment and decrement counts accordingly.
- Adjusted internal deletion checks to utilize the new reference counting mechanism.
- Updated mock implementations in tests to reflect the changes in hook tracking.

This refactor enhances the management of hook references, allowing for more precise control over hook usage and deletion.
2026-01-06 10:01:04 +08:00
SuYao
76ee67d4d7
fix: prevent OOM when handling large base64 image data (#12244)
* 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>
2026-01-06 00:34:14 +08:00
fullex
19cb1fc6ef feat(pnpm-lock): update dependencies and add new packages
- Added `stream-json` and `@radix-ui/react-switch` to dependencies with specified versions.
- Introduced new `@cherrystudio/ui` package with various dependencies for UI components.
- Updated existing packages and their versions, including `@swc/core` and `rollup-plugin-visualizer`, to ensure compatibility and performance improvements.
- Enhanced the lockfile with additional packages and their respective versions to maintain consistency across environments.

This commit improves the overall dependency management and ensures the project is up-to-date with the latest package versions.
2026-01-06 00:08:47 +08:00
fullex
2b815d8209 Merge branch 'main' of github.com:CherryHQ/cherry-studio into v2 2026-01-06 00:00:43 +08:00
fullex
47f20c5663 feat(Messages): implement MESSAGE_CREATED event for immediate message updates
- Added a new MESSAGE_CREATED event to EventService to facilitate optimistic UI updates when a user sends a message.
- Enhanced the Messages component to listen for MESSAGE_CREATED events, ensuring new messages appear instantly in the UI.
- Updated StreamingService to create new session objects for cache notifications, improving reactivity in the message display.
- Emitted MESSAGE_CREATED event in the sendMessage thunk to trigger cache updates for user messages.

This commit improves user experience by ensuring timely updates in the message list during interactions.
2026-01-05 23:52:57 +08:00
George·Dong
2a31fa2ad5
refactor: switch yarn to pnpm (#12260)
* 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>
2026-01-05 22:16:34 +08:00
fullex
16596fd9bb feat(Messages): implement v2 migration for message handling and streaming support
- Introduced a new `blocks` prop in Message components to allow direct passing of MessageBlock objects, enhancing compatibility with DataApi and Streaming paths.
- Updated MessageContent to prioritize the new `blocks` prop over legacy message blocks.
- Modified MessageGroup to support a `blocksMap` for DataApi, facilitating direct access to block objects.
- Enhanced Messages component to utilize a unified hook for routing between DataApi and legacy paths, improving message loading and rendering logic.
- Implemented event-driven cache clearing for streaming sessions to prevent UI flicker during data refresh.
- Updated MessageBlockRenderer to handle both string IDs and MessageBlock objects, allowing for a phased migration from Redux.

This commit lays the groundwork for a smoother transition to the new architecture while maintaining backward compatibility.
2026-01-05 21:06:33 +08:00
fullex
096259cf27 refactor(MessageService): enhance rowToMessage function to handle JSON parsing
- Updated rowToMessage to include a parseJson utility for handling both parsed objects and JSON strings from raw SQL queries.
- Ensured that data fields such as data, assistantMeta, modelMeta, and stats are correctly parsed when necessary.
- Added documentation to clarify the handling of JSON columns in Drizzle ORM.
2026-01-05 18:59:00 +08:00
SuYao
c4f372feba
fix(notes): prevent sticky folder z-index from overlapping webview (#12289)
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>
2026-01-05 18:16:08 +08:00
Nicolae Fericitu
ad164f2c1b
fix(i18n): update and refine Romanian translation (#12282)
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.
2026-01-05 15:23:49 +08:00
Phantom
ca3ddff00e
fix: replace nullish coalescing with logical OR in reasoning_content (#12281)
The change replaces ?? with || to avoid that reasoning_content is set as empty string
2026-01-05 14:42:58 +08:00
fullex
d50149dccb refactor(cache): migrate StreamingService to schema-defined cache keys
- Add 5 template keys in cacheSchemas.ts for streaming service:
  - message.streaming.session.${messageId}
  - message.streaming.topic_sessions.${topicId}
  - message.streaming.content.${messageId}
  - message.streaming.block.${blockId}
  - message.streaming.siblings_counter.${topicId}
- Replace xxxCasual methods with type-safe get/set/has/delete
- Update key naming to follow dot-separated convention
- Use `any` types temporarily (TODO for v2 type migration)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-05 13:33:41 +08:00
fullex
2093452e69 fix(cache): enforce dot-separated naming for template keys
- Update template key pattern to use dots instead of colons
  (e.g., 'scroll.position.${id}' not 'scroll.position:${id}')
- Template keys follow same naming convention as fixed keys
- Add example template keys to schema for testing
- Add comprehensive type tests for template key inference
- Update mock files to support template key types
- Update documentation with correct template key examples

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-05 13:17:58 +08:00
fullex
fb51df99d0 feat(cache): add template key support for useCache with type inference
- Add type utilities for template key matching (IsTemplateKey, ExpandTemplateKey, ProcessKey)
- Add InferUseCacheValue<K> for automatic value type inference from template patterns
- Update useCache hook to support template keys with default value fallback
- Extend ESLint rule to validate template key syntax (e.g., 'scroll.position:${id}')
- Update CacheService.get() docs: clarify | undefined return is intentional
  (developers need to know when value doesn't exist after deletion/TTL expiry)
- Update cache documentation with template key usage examples

BREAKING CHANGE: CacheService.get() now explicitly returns T | undefined
(was implicit before). Callers should use ?? defaultValue for fallback.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-05 12:23:19 +08:00
fullex
b6a1240bd8 chore: update CLAUDE.md for v2 migration details
- Clarified the Electron structure by removing Redux from the Renderer Process description.
- Enhanced the Data Layer section to specify the removal of Redux and Dexie, and the adoption of Cache/Preference/DataApi architecture.
- Updated the UI Layer section to reflect the removal of antd and styled-components, and the adoption of `@cherrystudio/ui` with Tailwind CSS and Shadcn UI.
- Introduced a file naming convention for ongoing migration with `*.v2.ts` suffix to indicate work-in-progress files.
- Added a new section for v2 refactoring to outline the major changes in the project structure and dependencies.
2026-01-05 10:15:42 +08:00
fullex
9b6c8f1f60 Merge branch 'main' of github.com:CherryHQ/cherry-studio into v2 2026-01-05 01:01:11 +08:00
fullex
6567d9d255 feat: update useDataApi hook and documentation for improved loading states and refetch logic
- Refactored `useQuery` and `useMutation` hooks to replace `loading` with `isLoading` for consistency in naming conventions.
- Enhanced `useQuery` to include `isRefreshing` state for better tracking of background revalidation.
- Updated documentation and examples to reflect changes in hook signatures and loading state management.
- Improved mock implementations in tests to align with the new hook signatures, ensuring accurate testing of loading states.
2026-01-05 00:12:01 +08:00
fullex
7cac5b55f6 feat: enhance cursor-based pagination in API documentation and types
- Added detailed explanations and examples for cursor semantics in `api-types.md`, clarifying the exclusive nature of cursors in pagination.
- Updated `CursorPaginationParams` interface to emphasize the cursor's role as an exclusive boundary in responses.
- Refactored `BranchMessagesQueryParams` to extend `CursorPaginationParams`, aligning with the new pagination logic.
- Modified `MessageService` to implement cursor-based pagination semantics, ensuring accurate message retrieval and response structure.
- Enhanced documentation throughout to provide clearer guidance on pagination behavior and usage patterns.
2026-01-04 22:31:15 +08:00
fullex
81bb8e7981 feat: implement new pagination types and enhance API documentation
- Introduced `OffsetPaginationParams`, `CursorPaginationParams`, and their corresponding response types to standardize pagination handling across the API.
- Updated existing API types and hooks to support both offset and cursor-based pagination, improving data fetching capabilities.
- Enhanced documentation with detailed usage examples for pagination, including request parameters and response structures, to aid developers in implementing pagination effectively.
- Refactored related components to utilize the new pagination types, ensuring consistency and clarity in data management.
2026-01-04 21:12:41 +08:00
Calvin Wade
b4aeced1f9 fix: thinking time on stop (#11900)
* 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>
2026-01-04 19:44:25 +08:00
kangfenmao
d27d750bc5 feat(i18n): add "open" label for app data directory in multiple languages 2026-01-04 19:36:46 +08:00