mirror of
https://github.com/CherryHQ/cherry-studio.git
synced 2025-12-19 06:30:10 +08:00
main
101 Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
f2b4a2382b
|
refactor: rename i18n commands for better consistency (#11938)
* refactor: rename i18n commands for better consistency - Rename `check:i18n` to `i18n:check` - Rename `sync:i18n` to `i18n:sync` - Rename `update:i18n` to `i18n:translate` (clearer purpose) - Rename `auto:i18n` to `i18n:all` (runs check, sync, and translate) - Update lint script to use new `i18n:check` command name This follows the common naming convention of grouping related commands under a namespace prefix (e.g., `test:main`, `test:renderer`). 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * refactor: update i18n command names and improve documentation - Renamed i18n commands for consistency: `sync:i18n` to `i18n:sync`, `check:i18n` to `i18n:check`, and `auto:i18n` to `i18n:translate`. - Updated relevant documentation and scripts to reflect new command names. - Improved formatting and clarity in i18n-related guides and scripts. This change enhances the clarity and usability of i18n commands across the project. --------- Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com> |
||
|
|
eb4670c22c
|
docs: correct the links on the readme (#11477) | ||
|
|
d4396b4890 |
docs: update links in Chinese contributing guide
- Corrected the paths in the Chinese version of the contributing guide to point to the appropriate documentation locations. |
||
|
|
bb41709ce8 |
docs: update docs directory structure
- Updated links in CONTRIBUTING.md and README.md to point to the correct Chinese documentation paths. - Removed outdated files including the English and Chinese versions of the branching strategy, contributing guide, and test plan documents. - Cleaned up references to non-existent documentation in the project structure to streamline the contributor experience. |
||
|
|
073d43c7cb
|
chore: rename cs-releases to x-files/app-upgrade-config (#11290)
rename cs-releases to x-files/app-upgrade-config |
||
|
|
038d30831c
|
♻️ refactor: implement config-based update system with version compatibility control (#11147)
* ♻️ refactor: implement config-based update system with version compatibility control Replace GitHub API-based update discovery with JSON config file system. Support version gating (users below v1.7 must upgrade to v1.7.0 before v2.0). Auto-select GitHub/GitCode config source based on IP location. Simplify fallback logic. Changes: - Add update-config.json with version compatibility rules - Implement _fetchUpdateConfig() and _findCompatibleChannel() - Remove legacy _getReleaseVersionFromGithub() and GitHub API dependency - Refactor _setFeedUrl() with simplified fallback to default feed URLs - Add design documentation in docs/UPDATE_CONFIG_DESIGN.md 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com> * fix(i18n): Auto update translations for PR #11147 * format code * 🔧 chore: update config for v1.7.5 → v2.0.0 → v2.1.6 upgrade path Update version configuration to support multi-step upgrade path: - v1.6.x users → v1.7.5 (last v1.x release) - v1.7.x users → v2.0.0 (v2.x intermediate version) - v2.0.0+ users → v2.1.6 (current latest) Changes: - Update 1.7.0 → 1.7.5 with fixed feedUrl - Set 2.0.0 as intermediate version with fixed feedUrl - Add 2.1.6 as current latest pointing to releases/latest This ensures users upgrade through required intermediate versions before jumping to major releases. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com> * 🔧 chore: refactor update config with constants and adjust versions Refactor update configuration system and adjust to actual versions: - Add UpdateConfigUrl enum in constant.ts for centralized config URLs - Point to test server (birdcat.top) for development testing - Update AppUpdater.ts to use UpdateConfigUrl constants - Adjust update-config.json to actual v1.6.7 with rc/beta channels - Remove v2.1.6 entry (not yet released) - Set package version to 1.6.5 for testing upgrade path - Add update-config.example.json for reference 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com> * update version * ✅ test: add comprehensive unit tests for AppUpdater config system Add extensive test coverage for new config-based update system including: - Config fetching with IP-based source selection (GitHub/GitCode) - Channel compatibility matching with version constraints - Smart fallback from rc/beta to latest when appropriate - Multi-step upgrade path validation (1.6.3 → 1.6.7 → 2.0.0) - Error handling for network and HTTP failures Test Coverage: - _fetchUpdateConfig: 4 tests (GitHub/GitCode selection, error handling) - _findCompatibleChannel: 9 tests (channel matching, version comparison) - Upgrade Path: 3 tests (version gating scenarios) - Total: 30 tests, 100% passing Also optimize _findCompatibleChannel logic with better variable naming and log messages. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com> * ✅ test: add complete multi-step upgrade path tests (1.6.3 → 1.7.5 → 2.0.0 → 2.1.6) Add comprehensive test suite for complete upgrade journey including: - Individual step validation (1.6.3→1.7.5, 1.7.5→2.0.0, 2.0.0→2.1.6) - Full multi-step upgrade simulation with version progression - Version gating enforcement (block skipping intermediate versions) - Verification that 1.6.3 cannot directly upgrade to 2.0.0 or 2.1.6 - Verification that 1.7.5 cannot skip 2.0.0 to reach 2.1.6 Test Coverage: - 6 new tests for complete upgrade path scenarios - Total: 36 tests, 100% passing This ensures the version compatibility system correctly enforces intermediate version upgrades for major releases. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com> * 📝 docs: reorganize update config documentation with English translation Move update configuration design document to docs/technical/ directory and add English translation for international contributors. Changes: - Move docs/UPDATE_CONFIG_DESIGN.md → docs/technical/app-update-config-zh.md - Add docs/technical/app-update-config-en.md (English translation) - Organize technical documentation in dedicated directory Documentation covers: - Config-based update system design and rationale - JSON schema with version compatibility control - Multi-step upgrade path examples (1.6.3 → 1.7.5 → 2.0.0 → 2.1.6) - TypeScript type definitions and matching algorithms - GitHub/GitCode source selection for different regions 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com> * format code * ✅ test: add tests for latest channel self-comparison prevention Add tests to verify the optimization that prevents comparing latest channel with itself when latest is requested, and ensures rc/beta channels are returned when they are newer than latest. New tests: - should not compare latest with itself when requesting latest channel - should return rc when rc version > latest version - should return beta when beta version > latest version These tests ensure the requestedChannel !== UpgradeChannel.LATEST check works correctly and users get the right channel based on version comparisons. Test Coverage: 39 tests, 100% passing 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com> * update github/gitcode * format code * update rc version * ♻️ refactor: merge update configs into single multi-mirror file - Merge app-upgrade-config-github.json and app-upgrade-config-gitcode.json into single app-upgrade-config.json - Add UpdateMirror enum for type-safe mirror selection - Optimize _fetchUpdateConfig to receive mirror parameter, eliminating duplicate IP country checks - Update ChannelConfig interface to use Record<UpdateMirror, string> for feedUrls - Rename documentation files from app-update-config-* to app-upgrade-config-* - Update docs with new multi-mirror configuration structure 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com> * ✅ test: update AppUpdater tests for multi-mirror configuration - Add UpdateMirror enum import - Update _fetchUpdateConfig tests to accept mirror parameter - Convert all feedUrl to feedUrls structure in test mocks - Update test expectations to match new ChannelConfig interface - All 39 tests passing 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com> * format code * delete files * 📝 docs: add UpdateMirror enum to type definitions - Add UpdateMirror enum definition in both EN and ZH docs - Update ChannelConfig to use Record<UpdateMirror, string> - Add comments showing equivalent structure for clarity 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com> * 🐛 fix: return actual channel from _findCompatibleChannel Fix channel mismatch issue where requesting rc/beta but getting latest: - Change _findCompatibleChannel return type to include actual channel - Return { config, channel } instead of just config - Update _setFeedUrl to use actualChannel instead of requestedChannel - Update all test expectations to match new return structure - Add channel assertions to key tests This ensures autoUpdater.channel matches the actual feed URL being used. Fixes issue where: - User requests 'rc' channel - latest >= rc, so latest config is returned - But channel was set to 'rc' with latest URL ❌ - Now channel is correctly set to 'latest' ✅ All 39 tests passing ✅ 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com> * update version * udpate version * update config * add no cache header * update files * 🤖 chore: automate app upgrade config updates * format code * update workflow * update get method * docs: document upgrade workflow automation --------- Co-authored-by: Claude <noreply@anthropic.com> Co-authored-by: GitHub Action <action@github.com> |
||
|
|
8e33ff8d90 | docs: update test plan documentation to clarify upgrade behavior for RC and Beta channels | ||
|
|
2546dfbe5d | chore: update Node.js version to 22 and Yarn version to 4.9.1 across workflows and documentation | ||
|
|
0767952a6f
|
docs: fix invalid link in the contributing guide (#11038)
docs: fix invalid link |
||
|
|
1f0fd8215a
|
docs: update PR template and README with feature PR restrictions (#10955)
* docs: update PR template and README with feature PR restrictions Add temporary hold notice for Redux/IndexedDB feature PRs in both pull request template and README Fix whitespace and formatting inconsistencies in README * docs: update contributing guidelines with temporary PR restrictions Add important notice about temporary restrictions on data-changing feature PRs Clarify acceptable contribution types during v2.0.0 development phase * docs: remove warning about feature PR restrictions The warning about temporary restrictions on feature PRs involving Redux or IndexedDB changes has been removed as it is no longer relevant * docs: remove core developer membership section from contributing guides |
||
|
|
e5ccf68476
|
feat: use biome to format files (#10170)
* build: add @biomejs/biome as a dependency * chore: add biome extension to vscode recommendations * chore: migrate from prettier to biome for code formatting Update VSCode settings to use Biome as the default formatter for multiple languages Add Biome to code actions on save and reorder search exclude patterns * build: add biome.json configuration file for code formatting * build: migrate from prettier to biome for formatting Update package.json scripts and biome.json configuration to use biome instead of prettier for code formatting. Adjust biome formatter includes/excludes patterns for better file matching. * refactor(eslint): remove unused prettier config and imports * chore: update biome.json configuration - Enable linter and set custom rules - Change jsxQuoteStyle to single quotes - Add json parser configuration - Set formatWithErrors to true * chore: migrate biome config from json to jsonc format The new jsonc format allows for comments in the configuration file, making it more maintainable and easier to document configuration choices. * style(biome): update ignore patterns and jsx quote style Update file ignore patterns from `/*` to `/**` for consistency Change jsxQuoteStyle from single to double quotes for alignment with project standards * refactor: simplify error type annotations from Error | any to any The change standardizes error handling by using 'any' type instead of union types with Error | any, making the code more consistent and reducing unnecessary type complexity. * chore: exclude tailwind.css from biome formatting * style: standardize quote usage and fix JSX formatting - Replace single quotes with double quotes in CSS imports and selectors - Fix JSX element closing bracket alignment and formatting - Standardize JSON formatting in package.json files * Revert "style: standardize quote usage and fix JSX formatting" This reverts commit |
||
|
|
778b8718c9
|
docs: fix spelling errors in README files (#10015)
- Fix Peplexity -> Perplexity in both English and Chinese README - Fix Itapano -> Italiano in Chinese README language links - Improve documentation accuracy and professionalism Signed-off-by: LeaderOnePro <leaderonepro@outlook.com> |
||
|
|
c506ff6872
|
ci: add format check to PR workflow and documentation (#9810) | ||
|
|
d0cf3179a2
|
feat(translate): brand new translate feature (#8513)
* refactor(translate): 将翻译设置组件抽离为独立文件 * refactor(translate): 统一变量名translateHistory为translateHistories * perf(translate): 翻译页面的输入处理性能优化 添加防抖函数来优化文本输入和键盘事件的处理,减少不必要的状态更新和翻译请求 * refactor(translate): 将输入区域组件抽离为独立文件 重构翻译页面,将输入区域相关逻辑和UI抽离到单独的InputArea组件中 优化代码结构,提高可维护性 buggy: waiting for merge * revert: 恢复main的translate page * refactor(translate): 缓存源语言状态 * refactor(translate): 提取翻译设置组件 将翻译设置功能提取为独立组件,减少主页面代码复杂度 * build: 添加 react-transition-group 及其类型定义依赖 * refactor(translate): 将翻译历史组件拆分为独立文件并优化布局结构 * refactor(translate): 调整翻译页面布局和样式 统一操作栏的padding样式,将输入和输出区域的容器样式分离以提高可维护性 * feat(翻译): 添加语言交换功能 添加源语言与目标语言交换功能按钮 为AWS Bedrock添加i18n * fix(自动翻译): 在翻译提示中添加去除前缀的说明 在翻译提示中添加说明,要求翻译时去除文本中的"[to be translated]"前缀 * feat(translate): 实现翻译历史列表的虚拟滚动以提高性能 添加虚拟列表组件并应用于翻译历史页面,优化长列表渲染性能 * refactor(translate): 移除未使用的InputArea组件 * feat(translate): 添加模型选择器到翻译页面并移除设置中的模型选择 将模型选择器从翻译设置移动到翻译页面主界面,优化模型选择流程 * style(translate): 为输出占位文本添加不可选中样式 * feat(翻译): 添加自定义语言支持 - 新增 CustomTranslateLanguage 类型定义 - 在数据库中增加 translate_languages 表和相关 CRUD 操作 - 实现自定义语言的添加、删除、更新和查询功能 * feat(翻译设置): 新增自定义语言管理和翻译模型配置功能 添加翻译设置页面,包含自定义语言表格、添加/编辑模态框、翻译模型选择和提示词配置 * feat(翻译设置): 实现自定义语言管理功能 添加自定义语言表格组件及模态框,支持增删改查操作 修复数据库字段命名不一致问题,将langcode改为langCode 新增内置语言代码列表用于校验 添加多语言支持及错误提示 * docs(TranslateService): 为自定义语言功能添加JSDoc注释 * feat(翻译): 添加获取所有翻译语言选项的功能 新增getTranslateOptions函数,用于合并内置翻译语言和自定义语言选项。当获取自定义语言失败时,自动回退到只返回内置语言选项。 * refactor(translate): 重构翻译功能代码,优化语言选项管理和类型定义 - 将翻译语言选项管理集中到useTranslate钩子中 - 修改LanguageCode类型为string以支持自定义语言 - 废弃旧的getLanguageByLangcode方法,提供新的实现 - 统一各组件对翻译语言选项的获取方式 - 优化类型定义,移除冗余类型TranslateLanguageVarious * refactor(translate): 重构翻译相关组件,提取LanguageSelect为独立组件并优化代码结构 * fix(AssistantService): 添加对未知目标语言的错误处理 当目标语言未知时抛出错误并记录日志,防止后续处理异常 * refactor(TranslateSettings): 重命名并重构自定义语言设置组件 将 CustomLanguageTable 重命名为 CustomLanguageSettings 并重构其实现 增加对自定义语言的增删改查功能 调整加载状态的高度以适应新组件 * style(settings): 调整设置页面布局样式以改善显示效果 移除重复的高度和padding设置,统一在内容容器中设置高度 * refactor(translate): 重命名变量 将 builtinTranslateLanguageOptions 重命名为 builtinLanguages 以提高代码可读性 更新相关引用以保持一致性 * refactor(TranslateSettings): 使用useCallback优化删除函数以避免不必要的重渲染 * feat(翻译设置): 为自定义语言设置添加标签本地化 为自定义语言设置中的"Value"和"langCode"字段添加中文标签 * style(TranslateSettings): 为SettingGroup添加flex样式以改善布局 * style(TranslateSettings): 表格样式调整 * docs(技术文档): 添加translate_languages表的技术文档 添加translate_languages表的技术说明文档,包含表结构、字段定义及业务约束说明 * feat(翻译): 添加对不支持语言的错误处理并规范化语言代码 - 在翻译服务中添加对不支持语言的错误提示 - 将自定义语言的langCode统一转为小写 - 完善QwenMT模型的语言映射表 * docs(messageUtils): 标记废弃的函数 * feat(消息工具): 添加通过ID查找翻译块的功能并优化翻译错误处理 添加findTranslationBlocksById函数通过消息ID从状态中查询翻译块 在翻译失败时清理无效的翻译块并显示错误提示 * fix(ApiService): 修复翻译请求错误处理逻辑 捕获翻译请求中的错误并通过onError回调传递,避免静默失败 * fix(translate): 调整双向翻译语言显示的最小宽度 * fix(translate): 修复语言交换条件判断逻辑 添加对双向翻译的限制检查,防止在双向翻译模式下错误交换语言 * feat(i18n): 添加翻译功能的自定义语言支持 * refactor(store): 将 targetLanguage 类型从 string 改为 LanguageCode * refactor(types): 将语言代码类型从字符串改为LanguageCode * refactor: 统一使用@logger导入loggerService 将项目中从@renderer/services/LoggerService导入loggerService的引用改为从@logger导入,以统一日志服务的引用方式 * refactor(translate): 移除旧的VirtualList组件并替换为DynamicVirtualList * refactor(translate): 移除未使用的useCallback导入 * refactor(useTranslate): 调整导入语句顺序以保持一致性 * fix(translate): 修复 useEffect 依赖项缺失问题 * refactor: 调整导入顺序 * refactor(i18n): 移除未使用的翻译字段并更新部分翻译内容 * fix(ApiService): 将completions方法替换为completionsForTrace以修复追踪问题 * refactor(TranslateSettings): 替换Spin组件为自定义加载图标 使用SvgSpinners180Ring替换antd的Spin组件以保持UI一致性 * refactor(TranslateSettings): 替换 HStack 为 Space 组件以优化布局 * style(TranslateSettings): 为删除按钮添加危险样式以提升视觉警示 * style(TranslateSettings): 移除表格容器中多余的justify-content属性 * fix(TranslateSettings): 添加默认emoji旗帜 * refactor(translate): 将语言映射函数移动到translate配置文件 将mapLanguageToQwenMTModel函数及相关映射表从utils模块移动到config/translate模块 * fix(translate): 修复couldTranslate语义错误 * docs(i18n): 更新日语翻译中的错误翻译 * refactor(translate): 将历史记录列表改为抽屉组件并优化样式 * fix(TranslateService): 修复添加自定义语言时缺少await的问题 * fix(TranslateService): 修复变量名错误,使用正确的langCode参数 在添加自定义语言时,错误地使用了value变量而非langCode参数,导致重复检查失效。修正为使用正确的参数名并更新相关错误信息。 * refactor(TranslateSettings): 使用函数式更新优化状态管理 * style(TranslatePromptSettings): 替换按钮为自定义样式组件 使用styled-components创建自定义ResetButton组件替换antd的Button 统一按钮样式与整体设计风格 * style(settings): 调整设置页面内边距从20px减少到10px * refactor(translate): 类型重命名 将Language更名为TranslateLanguage 将LanguageCode更名为TranslateLanguageCode * refactor(LanguageSelect): 提取默认语言渲染逻辑到独立函数 将重复的语言渲染逻辑提取为 defaultLanguageRenderer 函数,减少代码重复并提高可维护性 * refactor(TranslateSettings): 使用antd Form重构自定义语言模态框表单逻辑 重构自定义语言模态框,将原有的手动状态管理改为使用antd Form组件管理表单状态 表单验证逻辑整合到handleSubmit中,提高代码可维护性 修复emoji显示不同步的问题 * feat(翻译设置): 添加自定义语言表单的帮助文本和布局优化 为自定义语言表单的语言代码和语言名称字段添加帮助文本提示 重构表单布局,使用更合理的表单项排列方式 * refactor(TranslateSettings): 调整 CustomLanguageModal 中 EmojiPicker 的布局结构 * style(TranslateSettings): 调整自定义语言模态框按钮容器的内边距 * feat(翻译设置): 添加语言代码为空时的错误提示并优化表单验证 将表单验证逻辑从手动校验改为使用antd Form的rules属性 添加语言代码为空的错误提示信息 移除未使用的导入和日志代码 * feat(翻译设置): 改进自定义语言表单验证和错误处理 - 添加语言已存在的错误提示信息 - 使用国际化文本替换硬编码错误信息 - 重构表单布局,移除不必要的样式组件 - 增加语言代码存在性验证 - 改进表单标签和帮助信息的显示方式 * fix(i18n): 修正语言代码占位符的大小写格式 * style(translate): 移除设置页面中多余的翻译图标 * refactor(translate): 移动 OperationBar 样式并调整 LanguageSelect 宽度 将 OperationBar 样式从独立文件移至 TranslatePage 组件内 为 LanguageSelect 添加最小宽度并移除硬编码宽度 * refactor(设置页): 替换LanguageSelect为Selector组件以统一样式 * feat(翻译): 重构翻译功能并添加历史记录管理 将翻译相关逻辑从useTranslate钩子移动到TranslatePage组件 添加翻译历史记录的保存、删除和清空功能 在输入框底部显示预估token数量 * refactor(translate): 重构翻译页面代码结构并添加注释 将相关hooks和状态分组整理,添加清晰的注释说明各功能块作用 优化代码可读性和维护性 * refactor(TranslateService): 移除store依赖并优化错误处理 - 移除对store的依赖,直接使用getDefaultTranslateAssistant获取翻译助手 - 将翻译失败的错误消息从'failed'改为更明确的'empty' * feat(翻译): 优化翻译服务错误处理和错误信息展示 重构翻译服务逻辑,将错误处理和模型检查移至统一入口。添加翻译结果为空时的错误提示,并改进错误信息展示,包含具体错误原因。同时简化翻译页面调用逻辑,使用统一的翻译服务接口。 * style(translate): 为token计数添加右侧内边距以改善视觉间距 * refactor(translate): 移除useTranslate中未使用的状态并优化组件结构 将translatedContent和translating状态从useTranslate钩子中移除,改为在TranslatePage组件中直接使用redux状态 简化useTranslate的文档注释,仅保留核心功能描述 * refactor(LanguageSelect): 提取剩余props避免重复传递 避免将extraOptionsAfter等已解构的props再次传递给Select组件 * docs(i18n): 更新多语言翻译文件,添加缺失的翻译字段 * refactor(translate): 将历史记录操作移至TranslateService * style(LanguageSelect): 移除多余的 Space.Compact 包装 * fix(TranslateSettings): 修复编辑自定义语言时重复校验语言代码的问题 * refactor(translate): 调整翻译页面布局结构,优化操作栏样式 将输入输出区域整合为统一容器,调整操作栏宽度和间距 移动设置和历史按钮到输出操作栏,简化布局结构 * style(translate): 调整操作栏样式间距 * refactor(窗口): 将窗口最小尺寸常量提取到共享配置中 将硬编码的窗口最小宽度和高度值替换为从共享配置导入的常量,提高代码可维护性 * refactor(translate): 重构翻译页面操作栏布局 将操作栏从三个独立部分改为网格布局,使用InnerOperationBar组件统一样式 移除冗余的operationBarWidth变量,简化样式代码 * refactor(translate): 替换自定义复制按钮为原生按钮组件 移除自定义的CopyButton组件,直接使用Ant Design的原生Button组件来实现复制功能,保持UI一致性并减少冗余代码 * refactor(translate): 重构翻译页面操作栏布局 将操作按钮从左侧移动到右侧,并移除不必要的HStack组件 调整翻译按钮位置并保留其工具提示功能 * fix(translate): 修复语言选择器宽度不一致问题 为源语言和目标语言选择器添加统一的宽度样式,保持UI一致性 * feat(窗口): 添加获取窗口尺寸和监听窗口大小变化的功能 添加 Windows_GetSize IPC 通道用于获取窗口当前尺寸 添加 Windows_Resize IPC 通道用于监听窗口大小变化 新增 useWindowSize hook 方便在渲染进程中使用窗口尺寸 * feat(窗口大小): 优化窗口大小变化处理并添加响应式布局 使用debounce优化窗口大小变化的处理,避免频繁触发更新 为翻译页面添加响应式布局,根据窗口宽度和导航栏位置动态调整模型选择器宽度 * feat(WindowService): 添加窗口最大化/还原时的尺寸变化事件 在窗口最大化或还原时发送尺寸变化事件,以便界面可以响应这些状态变化 * refactor(hooks): 将窗口大小变化的日志级别从debug改为silly * feat(翻译配置): 添加对粤语的语言代码支持 为翻译配置添加对'zh-yue'语言代码的处理,返回对应的'Cantonese'值 * fix(TranslateSettings): 修复自定义语言模态框中语言代码重复校验问题 当编辑已存在的自定义语言时,如果输入的语言代码已存在且与原代码不同,则抛出错误提示 * fix: 修复拼写错误,将"Unkonwn"改为"Unknown" * fix(useTranslate): 添加加载状态检查防止未加载时返回错误数据 当翻译语言尚未加载完成时,返回UNKNOWN而非尝试查找语言 * feat(组件): 添加模型选择按钮组件用于选择模型 * refactor(translate): 重构翻译页面模型选择器和按钮布局 简化模型选择逻辑,移除未使用的代码和复杂样式计算 将ModelSelector替换为ModelSelectButton组件 将TranslateButton提取为独立组件 * refactor(hooks): 重命名并完善窗口尺寸钩子函数 将 useWindow.ts 重命名为 useWindowSize.ts 并添加详细注释 * docs(i18n): 修正语言代码标签的大小写 * style(TranslateSettings): 调整自定义语言模态框中表单标签的宽度 * fix(CustomLanguageModal): disable mask closing for the custom language modal * style: 调整组件间距和图标大小 优化 TranslatePage 内容容器的内边距和间距,并增大 ModelSelectButton 的图标尺寸 * style(translate): 调整翻译历史列表项高度和样式结构 重构翻译历史列表项的样式结构,将高度从120px增加到140px,并拆分样式组件以提高可维护性 * fix(translate): 点击翻译历史item后关闭drawer --------- Co-authored-by: suyao <sy20010504@gmail.com> |
||
|
|
d05d1309ca
|
refactor(Preview,CodeBlock): preview components and tools (#8565)
* refactor(CodeBlockView): generalize tool and preview Generalize code tool to action tool - CodeTool -> ActionTool - usePreviewTools -> useImagePreview - rename code tool classname from icon to tool-icon Generalize preview - move image preview components to Preview dir - simplify file names * refactor(useImageTools): simplify implementation, add pan * refactor(Preview): move image tools to floating toolbar * refactor: add enableDrag, enable zooming for SvgPreview * test: add tests for preview components * feat(Preview): add download buttons to dropdown * refactor(Preview): remove setTools from preview, improve SvgPreview * refactor: add useTemporaryValue * test: add tests for hooks * test: add tests for CodeToolButton and CodeToolbar * refactor(PreviewTool): add a setting item to enable preview tools * test: update snapshot * refactor: extract more code tools to hooks, add tests * refactor: extract tools from CodeEditor and CodeViewer * test: add tests for new tool hooks * refactor(CodeEditor): change collapsible to expanded, change wrappable to unwrapped * refactor: migrate codePreview to codeViewer * docs: CodeBlockView * refactor: add custom file icons, center the reset button * refactor: improve code quality * refactor: improve migration by deprecating codePreview * refactor: improve PlantUml and svgToCanvas * fix: plantuml style * test: fix tests * fix: button icon * refactor(SvgPreview): debounce rendering * feat(PreviewTool): add a dialog tool * fix: remove isValidPlantUML, improve plantuml rendering * refactor: extract shadow dom renderer * refactor: improve plantuml error messages * test: add tests for ImageToolbar and ImageToolButton * refactor: add ImagePreviewLayout to simplify layout and tests * refactor: add useDebouncedRender, update docs * chore: clean up unused props * refactor: clean transformation before copy/download/preview * refactor: update migrate version * refactor: style refactoring and fixes - show header background in split view - fix status bar radius - reset special view transformation on theme change - fix wrap tool icon - add a divider to split view - improve split view toggling (switch back to previous view) - revert copy tool to separate tools - fix top border radius for special views * refactor: move GraphvizPreview to shadow DOM - use renderString - keep renderSvgInShadowHost api consistent with others * fix: tests, icons, deleted files * refactor: use ResetIcon in ImageToolbar * test: remove unnecessary tests * fix: min height for special preview * fix: update migrate |
||
|
|
06a5265580 | docs: update how to i18n demo pic | ||
|
|
8ffdb4d1c2
|
perf(i18n): improve performance when getting i18n text (#8548)
* refactor(i18n): 重构国际化标签映射为独立的键值映射对象 对象定义移出函数以优化性能 * docs(i18n): 更新国际化文档中的动态翻译推荐做法 修改中英文文档,添加通过维护键映射表来避免动态翻译键缺失的最佳实践 * chore(ProviderService): 添加注释 * chore: 移动注释位置 * refactor(ProviderService): 将获取提供者名称的逻辑移到utils中 移除冗余代码并使用统一的工具函数getFancyProviderName来获取提供者名称 |
||
|
|
08c5f82a04
|
refactor(Knowledge): simplify dimension settings, support base migration (#8315)
* refactor(knowledge): simplify dimension settings, support base migration Embedding dimension - remove 'auto set dimension', let the user take control - reuse findModelById - improve error messages for VoyageEmbeddings Knowledgebase migration - enable migration when model or dimension changes - add knowledgeThunk to reuse code KnowledgeSettings - unify UI for AddKnowledgeBasePopup and EditKnowledgeBasePopup - refactor KnowledgeSettings, split it to smaller components Tests: - knowledgeThunk - InputEmbeddingDimension - KnowledgeBaseFormModal - GeneralSettingsPanel - AdvancedSettingsPanel - InfoTooltip Misc. - add InfoTooltip - remove MemoriesSettingsModal * fix: i18n and vitest config |
||
|
|
6cc29c5005
|
chore(i18n): forced nested structure to support i18n ally (#8457)
* chore(i18n): 更新i18n文件为嵌套结构以适应插件 * feat(i18n): 添加自动翻译脚本处理待翻译文本 添加自动翻译脚本auto-translate-i18n.ts,用于处理以[to be translated]开头的待翻译文本 在package.json中添加对应的运行命令auto:i18n * chore(i18n): 更新嵌套结构 * chore(i18n): 更新多语言翻译文件并改进翻译逻辑 更新了多个语言的翻译文件,替换了"[to be translated]"标记为实际翻译内容 改进auto-translate-i18n.ts中的翻译逻辑,添加错误处理和日志输出 部分数组格式的翻译描述自动改为对象格式 * fix(i18n): 修复嵌套结构检查并改进错误处理 添加对嵌套结构中使用点符号的检查,确保使用严格嵌套结构 改进错误处理,在检查失败时输出更清晰的错误信息 * fix(测试): 更新下载失败测试中的翻译键名 * test(下载): 移除重复的下载失败翻译并更新测试 * feat(eslint): 添加规则,警告不建议在t()函数中使用模板字符串 * style: 使用单引号替换模板字符串中的反引号 * docs(.vscode): 添加i18n-ally扩展推荐到vscode配置 * fix: 在自动翻译脚本中停止进度条显示 确保在脚本执行完成后正确停止进度条,避免控制台输出混乱 * fix(i18n): 修复模型列表添加确认对话框的翻译键名 更新多语言文件中模型管理部分的翻译结构,将"add_listed"从字符串改为包含"confirm"和"key"的对象 同时修正EditModelsPopup组件中对应的翻译键引用 * chore: 注释掉i18n-ally命名空间配置 * docs: 添加国际化(i18n)最佳实践文档 添加中英文双语的技术文档,详细介绍项目中的i18n实现方案、工具链和最佳实践 包含i18n ally插件使用指南、自动化脚本说明以及代码规范要求 * docs(国际化): 更新i18n文档中的键名格式示例 将文档中错误的flat格式示例从下划线命名改为点分隔命名,以保持一致性 * refactor(i18n): 统一翻译键名从.key后缀改为.label后缀 * chore(i18n): sort * refactor(locales): 使用 Object.fromEntries 重构 locales 对象 * feat(i18n): 添加机器翻译的语言支持 新增希腊语、西班牙语、法语和葡萄牙语的机器翻译支持,并调整语言资源加载顺序 |
||
|
|
06dd581fc3 |
chore(env): add .env.example file and update .gitignore
- Introduced a new .env.example file with NODE_OPTIONS configuration. - Updated .gitignore to exclude .env.example from being ignored. - Added instructions in dev.md for copying .env.example to .env. |
||
|
|
14c3b11664
|
docs(logger): update logger docs (#8436)
* docs(logger): 更新日志使用文档的格式和内容 - 补充记录非object类型上下文信息的示例 - 修正环境变量格式为代码样式 - 统一中英文文档的标点符号和格式 - 修复文档中的拼写错误和示例错误 * docs: 修正日志使用文档中的标点格式 统一中英文文档中关于调用方式说明的标点格式,将中文文档的冒号改为句号以保持一致性 * docs(technical): 修正日志使用文档中的代码块标记 将环境变量示例的代码块标记从env改为bash以正确高亮显示 * docs(technical): 修正日志级别文档中的示例格式 |
||
|
|
c2086fdb15
|
refactor[Logger]: strict type check for Logger (#8363)
* fix: strict type check of logger * feat: logger format in renderer * fix: error type |
||
|
|
736f73a726
|
refactor: match provider and model using a consistent method (#7933)
* refactor: match provider and model using a consistent method * refactor: use keywords matching across model selectors * refactor: update match, reuse getFancyProviderName * refactor: use modelSelectFilter in knowledgebase settings * refactor: use filter in ModelList * refactor: add filterModelsByKeywords * refactor: add getModelSelectOptions * style: better function names * fix: update effect dependencies in popup and panel components Adjusted dependency arrays in HtmlArtifactsPopup and QuickPanelView to ensure correct effect execution. This change improves state synchronization and prevents unnecessary updates. * refactor: use match in memory settings * refactor: add avatar to model selector * refactor: simplify utils, move select options to components * docs: add comments * refactor: move filter to SelectOptions * test: add tests for SelectOptions * test: remove type mock * refactor: use match in EditModelsPopup * refactor: use SelectOptions in SelectProviderModelPopup, add more tests * fix: api check model select * refactor: improve websearch rag model select style * refactor: add a ModelSelector * test: update tests for ModelSelector * docs: comments --------- Co-authored-by: 自由的世界人 <3196812536@qq.com> |
||
|
|
929f7445ed
|
feat(CodeBlock): support matplotlib in code execution (#8069)
* feat(CodeBlock): support matplotlib in code execution * refactor: update output style and docs * refactor: use ImageViewer * refactor: manage service config, increase timeout and retry count * refactor: improve worker message logging * chore: upgrade pyodide to 0.28.0 * docs: fix typos |
||
|
|
2b0c46bfdb
|
refactor: model list and health check (#7997)
* refactor(ProviderSetting): add a backtop to provider setting * refactor: decouple ModelList from ProviderSetting * refactor: move modellist to a single dir * refactor: allow more props for CollapsibleSearchBar * refactor: split ModelList into ModelList, ModelListGroup and ModelListItem * refactor: simplify health check types, improve file structure * refactor: split HealthStatusIndicator from list items * refactor: better indicator tooltip * refactor: improve model search, simplify some expressions * refactor: further simplify ModelList by extracting onHealthCheck * refactor: remove double scroller from EditModelsPopup * revert: remove backtop * fix: i18n order * refactor: sort buttons |
||
|
|
5204438c0c
|
refactor[Logger]: filtering logs with environment variable (#8299)
refactor(Logger): enhance logging with environment variable support - Updated LoggerService to utilize environment variables for filtering logs by level and module in development mode. - Modified the logging level handling to use constants from the logger configuration. - Enhanced documentation to include details on using environment variables for log filtering in both English and Chinese documentation files. - Cleaned up unused type definitions related to logging. |
||
|
|
2e77792042
|
fix[Logger]: in renderer worker (#8284)
* docs: enhance LoggerService documentation and usage guidelines - Added details about `initWindowSource` method, emphasizing its return of the LoggerService instance for method chaining. - Introduced a section on using LoggerService within `worker` threads, highlighting the need to call `initWindowSource` first. - Updated both English and Chinese documentation files to reflect these changes, ensuring clarity in usage instructions for developers. * docs: update LoggerService documentation and improve environment checks - Enhanced documentation for using LoggerService in worker threads, clarifying logging support limitations in main and renderer processes. - Added environment checks for development and production modes directly in the LoggerService. - Removed the unused env utility file to streamline the codebase. * refactor(ShikiStreamService): update highlighter management and improve test assertions - Modified the highlighter management in ShikiStreamService to clear the reference instead of disposing it directly, as it is now managed by AsyncInitializer. - Enhanced unit tests to verify the initialization of worker and main highlighters, ensuring that either one is active but not both, and updated assertions related to highlighter disposal. |
||
|
|
7764ffc8bb
|
refactor[Logger]: replace console logging with logger service (#8271)
* refactor: replace console logging with logger service across multiple components - Updated various files to utilize the logger service instead of console.log for improved logging consistency and error tracking. - Enhanced logging levels to better categorize messages, including debug and error levels. - Refactored logging in components such as ApiClientFactory, KnowledgeService, and MemoryProcessor to align with the new logging standards. * refactor: update logging level in App component from error to info - Changed the logging level in the App component to provide a more appropriate context for initialization messages, enhancing clarity in the logging output. * refactor(logging): replace console.log with logger service in middleware and update ESLint comments - Updated the logging implementation in the createSimpleLoggingMiddleware function to use logger.debug and logger.error instead of console.log and console.error for improved logging consistency. - Added eslint-disable comments for restricted syntax in preload and useAppInit hooks to suppress warnings. |
||
|
|
40f9601379
|
refactor: Unified Logger / 统一日志管理 (#8207)
* Revert "feat: optimize minapp cache with LRU (#8160)"
This reverts commit
|
||
|
|
72ae105166
|
[1.5.0-rc] Feat/memory (#7689)
* Merge memory into main * Improvement/memory UI (#7655) * feat: add auto-dimension detection to memory settings - Add automatic embedding dimension detection for memory configuration - Add toggle switch to enable/disable auto-detection (enabled by default) - Detect dimensions by making test API call to embedding provider - Show dimension input field only when auto-detection is disabled - Add loading state and error handling during dimension detection - Maintain consistency with knowledge base dimension handling 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com> * ✨ feat: implement unified embedding dimensions for memory service - Add jaison dependency for robust JSON parsing - Normalize all embeddings to 1536 dimensions for consistency - Improve embedding dimension logging - Update memory processor to use jaison for better error handling - Handle various JSON response formats in fact extraction 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com> * feat: refactor MemoriesPage layout with new styled components and improved user management features --------- Co-authored-by: Claude <noreply@anthropic.com> * Improvement/memory UI (#7656) Co-authored-by: Claude <noreply@anthropic.com> * ✨ feat: add memory icon to sidebar for existing users - Add migration version 118 to enable memory feature visibility - Adds 'memory' icon to sidebar visible icons if not already present - Updates store version to trigger migration for existing users 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com> * fix(memory): include last user message ID in processor config * ✨ feat(memory): enhance memory settings UI and add new translations * Enhance memory management UI: Added settings, statistics, search, actions, and user management sections to the memory page. Updated translations for multiple languages to include new UI elements. Refactored component structure for improved layout and readability. * feat: add i18n * ui: Enhance memory modals and UI * refactor(memory): replace direct message calls with window.message for error and success notifications * fix: eslint error * feat(memory): enhance memory restoration logic and queries - Updated MemoryService to restore deleted memories instead of inserting new ones if a memory with the same hash exists. - Added new SQL queries to check for deleted memories and restore them. - Improved logging for memory restoration and embedding generation. - Refactored related API service methods to handle updated memory processing logic. * refactor: update memory configuration to use ApiClient structure - Refactored memory-related services and components to utilize the new ApiClient structure for embedding and reranking models. - Updated constructors and method signatures across multiple files to accept embedApiClient and rerankApiClient parameters. - Enhanced memory settings UI to reflect changes in memory configuration management. - Improved type definitions for KnowledgeBaseParams and MemoryConfig to align with the new structure. * ui: improve user interface for adding new users in memory page - Enhanced the button for adding new users by incorporating an icon and adjusting padding for better alignment. - Updated the user selection options to ensure consistent alignment of avatars and user names. - Refactored layout to improve overall user experience and visual consistency. * refactor(memory): streamline MemoryProcessor usage in ApiService - Removed the singleton instance of MemoryProcessor and instantiated it directly within the ApiService methods. - Updated relevant methods to utilize the new instance for searching and processing memories, improving clarity and encapsulation of memory handling logic. * chore: move knowledge dir * fix: correct import paths in KnowledgeService.ts * fix(Memory): memory deduplicate * fix(Memory): memory llm provider * fix: ci error * fix(Memory): update fact extraction prompt to focus on personal information * feat: Refactor memory fom sidebar to settings page - Removed MemoryStick icon from Sidebar component. - Updated navigation to point to the new memory settings page. - Introduced MemoriesSettingsModal for managing memory configurations. - Created MemorySettings component for comprehensive memory management. - Added user management features including adding, editing, and deleting users. - Implemented pagination and search functionality for memory items. - Updated sidebar settings to remove memory icon and ensure proper migration. - Adjusted Redux store settings to reflect changes in sidebar icons. * feat: redesign memory settings page with improved UI and layout * fix i18n * fix: update citation titles to include memory hash and increment version number * fix: remove unnecessary prop from KnowledgeCitation component * feat: enhance fact extraction prompt with clearer guidelines and examples * 🔧 feat: disable global memory by default and improve UI - Set globalMemoryEnabled default to false for better user experience - Remove manual localStorage handling to rely on redux-persist - Add Beta badge to memory settings section - Improve layout and styling of memory settings UI components 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com> * Simplify external tool completion handling * Fix whitespace in migrate config --------- Co-authored-by: Claude <noreply@anthropic.com> Co-authored-by: suyao <sy20010504@gmail.com> Co-authored-by: eeee0717 <chentao020717Work@outlook.com> Co-authored-by: kangfenmao <kangfenmao@qq.com> Co-authored-by: 自由的世界人 <3196812536@qq.com> |
||
|
|
a314a43f0f
|
refactor(translate): Language Type (#7727)
* refactor(translate): 重构翻译功能使用语言枚举类型 统一翻译功能中的语言表示方式,使用枚举类型替代字符串 更新相关组件和服务以适配新的语言类型定义 添加数据库迁移脚本处理语言类型变更 添加store迁移处理语言类型变更 * refactor(translate): 移除调试用的console.log语句 * refactor(translate): 移除冗余的类型检查逻辑 * fix(db): 添加对TranslateHistory的db迁移 * fix(databases): 捕获数据库升级时的语言映射错误 添加错误处理以防止语言映射失败时中断升级过程 * fix(翻译组件): 修复语言比较和选择逻辑错误 修复语言比较时直接比较对象而非langCode的问题 更新Select组件使用langCode作为值并正确处理语言切换 * refactor(translate): 将saveTranslateHistory参数类型从Language改为LanguageCode * refactor(hooks): 更新useMessageOperations中的语言代码类型 将targetLanguage和sourceLanguage参数类型从string更新为LanguageCode,提高类型安全性 * docs(translate): 更新JSDoc注释以使用TypeScript类型语法 * feat(备份服务): 升级数据库版本至v8并添加迁移逻辑 添加从v7到v8的数据库迁移支持 更新翻译历史记录中的语言代码映射 优化迁移过程中的日志记录和错误处理 * fix(store): 修复目标语言迁移时的默认值处理 确保在迁移配置时将旧版语言代码正确映射到新版格式,无法映射时使用默认英语 * refactor(translate): 将语言标签从字符串改为函数以支持动态翻译 * refactor(translate): 优化翻译窗口语言选择逻辑 重构翻译窗口的目标语言选择逻辑,使用语言代码获取完整语言信息 移除冗余的Space组件,简化Select选项渲染方式 * docs(技术文档): 新增数据库设置字段文档 添加数据库设置字段的说明文档,包含翻译相关字段的类型和用途 * refactor(translate): 修改db中biDirectionLangPair存储类型 将语言代码处理统一改为存储langCode而非Language对象 修改相关代码以使用getLanguageByLangcode进行转换 更新数据库升级逻辑以兼容新格式 * docs(translate): 为getLanguageByLangcode函数添加注释说明 * fix(数据库升级): 修复升级到V8时可能出现的空值访问问题 * refactor(databases): 优化语言映射错误处理逻辑 将不必要的try-catch块替换为if条件判断 * docs(technical): 修正数据库设置文档中的类型描述 * refactor: 优化语言代码处理和变量命名 * fix(ActionTranslate): 使用langCode存储双向翻译语言对 * fix(migrate): 修复错误的迁移过程 * refactor(translate): 重构语言选项从硬编码改为动态生成 将translateLanguageOptions从硬编码的数组改为通过LanguagesEnum动态生成,提高可维护性 * fix(store): 更新持久化存储版本并修复语言映射迁移问题 将持久化存储版本从119升级到120,并修复语言代码映射迁移问题。迁移过程中将旧的语言标识转换为新的标准语言代码格式。 |
||
|
|
a567666c79
|
docs: add testplan md (#7854)
|
||
|
|
244a42f3be |
chore(docs): update README files and remove Japanese version
- Updated the English and Chinese README files to improve layout and add new language options. - Removed the Japanese README file as part of the documentation cleanup. - Enhanced badge visibility and adjusted image sizes for better presentation. - Added GitHub statistics section to provide insights into project activity. |
||
|
|
5f4d73b00d
|
feat: add middleware support for provider (#6176)
* feat: add middleware support for OpenAIProvider with logging capabilities - Introduced middleware functionality in OpenAIProvider to enhance completions processing. - Created AiProviderMiddlewareTypes for defining middleware interfaces and contexts. - Implemented sampleLoggingMiddleware for logging message content and processing times. - Updated OpenAIProvider constructor to accept middleware as an optional parameter. - Refactored completions method to utilize middleware for improved extensibility and logging. * refactor: streamline OpenAIProvider initialization and middleware application - Removed optional middleware parameter from OpenAIProvider constructor for simplicity. - Refactored ProviderFactory to create instances of providers and apply logging middleware consistently. - Enhanced completions method visibility by changing it from private to public. - Cleaned up unused code related to middleware handling in OpenAIProvider. * feat: enhance AiProvider with new middleware capabilities and completion context - Added public getter for provider info in BaseProvider. - Introduced finalizeSdkRequestParams hook for middleware to modify SDK-specific request parameters. - Refactored completions method in OpenAIProvider to accept a context object, improving middleware integration. - Updated middleware types to include new context structure and callback functions for better extensibility. - Enhanced logging middleware to utilize new context structure for improved logging capabilities. * refactor: enhance middleware structure and context handling in AiProvider - Updated BaseProvider and AiProvider to utilize AiProviderMiddlewareCompletionsContext for completions method. - Introduced new utility functions for middleware context creation and execution. - Refactored middleware application logic to improve extensibility and maintainability. - Replaced sampleLoggingMiddleware with a more robust LoggingMiddleware implementation. - Added new context management features for better middleware integration. * refactor: update AiProvider and middleware structure for improved completions handling - Refactored BaseProvider and AiProvider to change completions method signature from context to params. - Removed unused AiProviderMiddlewareCompletionsContext and related code for cleaner implementation. - Enhanced middleware configuration by introducing a dedicated middleware registration file. - Implemented logging middleware for completions to improve observability during processing. - Streamlined middleware application logic in ProviderFactory for better maintainability. * docs: 添加中间件编写指南文档 - 新增《如何为 AI Provider 编写中间件》文档,详细介绍中间件架构、类型及编写示例。 - 说明了中间件的执行顺序、注册方法及最佳实践,旨在帮助开发者有效创建和维护中间件。 * refactor: update completions method signatures and introduce CompletionsResult type - Changed the completions method signature in BaseProvider and AiProvider to return CompletionsResult instead of void. - Added CompletionsResult type definition to encapsulate streaming and usage metrics. - Updated middleware and related components to handle the new CompletionsResult structure, ensuring compatibility with existing functionality. - Introduced new middleware for stream adaptation to enhance chunk processing during completions. * refactor: enhance AiProvider middleware and streaming handling - Updated CompletionsResult type to support both OpenAI SDK stream and ReadableStream. - Modified CompletionsMiddleware to return CompletionsResult, improving type safety. - Introduced StreamAdapterMiddleware to adapt OpenAI SDK streams to application-specific chunk streams. - Enhanced logging in CompletionsLoggingMiddleware to capture and return results from next middleware calls. * refactor: update AiProvider and middleware for OpenAI completions handling - Renamed CompletionsResult to CompletionsOpenAIResult for clarity and updated its structure to support both OpenAI SDK and application-specific streams. - Modified completions method signatures in AiProvider and OpenAIProvider to return CompletionsOpenAIResult. - Enhanced middleware to process and adapt OpenAI SDK streams into standard chunk formats, improving overall streaming handling. - Introduced new middleware components: FinalChunkConsumerAndNotifierMiddleware and OpenAISDKChunkToStandardChunkMiddleware for better chunk processing and logging. * 删除 ExtractReasoningCompletionsMiddleware.ts 文件,清理未使用的中间件代码以提高代码整洁性和可维护性。 * refactor: consolidate middleware types and improve imports - Replaced references to AiProviderMiddlewareTypes with the new middlewareTypes file across various middleware components for better organization. - Introduced TextChunkMiddleware to enhance chunk processing from OpenAI SDK streams. - Cleaned up imports in multiple files to reflect the new structure, improving code clarity and maintainability. * feat: enhance abort handling with AbortController in middleware chain - Update CompletionsOpenAIResult interface to use AbortController instead of AbortSignal - Modify OpenAIProvider to pass abortController in completions method return - Update AbortHandlerMiddleware to use controller from upstream result - Improve abort handling flexibility by exposing full controller capabilities - Enable middleware to actively control abort operations beyond passive monitoring This change provides better control over request cancellation and enables more sophisticated abort handling patterns in the middleware pipeline. * refactor: enhance AiProvider and middleware for improved completions handling - Updated BaseProvider to expose additional methods and properties, including getMessageParam and createAbortController. - Modified OpenAIProvider to streamline completions processing and integrate new middleware for tool handling. - Introduced TransformParamsBeforeCompletions middleware to standardize parameter transformation before completions. - Added McpToolChunkMiddleware for managing tool calls within the completions stream. - Enhanced middleware types to support new functionalities and improve overall structure. These changes improve the flexibility and maintainability of the AiProvider and its middleware, facilitating better handling of OpenAI completions and tool interactions. * refactor: enhance middleware for recursive handling and internal state management - Introduced internal state management in middleware to support recursive calls, including enhanced dispatch functionality. - Updated middleware types to include new internal fields for managing recursion depth and call status. - Improved logging for better traceability of recursive calls and state transitions. - Adjusted various middleware components to utilize the new internal state, ensuring consistent behavior during recursive processing. These changes enhance the middleware's ability to handle complex scenarios involving recursive calls, improving overall robustness and maintainability. * fix(OpenAIProvider): return empty object for missing sdkParams in completions handling - Updated OpenAIProvider to return an empty object instead of undefined when sdkParams are not found, ensuring consistent return types. - Enhanced TransformParamsBeforeCompletions middleware to include a flag for built-in web search functionality based on assistant settings. * refactor(OpenAIProvider): enhance completions handling and middleware integration - Updated the completions method in OpenAIProvider to include an onChunk callback for improved streaming support. - Enabled the ThinkChunkMiddleware in the middleware registration for better handling of reasoning content. - Increased the maximum recursion depth in McpToolChunkMiddleware to prevent infinite loops. - Refined TextChunkMiddleware to directly enqueue chunks without unnecessary type checks. - Improved the ThinkChunkMiddleware to better manage reasoning tags and streamline chunk processing. These changes enhance the overall functionality and robustness of the AI provider and middleware components. * feat(WebSearchMiddleware): add web search handling and integration - Introduced WebSearchMiddleware to process various web search results, including annotations and citations, and generate LLM_WEB_SEARCH_COMPLETE chunks. - Enhanced TextChunkMiddleware to support link conversion based on the model and assistant settings, improving the handling of TEXT_DELTA chunks. - Updated middleware registration to include WebSearchMiddleware for comprehensive search result processing. These changes enhance the AI provider's capabilities in handling web search functionalities and improve the overall middleware architecture. * fix(middleware): improve optional chaining for chunk processing - Updated McpToolChunkMiddleware and ThinkChunkMiddleware to use optional chaining for accessing choices, enhancing robustness against undefined values. - Removed commented-out code in ThinkChunkMiddleware to streamline the chunk handling process. These changes improve the reliability of middleware when processing OpenAI API responses. * feat(middleware): enhance AbortHandlerMiddleware with recursion handling - Added logic to detect and handle recursive calls, preventing unnecessary creation of AbortControllers. - Improved logging for better visibility into middleware operations, including recursion depth and cleanup processes. - Streamlined cleanup process for non-stream responses to ensure resources are released promptly. These changes enhance the robustness and efficiency of the AbortHandlerMiddleware in managing API requests. * docs(middleware): 迁移步骤 * feat(middleware): implement FinalChunkConsumerMiddleware for usage and metrics accumulation - Introduced FinalChunkConsumerMiddleware to replace the deprecated FinalChunkConsumerAndNotifierMiddleware. - This new middleware accumulates usage and metrics data from OpenAI API responses, enhancing tracking capabilities. - Updated middleware registration to utilize the new FinalChunkConsumerMiddleware, ensuring proper integration. - Added support for handling recursive calls and improved logging for better debugging and monitoring. These changes enhance the middleware's ability to manage and report usage metrics effectively during API interactions. * refactor(migrate): update API request and response structures to TypeScript types - Changed the definitions of `CoreCompletionsRequest` and `Chunk` to use TypeScript types instead of Zod Schemas for better type safety and clarity. - Updated middleware and service classes to handle the new `Chunk` type, ensuring compatibility with the revised API client structure. - Enhanced the response processing logic to standardize the handling of raw SDK chunks into application-level `Chunk` objects. - Adjusted middleware to consume the new `Chunk` type, streamlining the overall architecture and improving maintainability. These changes facilitate a more robust and type-safe integration with AI provider APIs. * feat(AiProvider): implement API client architecture - Introduced ApiClientFactory for creating instances of API clients based on provider configuration. - Added BaseApiClient as an abstract class to provide common functionality for specific client implementations. - Implemented OpenAIApiClient for OpenAI and Azure OpenAI, including request and response handling. - Defined types and interfaces for API client operations, enhancing type safety and clarity. - Established middleware schemas for standardized request processing across AI providers. These changes lay the groundwork for a modular and extensible API client architecture, improving the integration of various AI providers. * refactor(StreamAdapterMiddleware): simplify stream adaptation logic - Updated StreamAdapterMiddleware to directly use AsyncIterable instead of wrapping it with rawSdkChunkAdapter, streamlining the adaptation process. - Modified asyncGeneratorToReadableStream to accept AsyncIterable, enhancing its flexibility and usability. These changes improve the efficiency of stream handling in the middleware. * refactor(AiProvider): simplify ResponseChunkTransformer interface and streamline OpenAIApiClient response handling - Changed ResponseChunkTransformer from an interface to a type for improved clarity and simplicity. - Refactored OpenAIApiClient to streamline the response transformation logic, reducing unnecessary complexity in handling tool calls and reasoning content. - Enhanced type safety by ensuring consistent handling of optional properties in response processing. These changes improve the maintainability and readability of the codebase while ensuring robust response handling in the API client. * doc(technicalArchitecture): add comprehensive documentation for AI Provider architecture * feat(architecture): introduce AI Core Design documentation and middleware specification - Added a comprehensive technical architecture document for the new AI Provider (`aiCore`), outlining core design principles, component details, and execution flow. - Established a middleware specification document to define the design, implementation, and usage of middleware within the `aiCore` module, promoting a flexible and maintainable system. - These additions provide clarity and guidance for future development and integration of AI functionalities within Cherry Studio. * refactor(middleware): consolidate and enhance middleware architecture - Removed deprecated extractReasoningMiddleware and integrated its functionality into existing middleware. - Streamlined middleware registration and improved type definitions for better clarity and maintainability. - Introduced new middleware components for handling chunk processing, web search, and reasoning tags, enhancing overall functionality. - Updated various middleware to utilize the new structures and improve logging for better debugging. These changes enhance the middleware's efficiency and maintainability, providing a more robust framework for API interactions. * refactor(AiProvider): enhance API client and middleware integration - Updated ApiClientFactory to include new SDK types for improved type safety and clarity. - Refactored BaseApiClient to support additional parameters in the completions method, enhancing flexibility for processing states. - Streamlined OpenAIApiClient to better handle tool calls and responses, including the introduction of new chunk types for tool management. - Improved middleware architecture by integrating processing states and refining message handling, ensuring a more robust interaction with the API. These changes enhance the overall maintainability and functionality of the API client and middleware, providing a more efficient framework for AI interactions. * fix(McpToolChunkMiddleware): remove redundant logging in recursion state update * refactor(McpToolChunkMiddleware): update tool call handling and type definitions - Replaced ChatCompletionMessageToolCall with SdkToolCall for improved type consistency. - Updated return types of executeToolCalls and executeToolUses functions to SdkMessage[], enhancing clarity in message handling. - Removed unused import to streamline the code. These changes enhance the maintainability and type safety of the middleware, ensuring better integration with the SDK. * refactor(middleware): enhance middleware structure and type handling - Updated middleware components to utilize new SDK types, improving type safety and clarity across the board. - Refactored various middleware to streamline processing logic, including enhanced handling of SDK messages and tool calls. - Improved logging and error handling for better debugging and maintainability. - Consolidated middleware functions to reduce redundancy and improve overall architecture. These changes enhance the robustness and maintainability of the middleware framework, ensuring a more efficient interaction with the API. * refactor(middleware): unify type imports and enhance middleware structure - Updated middleware components to import types from a unified 'types' file, improving consistency and clarity across the codebase. - Removed the deprecated 'type.ts' file to streamline the middleware structure. - Enhanced middleware registration and export mechanisms for better accessibility and maintainability. These changes contribute to a more organized and efficient middleware framework, facilitating easier future development and integration. * refactor(AiProvider): enhance API client and middleware integration - Updated AiProvider components to support new SDK types, improving type safety and clarity. - Refactored middleware to streamline processing logic, including enhanced handling of tool calls and responses. - Introduced new middleware for tool use extraction and raw stream listening, improving overall functionality. - Improved logging and error handling for better debugging and maintainability. These changes enhance the robustness and maintainability of the API client and middleware, ensuring a more efficient interaction with the API. * feat(middleware): add new middleware components for raw stream listening and tool use extraction - Introduced RawStreamListenerMiddleware and ToolUseExtractionMiddleware to enhance middleware capabilities. - Updated MiddlewareRegistry to include new middleware entries, improving overall functionality and extensibility. These changes expand the middleware framework, facilitating better handling of streaming and tool usage scenarios. * refactor(AiProvider): integrate new API client and middleware architecture - Replaced BaseProvider with ApiClientFactory to enhance API client instantiation. - Updated completions method to utilize new middleware architecture for improved processing. - Added TODOs for refactoring remaining methods to align with the new API client structure. - Removed deprecated middleware wrapping logic from ApiClientFactory for cleaner implementation. These changes improve the overall structure and maintainability of the AiProvider, facilitating better integration with the new middleware system. * refactor(middleware): update middleware architecture and documentation - Revised middleware naming conventions and introduced a centralized MiddlewareRegistry for better management and accessibility. - Enhanced MiddlewareBuilder to support named middleware and streamline the construction of middleware chains. - Updated documentation to reflect changes in middleware usage and structure, improving clarity for future development. These changes improve the organization and usability of the middleware framework, facilitating easier integration and maintenance. * refactor(AiProvider): enhance completions middleware logic and API client handling - Updated the completions method to conditionally remove middleware based on parameters, improving flexibility in processing. - Refactored the response chunk transformer in OpenAIApiClient and AnthropicAPIClient to utilize a more streamlined approach with TransformStream. - Simplified middleware context handling by removing unnecessary custom state management. - Improved logging and error handling across middleware components for better debugging and maintainability. These changes enhance the efficiency and clarity of the AiProvider's middleware integration, ensuring a more adaptable and robust processing framework. * refactor(AiProvider, middleware): clean up logging and improve method naming - Removed unnecessary logging of parameters in AiProvider to streamline the code. - Updated method name assignment in middleware to enhance clarity and consistency. These changes contribute to a cleaner codebase and improve the readability of the middleware and provider components. * feat(middleware): enhance middleware types and add RawStreamListenerMiddleware - Introduced RawStreamListenerMiddleware to the MiddlewareName enum for improved middleware capabilities. - Updated type definitions across middleware components to enhance type safety and clarity, including the addition of new SDK types. - Refactored context and middleware API interfaces to support more specific type parameters, improving overall maintainability. These changes expand the middleware framework, facilitating better handling of streaming scenarios and enhancing type safety across the codebase. * refactor(messageThunk): convert callback functions to async and handle errors during database updates This commit updates several callback functions in the messageThunk to be asynchronous, ensuring that block transitions are awaited properly. Additionally, error handling is added for the database update function to log any failures when saving blocks. This improves the reliability and responsiveness of the message processing flow. * refactor: enhance message block handling in messageThunk This commit refactors the message processing logic in messageThunk to improve the management of message blocks. Key changes include the introduction of dedicated IDs for different block types (main text, thinking, tool, and image) to streamline updates and transitions. The handling of placeholder blocks has been improved, ensuring that they are correctly converted to their respective types during processing. Additionally, error handling has been enhanced for better reliability in database updates. * feat(AiProvider): add default timeout configuration and enhance API client aborthandler - Introduced a default timeout constant to the configuration for improved API client timeout management. - Updated BaseApiClient and its derived classes to utilize the new timeout setting, ensuring consistent timeout behavior across different API clients. - Enhanced middleware to pass the timeout value during API calls, improving error handling and responsiveness. These changes improve the overall robustness and configurability of the API client interactions, facilitating better control over request timeouts. * feat(GeminiProvider): implement Gemini API client and enhance file handling - Introduced GeminiAPIClient to facilitate interactions with the Gemini API, replacing the previous GoogleGenAI integration. - Refactored GeminiProvider to utilize the new API client, improving code organization and maintainability. - Enhanced file handling capabilities, including support for PDF uploads and retrieval of file metadata. - Updated message processing to accommodate new SDK types and improve content generation logic. These changes significantly enhance the functionality and robustness of the GeminiProvider, enabling better integration with the Gemini API and improving overall user experience. * refactor(AiProvider, middleware): streamline API client and middleware integration - Removed deprecated methods and types from various API clients, enhancing code clarity and maintainability. - Updated the CompletionsParams interface to support messages as a string or array, improving flexibility in message handling. - Refactored middleware components to eliminate unnecessary state management and improve type safety. - Enhanced the handling of streaming responses and added utility functions for better stream management. These changes contribute to a more robust and efficient architecture for the AiProvider and its associated middleware, facilitating improved API interactions and user experience. * refactor(middleware): translation 适配 - Deleted SdkCallMiddleware to streamline middleware architecture and improve maintainability. - Commented out references to SdkCallModule in examples and registration files to prevent usage. - Enhanced logging in AbortHandlerMiddleware for better debugging and tracking of middleware execution. - Updated parameters in ResponseTransformMiddleware to improve flexibility in handling response settings. These changes contribute to a cleaner and more efficient middleware framework, facilitating better integration and performance. * refactor(ApiCheck): streamline API validation and error handling - Updated the API check logic to simplify validation processes and improve error handling across various components. - Refactored the `checkApi` function to throw errors directly instead of returning validation objects, enhancing clarity in error management. - Improved the handling of API key checks in `checkModelWithMultipleKeys` to provide more informative error messages. - Added a new method `getEmbeddingDimensions` in the `AiProvider` class to facilitate embedding dimension retrieval, enhancing model compatibility checks. These changes contribute to a more robust and maintainable API validation framework, improving overall user experience and error reporting. * refactor(HealthCheckService, ModelService): improve error handling and performance metrics - Updated error handling in `checkModelWithMultipleKeys` to truncate error messages for better readability. - Refactored `performModelCheck` to remove unnecessary error handling, focusing on performance metrics by returning only latency. - Enhanced the `checkModel` function to ensure consistent return types, improving clarity in API interactions. These changes contribute to a more efficient and user-friendly error reporting and performance tracking system. * refactor(AiProvider, models): enhance model handling and API client integration - Updated the `listModels` method in various API clients to improve model retrieval and ensure consistent return types. - Refactored the `EditModelsPopup` component to handle model properties more robustly, including fallback options for `id`, `name`, and other attributes. - Enhanced type definitions for models in the SDK to support new integrations and improve type safety. These changes contribute to a more reliable and maintainable model management system within the AiProvider, enhancing overall user experience and API interactions. * refactor(AiProvider, clients): implement image generation functionality - Refactored the `generateImage` method in the `AiProvider` class to utilize the `apiClient` for image generation, replacing the previous placeholder implementation. - Updated the `BaseApiClient` to include an abstract `generateImage` method, ensuring all derived clients implement this functionality. - Implemented the `generateImage` method in `GeminiAPIClient` and `OpenAIAPIClient`, providing specific logic for image generation based on the respective SDKs. - Added type definitions for `GenerateImageParams` across relevant files to enhance type safety and clarity in image generation parameters. These changes enhance the image generation capabilities of the AiProvider, improving integration with various API clients and overall user experience. * refactor(AiProvider, clients): restructure API client architecture and remove deprecated components - Refactored the `ProviderFactory` and removed the `AihubmixProvider` to streamline the API client architecture. - Updated the import paths for `isOpenAIProvider` to reflect the new structure. - Introduced `AihubmixAPIClient` and `OpenAIResponseAPIClient` to enhance client handling based on model types. - Improved the `AiProvider` class to utilize the new clients for better model-specific API interactions. - Enhanced type definitions and error handling across various components to improve maintainability and clarity. These changes contribute to a more efficient and organized API client structure, enhancing overall integration and user experience. * fix: update system prompt handling in API clients to use await for asynchronous operations - Modified the `AnthropicAPIClient`, `GeminiAPIClient`, `OpenAIAPIClient`, and `OpenAIResponseAPIClient` to ensure `buildSystemPrompt` is awaited, improving the handling of system prompts. - Adjusted the `fetchMessagesSummary` function to utilize the last five user messages for better context in API calls and added a utility function to clean up topic names. These changes enhance the reliability of prompt generation and improve the overall API interaction experience. * refactor(middleware): remove examples.ts to streamline middleware documentation - Deleted the `examples.ts` file containing various middleware usage examples to simplify the middleware structure and documentation. - This change contributes to a cleaner codebase and focuses on essential middleware components, enhancing maintainability. * refactor(AiProvider, middleware): enhance middleware handling and error management - Updated the `CompletionsParams` interface to include a new `callType` property for better middleware decision-making based on the context of the API call. - Introduced `ErrorHandlerMiddleware` to standardize error handling across middleware, allowing errors to be captured and processed as `ErrorChunk` objects. - Modified the `AbortHandlerMiddleware` to conditionally remove itself based on the `callType`, improving middleware efficiency. - Cleaned up logging in `AbortHandlerMiddleware` to reduce console output and enhance performance. - Updated middleware registration to include the new `ErrorHandlerMiddleware`, ensuring comprehensive error management in the middleware pipeline. These changes contribute to a more robust and maintainable middleware architecture, improving error handling and overall API interaction efficiency. * feat: implement token estimation for message handling - Added an abstract method `estimateMessageTokens` to the `BaseApiClient` class for estimating token usage based on message content. - Implemented the `estimateMessageTokens` method in `AnthropicAPIClient`, `GeminiAPIClient`, `OpenAIAPIClient`, and `OpenAIResponseAPIClient` to calculate token consumption for various message types. - Enhanced middleware to accumulate token usage for new messages, improving tracking of API call costs. These changes improve the efficiency of message processing and provide better insights into token usage across different API clients. * feat: add support for image generation and model handling - Introduced `SUPPORTED_DISABLE_GENERATION_MODELS` to manage models that disable image generation. - Updated `isSupportedDisableGenerationModel` function to check model compatibility. - Enhanced `Inputbar` logic to conditionally enable image generation based on model support. - Modified API clients to handle image generation calls and responses, including new chunk types for image data. - Updated middleware and service layers to incorporate image generation parameters and improve overall processing. These changes enhance the application's capabilities for image generation and improve the handling of various model types. * feat: enhance GeminiAPIClient for image generation support - Added `getGenerateImageParameter` method to configure image generation parameters. - Updated request handling in `GeminiAPIClient` to include image generation options. - Enhanced response processing to handle image data and enqueue it correctly. These changes improve the GeminiAPIClient's capabilities for generating and processing images, aligning with recent enhancements in image generation support. * feat: enhance image generation handling in OpenAIResponseAPIClient and middleware - Updated OpenAIResponseAPIClient to improve user message processing for image generation. - Added handling for image creation events in TransformCoreToSdkParamsMiddleware. - Adjusted ApiService to streamline image generation event handling. - Modified messageThunk to reflect changes in image block status during processing. These enhancements improve the integration and responsiveness of image generation features across the application. * refactor: remove unused AI provider classes - Deleted `AihubmixProvider`, `AnthropicProvider`, `BaseProvider`, `GeminiProvider`, and `OpenAIProvider` as they are no longer utilized in the codebase. - This cleanup reduces code complexity and improves maintainability by removing obsolete components related to AI provider functionality. * chore: remove obsolete test files for middleware - Deleted test files for `AbortHandlerMiddleware`, `LoggingMiddleware`, `TextChunkMiddleware`, `ThinkChunkMiddleware`, and `WebSearchMiddleware` as they are no longer needed. - This cleanup helps streamline the codebase and reduces maintenance overhead by removing outdated tests. * chore: remove Suggestions component and related functionality - Deleted the `Suggestions` component from the home page as it is no longer needed. - Removed associated imports and functions related to suggestion fetching, streamlining the codebase. - This cleanup helps improve maintainability by eliminating unused components. * feat: enhance OpenAIAPIClient and StreamProcessingService for tool call handling - Updated OpenAIAPIClient to conditionally include tool calls in the assistant message, improving message processing logic. - Enhanced tool call handling in the response transformer to correctly manage and enqueue tool call data. - Added a new callback for LLM response completion in StreamProcessingService, allowing better integration of response handling. These changes improve the functionality and responsiveness of the OpenAI API client and stream processing capabilities. * fix: copilot error * fix: improve chunk handling in TextChunkMiddleware and ThinkChunkMiddleware - Updated TextChunkMiddleware to enqueue LLM_RESPONSE_COMPLETE chunks based on accumulated text content. - Refactored ThinkChunkMiddleware to generate THINKING_COMPLETE chunks when receiving non-THINKING_DELTA chunks, ensuring proper handling of accumulated thinking content. - These changes enhance the middleware's responsiveness and accuracy in processing text and thinking chunks. * chore: update dependencies and improve styling - Updated `selection-hook` dependency to version 0.9.23 in `package.json` and `yarn.lock`. - Removed unused styles from `container.scss` and adjusted padding in `index.scss`. - Enhanced message rendering and layout in various components, including `Message`, `MessageHeader`, and `MessageMenubar`. - Added tooltip support for message divider settings in `SettingsTab`. - Improved handling of citation display in `CitationsList` and `CitationBlock`. These changes streamline the codebase and enhance the user interface for better usability. * feat: implement image generation middleware and enhance model handling - Added `ImageGenerationMiddleware` to handle dedicated image generation models, integrating image processing and OpenAI's image generation API. - Updated `AiProvider` to utilize the new middleware for dedicated image models, ensuring proper middleware chaining. - Introduced constants for dedicated image models in `models.ts` to streamline model identification. - Refactored error handling in `ErrorHandlerMiddleware` to use a utility function for better error management. - Cleaned up imports and removed unused code in various files for improved maintainability. * fix: update dedicated image models identification logic - Modified the `DEDICATED_IMAGE_MODELS` array to include 'grok-2-image' for improved model handling. - Enhanced the `isDedicatedImageGenerationModel` function to use a more robust check for model identification, ensuring better accuracy in middleware processing. * refactor: remove OpenAIResponseProvider class - Deleted the `OpenAIResponseProvider` class from the `AiProvider` module, streamlining the codebase by eliminating unused code. - This change enhances maintainability and reduces complexity in the provider architecture. * fix: usermessage * refactor: simplify AbortHandlerMiddleware for improved abort handling - Removed direct dependency on ApiClient for creating AbortController, enhancing modularity. - Introduced utility functions to manage abort controllers, streamlining the middleware's responsibilities. - Delegated abort signal handling to downstream middlewares, allowing for cleaner separation of concerns. * refactor(aiCore): Consolidate AI provider and middleware architecture This commit refactors the AI-related modules by unifying the `clients` and `middleware` directories under a single `aiCore` directory. This change simplifies the project structure, improves modularity, and makes the architecture more cohesive. Key changes: - Relocated provider-specific clients and middleware into the `aiCore` directory, removing the previous `providers/AiProvider` structure. - Updated the architectural documentation (`AI_CORE_DESIGN.md`) to accurately reflect the new, streamlined directory layout and execution flow. - The main `AiProvider` class is now the primary export of `aiCore/index.ts`, serving as the central access point for AI functionalities. * refactor: update imports and enhance middleware functionality - Adjusted import statements in `AnthropicAPIClient` and `GeminiAPIClient` for better organization. - Improved `AbortHandlerMiddleware` to handle abort signals more effectively, including the conversion of streams to handle abort scenarios. - Enhanced `ErrorHandlerMiddleware` to differentiate between abort errors and other types, ensuring proper error handling. - Cleaned up commented-out code in `FinalChunkConsumerMiddleware` for better readability and maintainability. * refactor: streamline middleware logging and improve error handling - Removed excessive debug logging from various middleware components, including `AbortHandlerMiddleware`, `FinalChunkConsumerMiddleware`, and `McpToolChunkMiddleware`, to enhance readability and performance. - Updated logging levels to use warnings for potential issues in `ResponseTransformMiddleware`, `TextChunkMiddleware`, and `ThinkChunkMiddleware`, ensuring better visibility of important messages. - Cleaned up commented-out code and unnecessary debug statements across multiple middleware files for improved maintainability. --------- Co-authored-by: suyao <sy20010504@gmail.com> Co-authored-by: eeee0717 <chentao020717Work@outlook.com> Co-authored-by: lizhixuan <zhixuan.li@banosuperapp.com> |
||
|
|
5c76d398c5
|
fix: readme twitter link error (#7075) | ||
|
|
9c5fa57936
|
fix: update README files to enhance navigation and add project badges (#6982)
* fix: update README files to enhance navigation and add project badges * fix: english version * fix: sponsor link error |
||
|
|
b2b0fe9072
|
chore: update electron configuration and add debug script (#6361)
* chore: update electron configuration and add debug script - Added sourcemap generation for development builds in electron.vite.config.ts. - Introduced a new debug script in package.json for easier debugging with remote inspection. * docs: add debug section to development documentation - Introduced a new section for debugging instructions, including the command to run the debug script and how to access the Chrome inspect tool. |
||
|
|
d90ac44945 |
docs: update README files to enhance feature listings and organization
- Renumbered feature sections for clarity and consistency across English, Japanese, and Chinese README files. - Improved formatting by removing unnecessary bullet points for a cleaner presentation of core features, knowledge management, platform support, and advanced features. |
||
|
|
07407f751f |
docs: update README files to reflect new roadmap and feature enhancements
- Revised the TODO section to a comprehensive roadmap outlining core features, knowledge management, platform support, and advanced features. - Added links to the project board and GitHub Discussions for community engagement and feedback. |
||
|
|
3693e115a6 |
chore: update release notes and improve README assets
- Updated release notes to include new features such as TokenFlux service support, Claude 4 model integration, and fixes for various issues including Windows user startup problems and search crashes. - Replaced outdated screenshots in README files with new images across English, Japanese, and Chinese documentation. - Enhanced the 'Related Projects' section for better visibility. |
||
|
|
582427663f |
docs: update branching strategy documentation and add English and Chinese versions
- Updated the README to link to the new English branching strategy document. - Added a new English version of the branching strategy document. - Removed the outdated branching strategy document. - Added a Chinese version of the branching strategy document. |
||
|
|
e3f5999362
|
feat: Add-aihubmix-ideogram-v3 (#5958)
* chore: update Yarn version to 4.9.1 and add rendering speed option for V3 model * Discard changes to .yarnrc.yml * Discard changes to .yarn/releases/yarn-4.6.0.cjs * Update package.json * Delete .yarn/releases/yarn-4.9.1.cjs * Discard changes to .yarn/releases/yarn-4.6.0.cjs * docs: Update README.zh.md add GitCode✖️Cherry Studio【新源力】贡献挑战赛 GitCode✖️Cherry Studio【新源力】贡献挑战赛 * fix: Update the file permissions for yarn-4.6.0.cjs, modify image links and formatting in README.zh.md * clean * refactor: improve switch case blocks and update config parameters in AihubmixPage * feat: add error handling for empty image URLs and update localization messages * refactor: replace modal error handling with warning messages for empty image URLs * feat: update localization for rendering speed and translating messages in Japanese, Russian, and Traditional Chinese * feat: add style types and rendering speed options to localization files --------- Co-authored-by: 亢奋猫 <kangfenmao@qq.com> Co-authored-by: suyao <sy20010504@gmail.com> |
||
|
|
273fabafcb |
docs: Update README.zh.md add GitCode✖️Cherry Studio【新源力】贡献挑战赛
GitCode✖️Cherry Studio【新源力】贡献挑战赛
|
||
|
|
be97826ba7
|
docs: Add Photo instructions to the branch strategy document (#5944) | ||
|
|
29f0c72941 | docs: add Branching Strategy document and update README with contribution guidelines | ||
|
|
4225d20760 |
feat: 添加 messageBlock、messageThunk 和 useMessageOperations 使用指南文档
- 新增 `how-to-use-messageBlock.md`,详细介绍 `messageBlock.ts` 的 Redux Slice 及其状态管理、actions 和 selectors。 - 新增 `how-to-use-messageThunk.md`,概述 `messageThunk.ts` 的核心功能和主要 Thunks 的使用。 - 新增 `how-to-use-useMessageOperations.md`,提供 `useMessageOperations` Hook 的使用示例和功能说明,简化组件与消息数据的交互。 |
||
|
|
a6822d4037
|
refactor: message block structure (#4660)
* feat(message-blocks): introduce new message block types and middleware for handling message updates - Added new types for message blocks including MainText, Thinking, Translation, Code, Image, ToolCall, ToolResult, KnowledgeCitation, WebSearch, File, and Error blocks. - Implemented middleware to manage message block mapping and updates in Redux, enhancing the handling of message states and blocks. - Introduced LRU caching for efficient message block retrieval and management. * feat(messages): implement message management slice and utility functions - Introduced a new Redux slice for managing messages, including actions for setting the current topic, loading state, error handling, and message updates. - Added utility functions for creating various message block types, enhancing the structure and management of message content. - Updated message type definitions to include timestamped block references, improving the tracking of message block states. * feat(store): add messageBlocks reducer and integrate into rootReducer - Introduced a new messageBlocks reducer to manage message block state. - Updated rootReducer to include messageBlocks alongside existing reducers. - Refactored newMessage slice to accommodate changes in message structure and block handling. - Removed obsolete messageBlockMap utility file to streamline codebase. * feat(database): implement version 7 migration and enhance message structure - Added new message_blocks table to the database schema for improved message handling. - Introduced upgradeToV7 function to migrate existing topics and messages to the new structure. - Refactored message creation utilities to support new message block types and improved error handling. - Implemented various message filtering utilities to streamline message processing. - Updated Redux store to accommodate new message structure and loading states. * feat(message): refactor message handling and introduce messageStreamProcessor - Updated database schema to correct types for topics and message blocks. - Introduced messageStreamProcessor to handle API responses and transform them into application-specific data structures. - Refactored messageThunk to streamline message creation and updates, ensuring consistency with the new message structure. - Enhanced error handling and state management during message processing. * refactor(message): update message handling with new types and utility functions - Refactored message operations to utilize new message types and improved utility functions for content retrieval. - Introduced helper functions for finding message blocks, enhancing the structure and readability of message processing. - Updated various providers to align with the new message structure, ensuring consistent handling of message content and blocks. - Enhanced error handling and state management during message processing, improving overall reliability. * refactor(message): wip create XxxBlock components - Refactored message handling to utilize new message types, enhancing the overall structure and readability. - Introduced new message blocks including CitationBlock, CodeBlock, ErrorBlock, FileBlock, ImageBlock, ThinkingBlock, ToolBlock, and TranslationBlock. - Updated existing components to align with the new message structure, ensuring consistent handling of message content and blocks. - Improved utility functions for finding and processing message blocks, enhancing the reliability of message operations. * refactor(message): enhance message operations with new selectors and blocks - Updated useMessageOperations to integrate new message block types and selectors for improved state management. - Introduced new selectors for fetching topic messages and loading states, enhancing the efficiency of message retrieval. - Refactored message handling in Inputbar and MessageContent components to align with the new message structure. - Added CitationBlock and improved rendering logic for message blocks, ensuring consistent display of message content. - Enhanced error handling and logging for message operations, improving overall reliability. * refactor(message): enhance message update logic with block instructions - Updated the updateMessage reducer to handle block instructions, allowing for more flexible message updates. - Improved the fetchAndProcessAssistantResponseImpl function to track the last added block, ensuring proper handling of streaming content. - Refactored stream processing to accommodate new callback signatures and improve error handling. - Removed unused console logs and cleaned up code for better readability and maintainability. * merge origin/main * refactor(message): update message handling and block structure - Replaced `prepareTopicMessages` with `loadTopicMessagesThunk` for improved message loading logic. - Updated `MessageTools` to accept `ToolBlock` instead of `Message`, enhancing type safety. - Introduced `resetMessage` utility to streamline message object creation and reset mutable fields. - Refactored `findCitationBlocks` and related types for consistency in message block handling. - Enhanced error handling in message update logic to ensure robustness during database operations. * refactor(message): update message and block handling for improved clarity and performance - Refactored message handling by removing unnecessary cloning of messages in `MessageContent`. - Updated `Inputbar` to import `Message` from the new message types module. - Simplified block rendering logic in `MessageBlockRenderer` by removing redundant checks. - Adjusted `StreamProcessingService` to use the updated import path for `GroundingMetadata`. - Enhanced message status handling in `newMessage` to include 'streaming' status. - Removed deprecated `createUserMessageThunk` to streamline thunk actions. - Updated type definitions in `newMessageTypes` for better clarity and consistency. * refactor(message): enhance message block structure and type handling - Updated `Markdown` component to utilize `MainTextMessageBlock` for improved type safety. - Refactored `MessageContent` to remove error handling logic and streamline rendering. - Adjusted `MessageError` to accept `ErrorMessageBlock` and simplified error display logic. - Enhanced `MessageTools` to work with `ToolMessageBlock`, improving clarity in tool response handling. - Updated `MainTextBlock` to pass the correct props to `Markdown`, ensuring consistent rendering. - Refactored utility functions to align with new message block types, enhancing overall code clarity and maintainability. * refactor: update message types import paths and enhance message handling logic - Changed import paths for message types from 'newMessageTypes' to 'newMessage' across multiple files. - Refactored message handling functions to utilize the new message structure, ensuring compatibility with the updated types. - Improved logic for finding and processing main text blocks in messages. - Updated related components and hooks to reflect the new message structure, enhancing overall code maintainability. * refactor: improve stream processing and message handling logic - Updated the `createStreamProcessor` function to handle null and undefined chunks more robustly. - Introduced a helper function `handleBlockTransition` to streamline state transitions between message blocks. - Enhanced error handling in the `onComplete` function to specifically manage abort errors and create error blocks when necessary. - Improved final block status updates to ensure accurate tracking of message processing states. * refactor: use rehype-sanitize for html tags # Conflicts: # src/renderer/src/pages/home/Markdown/Markdown.tsx * refactor: merge rehype plugins * refactor(ModelList): extract NameSpan component and adjust styling for better layout * feat: update Z.ai app configuration with additional styling and increment store version to 97 # Conflicts: # src/renderer/src/store/index.ts * feat(FeatureMenus, Footer): replace Ant Design icons with Lucide icons and enhance layout - Updated icons in FeatureMenus from Ant Design to Lucide for improved visual consistency. - Refactored Footer component to use Lucide icons and adjusted layout for better alignment and spacing. - Enhanced styling of Tag components for a more cohesive design. * lint: fix code format * chore(version): 1.2.5 * feat(locales): add locale cleanup functionality to after-pack script - Introduced a new `remove-locales.js` script to handle the removal of unnecessary locale files based on the platform. - Integrated the locale cleanup process into the `after-pack.js` script to ensure locales are managed during packaging. * feat: support escaping the comma character in the API key. (#5088) feat: support escaping the comma character in the API key. * feat(Citations): enhance CitationsList with title and info icon, and update styling * Revert "feat: add chat message translate copy button (#4620)" This reverts commit |
||
|
|
2807e71f1a | docs: contributor guide | ||
|
|
a5f8ac8587
|
feat: add English contributor guide and update issue templates (#5300)
- Introduced a new English version of the contributor guide (CONTRIBUTING_EN.md) to enhance accessibility for non-Chinese speakers. - Updated issue templates to use more specific labels (kind/bug, kind/enhancement, kind/question) for better categorization. - Added a testing section in the developer guide to clarify testing procedures. |
||
|
|
3bdf0be4ad | update(README): replace outdated screenshots in English, Japanese, and Chinese documentation |