Commit Graph

4258 Commits

Author SHA1 Message Date
SuYao
56bfa95d08
fix(header): resolve User-Agent forbidden header in renderer process (#12549)
* fix(header): merge user-agent add header gracefully

* fix(test): mock os release

* fix(test): again
2026-01-23 14:18:28 +08:00
beyondkmp
858a5ceaec
feat: add Linux system title bar setting option (#12040)
* feat: add Linux system title bar setting option

Add a setting in Display Settings that allows Linux users to switch
between custom title bar (frameless window with WindowControls) and
native system title bar. The setting requires app restart to take effect
since Electron's frame option cannot be changed at runtime.

- Add useSystemTitleBar config key and getter/setter in ConfigManager
- Add IPC channel and handler for setting persistence
- Add Redux state and action for useSystemTitleBar
- Add UI toggle in DisplaySettings (Linux only)
- Hide WindowControls when system title bar is enabled on Linux
- Modify WindowService to check setting when creating window on Linux
- Add translations for all supported locales

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

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

* fix: improve window controls positioning in left navbar layout

Move WindowControls inside NavbarContainer as a flex item instead of
using fixed positioning. This ensures the window controls are properly
positioned adjacent to the navbar content when using the left navbar
layout.

- Remove position: fixed from WindowControlsContainer styling
- Include WindowControls as last child of NavbarContainer
- Remove extra padding-right from NavbarRight since controls are now
  in the flex layout

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

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

* fix: remove padding-right from TabsBar to align window controls to edge

Remove the 8px padding-right for Windows/Linux in TabsBar that was
causing window controls to not be flush against the window edge.

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

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

* fix: add right padding for settings button when Linux uses system title bar

* fix: restore NavbarRight paddingRight to 15px for consistent spacing

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

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-01-23 13:52:09 +08:00
SuYao
1f209dc280
fix: memoize provider selectors to prevent infinite re-renders (#12550)
The normalizeProvider() calls inside useAppSelector callbacks were
creating new object references on every render, causing infinite
re-render loops in components that depend on provider objects.

This fix uses createSelector from Redux Toolkit to properly memoize
the normalized providers, preventing unnecessary re-renders in:
- GithubCopilotSettings (useEffect depends on provider)
- Painting pages (useAllProviders returns new array each render)

Fixes the "Maximum update depth exceeded" error introduced in 8186d4fa.

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-22 14:27:52 +08:00
SuYao
f84941f91f
feat(notes): add export to Word functionality (#12393)
* feat(notes): add export to Word functionality

Add a menu item in the Notes page to export the current note to a Word document.
The feature leverages the existing ExportService which converts markdown to docx format.

Changes:
- Add "Export to Word" menu item in MenuConfig.tsx
- Add handleExportToWord handler in HeaderNavbar.tsx
- Add i18n translations for all supported languages

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

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

* feat(i18n): Update translations for multiple languages to improve export functionality

Updated the translation files for German, Greek, Spanish, French, Japanese, Portuguese, Romanian, and Russian to provide accurate translations for export-related messages. This includes phrases for exporting to Word and handling content export scenarios, ensuring a consistent user experience across different languages.

---------

Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: kangfenmao <kangfenmao@qq.com>
2026-01-22 11:49:43 +08:00
George·Dong
c03475f5db
fix(code-tools): support custom provider & fix Windows Terminal Issue (#12504)
* fix(code-tools): support custom Anthropic and OpenAI-Response providers

* refactor: use --config option in codex

* fix(codex): fix OpenAI Codex config parameters

* fix(security): redact sensitive env vars in CodeToolsService logs

* fix(code-tools): increase temp file cleanup delay for Windows Terminal
2026-01-22 11:25:56 +08:00
Shemol
ed54bf8810
refactor(ThinkingEffect): replace useState+useEffect with useMemo (#12536)
refactor(ThinkingEffect): replace useState+useEffect with useMemo for derived state

The messages array is purely derived from content and isThinking props,
not fetched from an API. Using useState+useEffect for derived state is
a React anti-pattern that causes unnecessary re-renders.

This change:
- Removes lodash isEqual dependency
- Reduces code complexity
- Avoids double render cycle

Signed-off-by: SherlockShemol <shemol@163.com>
2026-01-21 14:53:45 +08:00
Nicolae Fericitu
3775af07c2
feat(i18n): Update Romanian localization (ro-RO) (#12471)
* fix(i18n): update and refine Romanian translation

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.

* i18n: Update and fix Romanian localization (ro-RO)

The Romanian localization file has been updated. 

Necessary corrections have been applied to address issues identified during an interface review, ensuring consistent terminology and improved message clarity.

* i18n: Capitalize "Users" label for UI consistency

Updated the "users" key in ro-ro.json to use an uppercase initial. This ensures visual consistency with other menu items in the settings section (User Management).

* Update Romanian localization (ro-RO)

* fix(i18n): update topic time translation for clarity

Updated settings.topic.show.time to "Afișează ora subiectului" to maintain context as requested by reviewer.

* feat(i18n): Update and refine Romanian localization (ro-RO)

Hi! I have updated the Romanian localization file (`ro-ro.json`) to improve the overall user experience.

Key changes:
- Refined terminology for better UI consistency (e.g., changed "folder" to "dosar").
- Fixed grammar and phrasing to ensure a more natural flow.
- Synced the branch with the latest upstream changes.

All checks have passed, and the translation is now ready for review. Thank you!
2026-01-20 21:33:09 +08:00
Shemol
d64b388920
refactor: convert nested component to render function in settings popups (#12508) 2026-01-19 18:49:46 +08:00
Tim
dc3cee978a
feat: integrate Kimi CLI into Code Tools (#12511)
* feat: integrate Kimi CLI into Code Tools

- Add Kimi CLI as a new code tool option in Code Tools page
- Support OpenAI-compatible models for Kimi CLI
- Use uvx to automatically download and run kimi-cli (Python package)
- Configure environment variables (OPENAI_API_KEY, OPENAI_BASE_URL, OPENAI_MODEL)
- Skip installation check as uvx handles package management automatically

Changes:
- Add kimiCli to codeTools enum
- Add Kimi CLI to CLI_TOOLS list with label
- Add provider filter for OpenAI-compatible providers
- Add environment variable generation logic
- Add model filtering logic in UI
- Special handling in CodeToolsService to use uvx instead of bun
- Skip installation process for kimi-cli as uvx auto-downloads

This integration allows users to launch Kimi CLI directly from Cherry Studio
without manual installation, leveraging uvx for seamless Python package management.

* Update src/renderer/src/pages/code/index.ts

Co-authored-by: George·Dong <98630204+GeorgeDong32@users.noreply.github.com>

* Update src/main/services/CodeToolsService.ts

Co-authored-by: George·Dong <98630204+GeorgeDong32@users.noreply.github.com>

* Update src/renderer/src/pages/code/CodeToolsPage.tsx

Co-authored-by: George·Dong <98630204+GeorgeDong32@users.noreply.github.com>

* fix: remove extra blank line in CodeToolsPage.tsx for biome format compliance

---------

Co-authored-by: xiaoju111a <xiaoju111a@users.noreply.github.com>
Co-authored-by: George·Dong <98630204+GeorgeDong32@users.noreply.github.com>
2026-01-19 14:03:15 +08:00
fullex
6ee1157165 fix(LoggerService): update logging mechanism to use ipcRenderer.invoke for main process communication 2026-01-19 00:02:42 +08:00
AdySnowflake
7aca974dab
Fix the API preview link for Azure OpenAI completion mode (#12500)
Update ProviderSetting.tsx
2026-01-17 21:09:24 +08:00
SuYao
8186d4fa29
fix: handle trailing slashes in API URLs for image generation (#12492)
fix: normalize provider apiHost at source to handle trailing slashes

Normalize provider apiHost by removing trailing slashes in useProvider.ts
selectors. This ensures consistent URL concatenation across the entire
application, including image generation pages, without modifying each
usage point individually.

Fixes #12485

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-16 23:05:13 +08:00
pippo
0880435c06
feat(baichuan):add baichuan-m3 models (#12478)
Co-authored-by: roberto <roberto@baichuan-inc.com>
2026-01-15 21:26:51 +08:00
Nicolae Fericitu
30bcd8f801
feat(i18n): Update Romanian localization (ro-RO) (#12438)
* fix(i18n): update and refine Romanian translation

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.

* i18n: Update and fix Romanian localization (ro-RO)

The Romanian localization file has been updated. 

Necessary corrections have been applied to address issues identified during an interface review, ensuring consistent terminology and improved message clarity.

* i18n: Capitalize "Users" label for UI consistency

Updated the "users" key in ro-ro.json to use an uppercase initial. This ensures visual consistency with other menu items in the settings section (User Management).

* Update Romanian localization (ro-RO)

* fix(i18n): update topic time translation for clarity

Updated settings.topic.show.time to "Afișează ora subiectului" to maintain context as requested by reviewer.
2026-01-14 17:05:42 +08:00
ZhuangYumin
c1b0a18fef
fix: switch to new URL in qwen miniapp (#12460) 2026-01-14 17:01:33 +08:00
槑囿脑袋
262d32ac17
fix: remove mineru built-in api key (#12455) 2026-01-14 16:52:55 +08:00
SuYao
ac23c7f30b
fix(aiCore): preserve conversation history for image enhancement models (#12239)
* fix(aiCore): preserve conversation history for image enhancement models

- Changed image enhancement model handling to preserve full conversation context
- Only merge images from previous assistant message into last user message
- Return messages as-is when no images need to be merged
- Added test case for LLM-to-image-model switching scenario

This allows users to switch from LLM conversations to image generation models
while keeping the conversation context for guiding image generation.

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

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

* chore: format

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-01-14 14:23:19 +08:00
SuYao
9414f13f6d
fix: 修改请求体字段名 (#12430)
Some checks failed
Auto I18N Weekly / Auto I18N (push) Has been cancelled
2026-01-12 16:38:55 +08:00
flt6
cbeda03acb
use cumsum in anthropic cache (#12419)
* use cumsum in anthropic cache

* fix types and refactor addCache in anthropicCacheMiddleware
2026-01-12 15:49:33 +08:00
George·Dong
cea36d170b
fix(qwen-code): format baseUrl with /v1 for OpenAI-compatible tools (#12418)
The Qwen Code tool was failing with 'Model stream ended without a finish reason'
because the OPENAI_BASE_URL environment variable was not properly formatted.

This fix adds /v1 suffix to the baseUrl when it's missing for OpenAI-compatible
tools (qwenCode, openaiCodex, iFlowCli).

Changes:
- Import formatApiHost from @renderer/utils/api
- Use formatApiHost to format baseUrl before passing to environment variables
- Add unit tests for the URL formatting behavior
2026-01-12 13:41:27 +08:00
Nicolae Fericitu
d84b84eb2f
i18n: Major improvements to Romanian (ro-RO) localization (#12428)
* fix(i18n): update and refine Romanian translation

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.

* i18n: Update and fix Romanian localization (ro-RO)

The Romanian localization file has been updated. 

Necessary corrections have been applied to address issues identified during an interface review, ensuring consistent terminology and improved message clarity.

* i18n: Capitalize "Users" label for UI consistency

Updated the "users" key in ro-ro.json to use an uppercase initial. This ensures visual consistency with other menu items in the settings section (User Management).
2026-01-12 10:58:38 +08:00
SuYao
c7c380d706
fix: disable strict JSON schema for OpenRouter to support MCP tools (#12415)
* fix: update dependencies and patch files for strict JSON schema compliance

- Updated `@ai-sdk/openai-compatible` to include version 1.0.30 and adjusted related patch files.
- Removed obsolete patch for `@ai-sdk/openai-compatible@1.0.28`.
- Added new patch for `@openrouter/ai-sdk-provider` to support strict JSON schema options.
- Modified `options.ts` to set `strictJsonSchema` to false for OpenAI models.
- Enhanced OpenAI compatible provider options to include `sendReasoning` and `strictJsonSchema`.
- Updated lockfile to reflect changes in patched dependencies and their hashes.

* fix: filter strictJsonSchema from request body in OpenRouter patch

- Destructure and remove strictJsonSchema from openrouterOptions before spreading into request body
- This prevents sending the internal option to the OpenRouter API

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

---------

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-10 21:55:09 +08:00
Copilot
622e3f0db6
feat: Add year to topic timestamp and improve unpin UX (#12408)
* Initial plan

* feat: Add year to topic time display format

Co-authored-by: GeorgeDong32 <98630204+GeorgeDong32@users.noreply.github.com>

* fix: improve topic unpin UX by moving to top of unpinned list

- Unpinned topics now move to the top of the unpinned section
- List automatically scrolls to the unpinned topic position
- Keeps the requirement to unpin before deleting pinned topics

Closes #12398

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: GeorgeDong32 <98630204+GeorgeDong32@users.noreply.github.com>
Co-authored-by: George·Dong <GeorgeDong32@qq.com>
2026-01-10 21:37:37 +08:00
fullex
e5a2980da8
fix(logger): allow logging with unknown window source (#12406)
Some checks failed
Auto I18N Weekly / Auto I18N (push) Has been cancelled
* fix(logger): allow logging with unknown window source

Previously, LoggerService would block all logging when window source
was not initialized, which could swallow important business errors.
Now it uses 'UNKNOWN' as the window source and continues logging.

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

* chore(logger): update documentation links for LoggerService eslint

Updated the ESLint configuration to point to the correct documentation for the unified LoggerService, ensuring users have access to the latest guides in both English and Chinese.

---------

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-10 15:12:00 +08:00
George·Dong
5b5e190132
feat(models): add Qwen text-embedding models to defaults (#12410)
* feat(models): add Qwen text-embedding models to defaults

Add four Qwen text-embedding models (v4, v3, v2, v1) to the
default model list in the renderer config. Group them under
"Qwen-text-embedding" and set the provider to "dashscope".

This ensures embedding models are available by default for
features that require text embeddings.

* fix(models): normalize qwen embedding group name

Change group value for Dashscope Qwen embedding models from
'Qwen-text-embedding' to 'qwen-text-embedding' in the default models
configuration. This makes the group naming consistent with other Qwen
model groups (lowercase) and avoids potential mismatches or lookup
errors caused by case differences.

* feat(dashscope): add qwen3-rerank model

Add qwen3-rerank model for Alibaba Cloud Bailian rerank API.
2026-01-10 15:11:08 +08:00
kangfenmao
8ab082ceb5 feat(i18n): add careers section to AboutSettings and update translations
- Updated package.json to remove redundant i18n:check command.
- Added a "careers" section in the AboutSettings component with a button linking to the careers page.
- Introduced translations for the "careers" section in multiple languages including English, Chinese, German, Spanish, French, Japanese, Portuguese, Romanian, and Russian.
- Updated cache-related translations across various languages to provide localized support.
2026-01-09 20:57:59 +08:00
Sun
bdf8f103c8
fix(mcp): 修复 MCP 配置 timeout 字段不支持字符串类型的问题 (#12384)
fix(mcp): allow string input for timeout in mcp config

Co-authored-by: Sun <10309831+x_taiyang@user.noreply.gitee.com>
2026-01-09 17:24:08 +08:00
SuYao
7a7089e315
fix: normalize topics in useAssistant and assistants slice to prevent errors (#12319) 2026-01-09 17:21:20 +08:00
SuYao
29d8c4a7ed
fix(aiCore): only apply sendReasoning for openai-compatible SDK providers (#12387)
sendReasoning is a patch specific to @ai-sdk/openai-compatible package.
Previously it was incorrectly applied to all providers in buildGenericProviderOptions,
including those with dedicated SDK packages (e.g., cerebras, deepseek, openrouter).

Now it only applies when the provider will actually use openai-compatible SDK:
- No dedicated SDK registered (!hasProviderConfig(providerId))
- OR explicitly openai-compatible (providerId === 'openai-compatible')

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

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-09 15:00:31 +08:00
pippobj
008df2d4b7
feat(baichuan):add baichuan models (#12364)
Co-authored-by: roberto <roberto@baichuan-inc.com>
2026-01-08 17:10:07 +08:00
花月喵梦
81ea847989
Add Anthropic Cache (#12333)
* add anthropic cache

* i18n: sync

* fix: condition judgment

* lg

* ag

---------

Co-authored-by: suyao <sy20010504@gmail.com>
2026-01-07 23:05:30 +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
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
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
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
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
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
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
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
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