Commit Graph

5614 Commits

Author SHA1 Message Date
fullex
71a7b1b7ea refactor(migration): improve ChatMigrator's handling of duplicate messages and active node selection
- Enhanced duplicate message ID handling by updating parentId references and ensuring transaction safety.
- Implemented a smart selection logic for determining activeNodeId, prioritizing original active nodes and foldSelected messages.
- Updated documentation to reflect changes in duplicate handling and active node selection strategies.
2026-01-01 23:26:28 +08:00
fullex
4f4785396a feat(migration): enhance ChatMigrator for comprehensive chat data migration
- Implemented detailed preparation, execution, and validation phases for migrating chat topics and messages from Dexie to SQLite.
- Added robust logging and error handling to track migration progress and issues.
- Introduced data transformation strategies to convert old message structures into a new tree format, ensuring data integrity and consistency.
- Updated migration guide documentation to reflect changes in migrator registration and detailed comments for maintainability.
2026-01-01 23:13:43 +08:00
fullex
4fcf047fa9 refactor(database): update message and topic table structures
- Modified the `message` table to include `siblings_group_id` and `stats`, while removing `usage` and `metrics`.
- Renamed `response_group_id` to `siblings_group_id` for clarity.
- Enhanced the `topic` table by adding `active_node_id` and ensuring `sort_order` and `is_name_manually_edited` are defined correctly.
- Updated the database schema to reflect these changes and removed obsolete migration files.
2026-01-01 21:18:28 +08:00
fullex
7145a1ded3 Merge branch 'main' of github.com:CherryHQ/cherry-studio into v2 2026-01-01 16:42:35 +08:00
Phantom
d391e55a8a
refactor(ovms): lazy-load OVMS support check with SWR (#12226) 2026-01-01 16:40:12 +08:00
Here_is_Daiyu
f878c8ab3b
Update minimax API documentation link (#12220) 2026-01-01 16:36:52 +08:00
fullex
799db1f8d1 Merge branch 'main' of github.com:CherryHQ/cherry-studio into v2 2026-01-01 13:57:42 +08:00
fullex
8729aa40c7 feat(message): introduce content reference types and update MainTextBlock structure
- Added new enums and interfaces for content references, including `ReferenceCategory`, `CitationType`, and various citation reference types (Web, Knowledge, Memory).
- Unified inline references in `MainTextBlock` with a new `references` property, replacing the deprecated `citationReferences` and `CitationBlock`.
- Implemented type guards for reference validation, enhancing type safety and clarity in message handling.
- Updated documentation to reflect changes and migration notes for version 2.0.
2026-01-01 13:35:34 +08:00
Phantom
33cdcaa558
fix(ovms): add platform check to prevent errors on non-Windows systems (#12125)
* 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.
2025-12-31 22:24:53 +08:00
fullex
68f9add566 refactor(message): remove deprecated properties from message types
- Commented out `modelId` and `knowledgeBaseIds` properties in `BaseBlock` and `MainTextBlock` interfaces, marking them as dead code for future removal in v2.
- This change helps to clean up the codebase and prepare for upcoming version updates.
2025-12-31 21:44:15 +08:00
beyondkmp
bc9eeb9f30
feat: add fuzzy search for file list with relevance scoring (#12131)
* 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>
2025-12-30 19:42:56 +08:00
jardel
068cf1083c
fix: use HTML content for markdown copy button (#12187) 2025-12-30 13:35:15 +08:00
nujabse
ed4353b054
fix: align MCP tool ids for permissions (#12127)
* fix(agents): align MCP tool IDs for permissions

Normalize legacy MCP allowlist entries so auto-approval matches SDK tool names.

Signed-off-by: mathholic <h.p.zhumeng@gmail.com>

* fix: normalize mcp tool ids in sessions

Signed-off-by: macmini <h.p.zhumeng@gmail.com>

* fix: align mcp tool ids with buildFunctionCallToolName

---------

Signed-off-by: mathholic <h.p.zhumeng@gmail.com>
Signed-off-by: macmini <h.p.zhumeng@gmail.com>
2025-12-30 13:33:09 +08:00
fullex
b156ee68e0 feat(cache): enhance shared cache functionality and synchronization in main
- Introduced type-safe access methods for shared cache in the Main process, including `getShared`, `setShared`, `hasShared`, and `deleteShared`.
- Implemented `getAllShared` for initializing new Renderer windows with the complete shared cache state.
- Updated IPC communication to support bidirectional synchronization of shared cache between Main and Renderer processes.
- Enhanced cache management with absolute timestamps for TTL, ensuring precise expiration handling across windows.
- Added ready state tracking in Renderer for improved synchronization feedback during initialization.
- Refactored related documentation to reflect new features and usage patterns for shared cache.
2025-12-29 23:56:27 +08:00
MyPrototypeWhat
ba107b2f6f chore(deps): update React and React DOM to version 19.2.0
- Added resolutions for React and React DOM to ensure consistent usage of version 19.2.0 across the project.
- Removed outdated version entries from yarn.lock to streamline dependency management.
2025-12-29 18:58:13 +08:00
MyPrototypeWhat
05c26fbff2 refactor(ui): update utility imports to use internal lib
- Changed utility imports from '@cherrystudio/ui/utils' to '@cherrystudio/ui/lib/utils' across multiple components for better organization.
- Introduced a new internal utility module for class name merging, ensuring consistent usage across the UI components.
- Updated relevant components to reflect the new import paths, enhancing maintainability and clarity.
2025-12-29 18:58:13 +08:00
LiuVaayne
528d6d37f2
refactor: simplify buildFunctionCallToolName to use mcp__{server}__{tool} format (#12186) 2025-12-29 18:52:58 +08:00
LiuVaayne
efbe64e5da
feat(tokenflux): add Anthropic host support using OpenRouter package (#12188)
* 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
2025-12-29 18:24:57 +08:00
fullex
6feb322be8 docs(architecture): restructure and enhance data management documentation
- Removed outdated sections on database architecture and data access patterns for clarity.
- Introduced a new table format for data management systems, detailing use cases and APIs.
- Updated references to the database schema and migration processes for better guidance.
- Consolidated key architectural components to streamline the documentation structure.
2025-12-29 17:16:07 +08:00
fullex
819c209821 docs(data): update README and remove outdated API design guidelines
- Revised the README files for shared data and main data layers to improve clarity and structure.
- Consolidated documentation on shared data types and API types, removing the now-deleted `api-design-guidelines.md`.
- Streamlined directory structure descriptions and updated links to relevant documentation.
- Enhanced quick reference sections for better usability and understanding of the data architecture.
2025-12-29 17:15:06 +08:00
fullex
e4fd1af1b8 feat(MessageService): optimize message retrieval with CTEs for improved performance
- Enhanced `getTree` method to utilize Common Table Expressions (CTEs) for fetching active paths and tree structures in a single query, reducing database load.
- Updated `getBranchMessages` to implement a similar optimization, allowing for efficient retrieval of message paths without loading all messages.
- Refactored `getPathToNode` to use a recursive CTE for fetching ancestors, addressing the N+1 query problem in deep message trees.
- Introduced transaction handling in `create` and `update` methods to ensure atomic operations and data integrity during message modifications.
2025-12-29 16:59:00 +08:00
fullex
3d0e7a6c15 feat(api): enhance message deletion functionality with activeNodeId management
- Introduced `ActiveNodeStrategy` type to define strategies for updating `activeNodeId` when a message is deleted.
- Updated `DeleteMessageResponse` to include `newActiveNodeId` for tracking changes to the active node after deletion.
- Modified the `DELETE` endpoint to accept `activeNodeStrategy` as a query parameter, allowing for flexible handling of active node updates.
- Enhanced the `delete` method in `MessageService` to implement the new strategies, ensuring consistent behavior during message deletions.
2025-12-29 13:42:05 +08:00
fullex
44b85fa661 docs(README): enhance foreign key documentation with usage examples
- Added sections on basic usage of foreign keys, self-referencing foreign keys, and circular foreign key references.
- Provided TypeScript code examples to illustrate best practices and avoid common pitfalls.
- Explained the rationale behind using soft references in SQLite for improved data integrity and simplified operations.
2025-12-29 12:00:24 +08:00
fullex
9c47937714 feat(api): enhance message and topic schemas with new features
- Added `setAsActive` property to `CreateMessageDto` for controlling active node status in topics.
- Updated `messageTable` and `topicTable` schemas to include foreign key constraints and improved handling of active node references.
- Refactored message and topic service methods to utilize `.returning()` for better data retrieval after inserts and updates.
- Implemented hard delete functionality for messages and topics, replacing soft delete logic to ensure data integrity.
2025-12-29 00:42:55 +08:00
fullex
425f81a882 fix(MessageService): update default message status to 'pending'
- Changed the default status for messages from 'success' to 'pending' to better reflect the message processing state. This aligns with recent updates to the MessageStatus type.
2025-12-28 21:34:41 +08:00
fullex
942e014d92 fix(api): enhance message status handling
- Updated MessageStatus type to include 'pending' as a new state, reflecting the message processing lifecycle.
- Modified CreateMessageDto and UpdateMessageDto interfaces to utilize the updated MessageStatus type for improved clarity and consistency in message status management.
2025-12-28 21:24:00 +08:00
tylinux
cccf9bb7be
feat: add latest zhipu models (#12169) 2025-12-28 19:11:08 +08:00
fullex
5061472850 fix: remove heroui
- Consolidated imports from '@cherrystudio/ui' for better readability.
- Replaced RadioGroup with Radio component from 'antd' for consistency in the SelectionAssistantSettings file.
- Adjusted event handling for trigger and filter modes to align with the new Radio component structure.
2025-12-28 18:59:56 +08:00
fullex
6e25d12def Merge branch 'main' into v2 2025-12-28 18:08:30 +08:00
kangfenmao
c242860abc chore(release): v1.7.8
🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-28 17:40:41 +08:00
fullex
cb93eee29d chore: mark multiple services and components as 'will deprecated' for v2 refactor
- 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.
2025-12-28 17:38:37 +08:00
SuYao
5ff173fcc7
fix(ollama): improve reasoningEffort handling in providerOptions (#12089)
* 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
2025-12-28 17:04:45 +08:00
Phantom
b78df05f28
fix(AssistantsTab): prevent deleting last assistant and add error message (#12162)
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.
2025-12-28 15:30:01 +08:00
fullex
7faff7ad4b feat(api): implement message branching API with tree structure support
- Add Topic and Message API endpoints for CRUD operations
  - Implement tree visualization queries (GET /topics/:id/tree)
  - Implement branch message queries with pagination (GET /topics/:id/messages)
  - Add multi-model response grouping via siblingsGroupId
  - Support topic forking from existing message nodes
  - Add INVALID_OPERATION error code for business rule violations
  - Update API design guidelines documentation
2025-12-28 12:54:06 +08:00
fullex
939100d495 refactor(api): consolidate error handling and update API error structures
- Replaced `DataApiError` with `SerializedDataApiError` for improved error serialization and IPC transmission.
- Enhanced error response format with additional fields for better context and debugging.
- Updated error handling utilities to streamline error creation and retry logic.
- Removed the deprecated `errorCodes.ts` file and migrated relevant functionality to `apiErrors.ts`.
- Updated documentation to reflect changes in error handling practices and structures.
2025-12-28 12:09:52 +08:00
Zhaolin Liang
c13dc6eab5
fix: shortcut icons sorting disorder (#12151)
Some checks failed
Auto I18N Weekly / Auto I18N (push) Has been cancelled
2025-12-27 20:04:51 +08:00
Shemol
2008d70707
fix(memory): fix global memory settings submit failure (#12147) 2025-12-27 18:00:20 +08:00
Shemol
723fa11647
perf(ModelList): use Map for O(1) model status lookup (#12161)
- 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>
2025-12-27 13:57:33 +08:00
Phantom
9586f38157
build: upgrade electron-vite to 5.0.0 with HMR support (#12120) 2025-12-27 12:27:11 +08:00
fullex
e4ec7bba7c docs(api): add PATCH vs Dedicated Endpoints section to API design guidelines
- Introduced a decision tree to help determine when to use PATCH versus dedicated endpoints based on operation characteristics.
- Added guidelines for naming dedicated endpoints and provided examples for various scenarios, enhancing clarity on API design practices.
2025-12-27 11:17:47 +08:00
fullex
401d66f3dd
fix(windows): remember size not working for SelectionAction window (#12132)
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-26 23:43:38 +08:00
fullex
c16789f697 feat(database): update README and column helpers for schema guidelines
- Expanded the README with detailed database schema guidelines, including naming conventions for tables, columns, and export names.
- Introduced new column helper functions for UUID primary keys (v4 and v7) to streamline table definitions.
- Updated existing schemas (group, message, tag, topic) to utilize the new UUID primary key helpers for improved consistency and auto-generation.
2025-12-26 22:45:13 +08:00
fullex
fe7358a33c docs(api): add design guidelines reference to README
- Included a note to review the API Design Guidelines before creating new schemas, emphasizing path naming, HTTP methods, and error handling conventions.
2025-12-26 21:02:20 +08:00
fullex
61e80f2e7f feat(database): enhance message and topic schemas with new fields
- Added `siblingsGroupId` to `message` schema for better message organization.
- Introduced `activeNodeId` in `topic` schema to manage message tree structure.
- Updated `assistantMeta` and `modelMeta` fields to use specific types for improved type safety.
- Included `isNameManuallyEdited` and `sortOrder` in `topic` schema for enhanced topic management.
- Added a new entry in the migration journal for version tracking.
2025-12-26 19:21:42 +08:00
defi-failure
99b431ec92
fix: remove trailing api version in ANTHROPIC_BASE_URL (#12145) 2025-12-26 17:37:58 +08:00
Shemol
ab3bce33b8
docs: fix copy -> cp in development guide (#12142)
Signed-off-by: SherlockShemol <shemol@163.com>
2025-12-26 17:05:45 +08:00
fullex
f84a2588fd Merge branch 'main' into v2 2025-12-26 14:18:06 +08:00
fullex
0b35029404 refactor(dataApi): remove batch and transaction support from Data API
- Deleted batch and transaction related schemas, handlers, and IPC channels to streamline the Data API.
- Updated related type definitions and import paths to reflect the removal of batch and transaction functionalities.
- Simplified the API server and adapter logic by eliminating unused methods and handlers.
2025-12-26 14:17:08 +08:00
fullex
18df6085d7 refactor(dataApi): streamline Data API schema and type definitions
- Removed outdated API model and schema files to simplify the structure.
- Consolidated API types and schemas for better organization and clarity.
- Updated import paths across the codebase to reflect the new structure.
- Enhanced documentation in related README files to guide usage of the new API schema organization.
2025-12-26 12:52:32 +08:00
kangfenmao
0f0e18231d fix: update ollama provider type and increment store version to 190
- 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.
2025-12-26 11:44:51 +08:00