Commit Graph

5155 Commits

Author SHA1 Message Date
Copilot
82628edbd2
refactor: use TypeScript function overloading for uploadNotes type safety (#11833)
* Initial plan

* refactor: use TypeScript function overloading for uploadNotes

Co-authored-by: DeJeune <67425183+DeJeune@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: DeJeune <67425183+DeJeune@users.noreply.github.com>
2025-12-11 12:59:50 +08:00
suyao
377614713b
fix: format 2025-12-08 01:04:40 +08:00
suyao
bcf1fa90ed
fix: update file upload handling and remove unused root selection 2025-12-08 00:32:43 +08:00
suyao
2863961349
fix: address PR review feedback
- Translate Chinese comments to English in useInPlaceEdit.ts
- Add guard in handleBlur to prevent double save when isSaving is true
- Update comment to clarify "prevent N refresh events" -> "prevent multiple refresh events"
- Add better error handling when all files fail to get system paths in uploadNotes

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

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2025-12-07 21:27:59 +08:00
SuYao
f4f8e844ce
Apply suggestion from @Copilot
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-12-07 21:13:21 +08:00
suyao
f337ad3a4d
fix: merge 2025-12-07 21:11:19 +08:00
suyao
d25a6c4e0f
Merge remote-tracking branch 'origin/main' into copilot/fix-unresponsive-application 2025-12-07 21:10:58 +08:00
Phantom
516b8479d6
style: update gemini logo images (#11731)
* style: update gemini logo images and fix model logo condition

Update the Gemini logo images in both apps and models directories
Remove or fix the always-true isLight condition in getModelLogoById

* style: downsample gemini icon

* style(minapp): Add bordered property for gemini minapp

Add FIXME comment to indicate 'bodered' should be 'bordered' and update config to use correct property
2025-12-07 21:04:40 +08:00
chenxue
b58a2fce03
feat(aihubmix): fix website domain (#11734)
fix domain
2025-12-07 21:03:19 +08:00
suyao
d4e331adc4
chore 2025-12-07 20:55:44 +08:00
suyao
9cd5b2be95
feat: Add upload progress tracking and improve file upload handling
- Implemented upload progress listener in NotesPage to track file upload status.
- Enhanced file upload functionality in useNotesFileUpload to support both file and folder uploads.
- Updated NotesService to handle recursive uploads with preserved file paths.
- Added new translations for upload-related messages in Japanese, Portuguese, and Russian.
- Improved UI in NotesPage and NotesSidebar to display upload progress and enhance user experience.
- Refactored file selection methods to utilize Electron's native dialog for better UX.
- Adjusted styling in HeaderNavbar and NotesSidebar for improved aesthetics.
2025-12-07 20:53:46 +08:00
beyondkmp
ebfc60b039
fix(windows): improve Git Bash detection for portable installations (#11671)
* fix(windows): improve Git Bash detection for portable installations

Enhance Git Bash detection on Windows to support portable Git installations
and custom installation paths. The previous implementation only checked fixed
paths and failed to detect Git when installed to custom locations or added
to PATH manually.

Key improvements:
- Use where.exe to find git.exe in PATH and derive bash.exe location
- Support CHERRY_STUDIO_GIT_BASH_PATH environment variable override
- Add security check to skip executables in current directory
- Implement three-tier fallback strategy (env var -> git derivation -> common paths)
- Add detailed logging for troubleshooting

This fixes the issue where users with portable Git installations could run
git.exe from command line but the app failed to detect Git Bash.

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

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

* fix(windows): improve Git Bash detection for portable installations

Enhance Git Bash detection on Windows to support portable Git installations
and custom installation paths. The previous implementation only checked fixed
paths and failed to detect Git when installed to custom locations or added
to PATH manually.

Key improvements:
- Move findExecutable and findGitBash to utils/process.ts for better code organization
- Use where.exe to find git.exe in PATH and derive bash.exe location
- Add security check to skip executables in current directory
- Implement two-tier fallback strategy (git derivation -> common paths)
- Add detailed logging for troubleshooting
- Remove environment variable override to simplify implementation

This fixes the issue where users with portable Git installations could run
git.exe from command line but the app failed to detect Git Bash.

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

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

* fix(windows): improve Git Bash detection for portable installations

Enhance Git Bash detection on Windows to support portable Git installations
and custom installation paths. The previous implementation only checked fixed
paths and failed to detect Git when installed to custom locations or added
to PATH manually.

Key improvements:
- Move findExecutable and findGitBash to utils/process.ts for better code organization
- Use where.exe to find git.exe in PATH and derive bash.exe location
- Add security check to skip executables in current directory
- Implement two-tier fallback strategy (git derivation -> common paths)
- Add detailed logging for troubleshooting
- Remove environment variable override to simplify implementation

This fixes the issue where users with portable Git installations could run
git.exe from command line but the app failed to detect Git Bash.

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

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

* update iswin

* test: add comprehensive test coverage for findExecutable and findGitBash

Add 33 test cases covering:
- Git found in common paths (Program Files, Program Files (x86))
- Git found via where.exe in PATH
- Windows/Unix line ending handling (CRLF/LF)
- Whitespace trimming from where.exe output
- Security checks to skip executables in current directory
- Multiple Git installation structures (Standard, Portable, MSYS2)
- Bash.exe path derivation from git.exe location
- Common paths fallback when git.exe not found
- LOCALAPPDATA environment variable handling
- Priority order (derivation over common paths)
- Error scenarios (Git not installed, bash.exe missing)
- Real-world scenarios (official installer, portable, Scoop)

All tests pass with proper mocking of fs, path, and child_process modules.

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

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

* refactor: clarify path navigation comments in findGitBash

Replace confusing arrow notation showing intermediate directories with
clearer descriptions of the navigation intent:
- "navigate up 2 levels" instead of showing "-> Git/cmd -> Git ->"
- "bash.exe in same directory" for portable installations
- Emphasizes the intent rather than the intermediate steps

Makes the code more maintainable by clearly stating what each path
pattern is checking for.

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

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

* test: skip process utility tests on non-Windows platforms

Use describe.skipIf to skip all tests when not on Windows since
findExecutable and findGitBash have platform guards that return null
on non-Windows systems. Remove redundant platform mocking in nested
describe blocks since the entire suite is already Windows-only.

This fixes test failures on macOS and Linux where all 33 tests were
failing because the functions correctly return null on those platforms.

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

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

* format

* fix: improve Git Bash detection error handling and logging

- Add try-catch wrapper in IPC handler to handle unexpected errors
- Fix inaccurate comment: usr/bin/bash.exe is for MSYS2, not Git 2.x
- Change log level from INFO to DEBUG for internal "not found" message
- Keep WARN level only in IPC handler for user-facing message

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

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

---------

Co-authored-by: Claude <noreply@anthropic.com>
2025-12-07 16:42:00 +08:00
Phantom
8f39ecf762
fix(models): update assistant default model when editing model capabilities (#11732)
* fix(ProviderSettings): update assistant default model when model changes

Ensure assistant's default model is updated when the underlying model is modified to maintain consistency

* refactor(EditModelPopup): simplify assistant model update logic

Replace manual model updates with a single map operation to update both model and defaultModel fields. This makes the code more concise and easier to maintain.

* refactor(EditModelPopup): remove unused dispatch import and variable

* feat(EditModelPopup): add support for translate and quick model updates

Update the EditModelPopup component to handle updates for translate and quick models in addition to the default model. This ensures consistency across all model types when changes are made.
2025-12-07 14:01:11 +08:00
Copilot
8d1d09b1ec
fix: eliminate UI freeze on multi-file selection via batch processing (#11377)
* Initial plan

* fix: improve file upload performance with batch processing and progress feedback

- Add batch processing (5 files concurrently) to uploadNotes function
- Use Promise.allSettled for parallel file processing
- Add setTimeout(0) between batches to yield to event loop
- Show loading toast when uploading more than 5 files
- Add translation keys for uploading progress (en, zh-cn, zh-tw)

Co-authored-by: DeJeune <67425183+DeJeune@users.noreply.github.com>

* feat: add batch upload and file watcher control functionalities

* feat: add hint node type and implement TreeNode component for notes

- Updated NotesTreeNode type to include 'hint' as a node type.
- Implemented TreeNode component to handle rendering of notes and folders, including hint nodes.
- Added drag-and-drop functionality for organizing notes.
- Created context hooks for managing notes actions, selection, editing, drag-and-drop, search, and UI state.
- Developed file upload handling for drag-and-drop and file selection.
- Enhanced menu options for notes with actions like create, rename, delete, and export.
- Integrated auto-renaming feature for notes based on content.

* clean comment

* feat: add pause and resume functionality to file watcher; enhance error handling in useInPlaceEdit hook

* fix: adjust padding in item container style for improved layout

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: DeJeune <67425183+DeJeune@users.noreply.github.com>
Co-authored-by: suyao <sy20010504@gmail.com>
2025-12-07 11:44:57 +08:00
Phantom
3cedb95db3
fix(stream-options): add user-configurable stream options for OpenAI API (#11693)
Some checks failed
Auto I18N Weekly / Auto I18N (push) Has been cancelled
* refactor(types): rename OpenAISummaryText to OpenAIReasoningSummary for clarity

* refactor: move OpenAISettingsGroup to independent folder

* refactor(OpenAISettingsGroup): extract settings components into separate files

Move ReasoningSummarySetting, ServiceTierSetting and VerbositySetting into individual components to improve code organization and maintainability

* feat(stream-options): add stream options configuration for OpenAI completions

add includeUsage option to control token usage reporting in streamed responses
update provider config and settings UI to support new stream options
add migration for existing providers to set default stream options
extend toOptionValue utility to handle boolean values

* refactor(stream-options): move stream options includeUsage to settings store

- Remove streamOptions from Provider type and move includeUsage to settings.openAI
- Update migration to initialize streamOptions in settings
- Modify providerToAiSdkConfig to read includeUsage from settings
- Update StreamOptionsSetting component to use settings store

* feat(i18n): add missing translations for 'on' and stream options

Add translations for the 'on' state and stream options including token usage in multiple languages

* docs(select): update docs

* test(providerConfig): add tests for stream options includeUsage

add test cases to verify includeUsage stream option behavior for OpenAI provider

* Update src/renderer/src/i18n/translate/ru-ru.json

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Update src/renderer/src/pages/home/Tabs/components/OpenAISettingsGroup/VerbositySetting.tsx

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Update src/renderer/src/utils/select.ts

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* test(select): add tests for toOptionValue and toRealValue functions

* fix(providerConfig): handle undefined streamOptions in openAI settings

Prevent potential runtime errors by safely accessing nested streamOptions properties

* test(providerConfig): add tests for Copilot provider includeUsage settings

* fix(OpenAISettingsGroup): handle potential undefined streamOptions in selector

* docs(aiCoreTypes): add comment for OpenAICompletionsStreamOptions

* refactor(select): improve type safety in toOptionValue function

Use Exclude to prevent string literals from overlapping with special values

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-12-05 19:52:37 +08:00
SuYao
9d6d827f88
fix(migrate): normalize provider type for AI gateway (#11703) 2025-12-05 17:42:44 +08:00
Copilot
968210faa7
fix: correct OVMS API URL path formation (#11701)
* Initial plan

* fix: correct OVMS API URL path from '../v1/config' to 'config'

Co-authored-by: DeJeune <67425183+DeJeune@users.noreply.github.com>

* fix: update OVMSClient to use formatted API URL for model listing

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: DeJeune <67425183+DeJeune@users.noreply.github.com>
Co-authored-by: suyao <sy20010504@gmail.com>
2025-12-05 17:40:29 +08:00
suyao
4e3026199c
Merge remote-tracking branch 'origin/main' into copilot/fix-unresponsive-application 2025-12-05 17:40:05 +08:00
suyao
fa9e34c563
fix: adjust padding in item container style for improved layout 2025-12-05 17:21:44 +08:00
Phantom
ea36b918f1
feat(translate): support document files and refactor file reading logic (#11615)
* refactor(FileStorage): extract file reading logic into reusable method

Move common file reading functionality from readFile and readExternalFile into a new private readFileCore method
Improve error logging by distinguishing between document and text file failures
Add comprehensive JSDoc documentation for all file reading methods

* feat(translate): support document files and increase size limit

Add support for document file types in translation file selection. Increase maximum file size limit to 20MB for documents while keeping text files at 5MB. Implement separate handling for document and text file reading.
2025-12-05 13:56:54 +08:00
SuYao
92bb05950d
fix: enhance provider handling and API key rotation logic in AiProvider (#11586)
* fix: enhance provider handling and API key rotation logic in AiProvider

* fix

* fix(api): enhance API key handling and logging for providers
2025-12-05 13:25:54 +08:00
Phantom
a566cd65f4
fix: normalize provider model data (#11580)
* fix: normalize provider model data

* fix(tests): correct provider type in ModelAdapter test
2025-12-05 00:29:38 +08:00
Phantom
cd699825ed
feat(settings): add Slovak language support for spell check (#11664)
* refactor(settings): move spell check languages to constants and add type

Add Slovak language option and define SpellCheckOption type for better type safety

* fix(settings): disable spell check selector on Mac platforms

The spell check selector should not be shown on Mac platforms as it's not supported. This change adds a platform check to hide the selector when running on macOS.
2025-12-04 23:55:33 +08:00
Phantom
86a16f5762
fix(prompts): clarify language detection rules for edge cases (#11696)
* fix(prompts): clarify language detection rules for edge cases

Update LANG_DETECT_PROMPT to explicitly handle cases where the input text describes a language but is written in a different language. Add examples to illustrate the expected behavior.

* fix(prompts): correct language code mapping for Chinese input

Update the language detection prompt to properly map '英语' to 'zh-cn' instead of 'en-us' since it's a Chinese word
2025-12-04 22:55:31 +08:00
Peijie Diao
6343628739
fix(topic): clear related message_blocks when clearing topic messages (#11665)
Ensure message_blocks rows are removed when clearing a topic's messages to avoid orphaned block entries.

Signed-off-by: Do1e <i@do1e.cn>
2025-12-04 22:32:37 +08:00
Copilot
a2a6c62f48
Fix custom parameters placement for Vercel AI Gateway (#11605)
* Initial plan

* Fix custom parameters placement for Vercel AI Gateway

For AI Gateway provider, custom parameters are now placed at the body level
instead of being nested inside providerOptions.gateway. This fixes the issue
where parameters like 'tools' were being incorrectly added to
providerOptions.gateway when they should be at the same level as providerOptions.

Fixes #4197

Co-authored-by: DeJeune <67425183+DeJeune@users.noreply.github.com>

* Revert "Fix custom parameters placement for Vercel AI Gateway"

This reverts commit b14e48dd78.

* fix: rename 'ai-gateway' to 'gateway' across the codebase and update related configurations

* fix: resolve PR review issues for custom parameters field

- Fix Migration 174: use string literal 'ai-gateway' instead of non-existent constant for historical compatibility
- Fix Migration 180: update model.provider references to prevent orphaned models when renaming provider ID
- Add logging in mapVertexAIGatewayModelToProviderId when unknown model type is encountered
- Replace `any` with `Record<string, unknown>` in buildAIGatewayOptions return type for better type safety
- Add gateway mapping to getAiSdkProviderId mock in options.test.ts to match production behavior

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

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

* chore: version

* fix(options): enhance custom parameters handling for proxy providers

* fix(options): add support for cherryin provider with custom parameters handling

* chore

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: DeJeune <67425183+DeJeune@users.noreply.github.com>
Co-authored-by: suyao <sy20010504@gmail.com>
Co-authored-by: Claude <noreply@anthropic.com>
2025-12-04 21:19:30 +08:00
SuYao
981bb9f451
fix: update deepseek logic to match deepseek v3.2 (#11648)
* fix: update deepseek dependency to version 1.0.31 and improve provider creation logging

* chore

* feat: deepseek official hybrid infer

* fix: deepseek-v3.2-speciale tooluse and reasoning

* fix: 添加固定推理模型支持并更新相关逻辑

* refactor: simplify logic

* feat: aihubmix

* all system_providers

* feat: cherryin

* temp fix

* fix: address PR review feedback for DeepSeek v3.2 implementation

- Add default case in buildCherryInProviderOptions to fallback to genericProviderOptions
- Add clarifying comment for switch fall-through in reasoning.ts
- Add comprehensive test coverage for isFixedReasoningModel (negative cases)
- Add test coverage for new provider whitelist (deepseek, cherryin, new-api, aihubmix, sophnet, dmxapi)
- Add test coverage for isDeepSeekHybridInferenceModel prefix patterns
- Verify function calling logic works correctly via regex matching after removing provider-based checks
- Use includes() for deepseek-chat matching to support potential variants

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

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

* fix: remove unnecessary fall-through case for unknown providers in getReasoningEffort

---------

Co-authored-by: Claude <noreply@anthropic.com>
2025-12-04 19:13:51 +08:00
fullex
9637fb8a43
fix(a11y): improve screen reader (NVDA) support with aria-label attributes (#11678)
* fix(a11y): improve screen reader support with aria-label attributes

Add aria-label attributes to all interactive buttons and toolbar elements
to improve accessibility for screen reader users (NVDA, etc.).

Changes:
- Add aria-label with i18n translations to all ActionIconButton components
- Add role="button", tabIndex, and keyboard handlers for non-semantic elements
- Fix hardcoded English aria-labels in WindowControls to use i18n
- Add aria-pressed for toggle buttons to indicate state
- Add aria-expanded for expandable menus
- Add aria-disabled for disabled buttons

Components updated:
- SendMessageButton, CopyButton, SelectionToolbar
- CodeToolbar, RichEditor toolbar, MinimalToolbar
- WindowControls
- 12 Inputbar tool buttons (WebSearch, Attachment, KnowledgeBase, etc.)

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

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

* fix(a11y): enhance accessibility in CodeToolbar snapshot

Added aria-label, role, and tabindex attributes to improve screen reader support for interactive elements in the CodeToolbar component. This change aligns with ongoing efforts to enhance accessibility across the application.

---------

Co-authored-by: Claude <noreply@anthropic.com>
2025-12-04 14:46:37 +08:00
KazooTTT
fb20173194
fix(inputbar): block enter send while generating (#11672)
* fix(inputbar): block enter send while generating

  - reuse unified send disable state for keyboard and button
  - prevent enter sending when loading or searching

* refactor: optimize InputbarCore component's useHotkeys hook

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* refactor(InputbarCore): rename cannotSend to noContent for clarity

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-12-04 14:44:52 +08:00
dependabot[bot]
387e8f77f5
ci(deps): bump peter-evans/repository-dispatch from 3 to 4 (#11594)
Bumps [peter-evans/repository-dispatch](https://github.com/peter-evans/repository-dispatch) from 3 to 4.
- [Release notes](https://github.com/peter-evans/repository-dispatch/releases)
- [Commits](https://github.com/peter-evans/repository-dispatch/compare/v3...v4)

---
updated-dependencies:
- dependency-name: peter-evans/repository-dispatch
  dependency-version: '4'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-12-04 13:30:21 +08:00
beyondkmp
4f701d3e45
fix(apiServer): use 127.0.0.1 instead of localhost for better compatibility (#11673)
* fix(apiServer): use 127.0.0.1 instead of localhost for better compatibility

- Change default host from localhost to 127.0.0.1 in config and settings
- Add buildApiServerUrl helper to properly construct API server URLs
- Update OpenAPI documentation server URL
- Update test files to use 127.0.0.1

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

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

* fix(migration): migrate existing localhost config to 127.0.0.1

- Add migration 180 to automatically update localhost to 127.0.0.1
- Handle both plain host and hosts with http/https protocol
- Increment store version to 180

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

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

* refactor(apiServer): simplify buildApiServerUrl implementation

- Remove complex URL parsing and protocol handling
- Use simple string concatenation for URL building
- Assume http protocol since API server is local

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

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

* refactor: remove buildApiServerUrl helper and simplify migration

- Remove buildApiServerUrl helper function
- Use 127.0.0.1 directly in URL construction
- Simplify migration 180 to unconditionally set host to 127.0.0.1

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

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

* refactor(apiServer): fix critical bugs and improve code structure

🔴 Critical Fixes:
- Fix config.ts to use stored host value instead of ignoring it
- Fix hardcoded 127.0.0.1 URLs to use apiServerConfig.host

🟡 Improvements:
- Extract API_SERVER_DEFAULTS to shared constants in packages/shared/config/constant.ts
- Apply consistent fallback pattern using API_SERVER_DEFAULTS.HOST and API_SERVER_DEFAULTS.PORT
- Update all imports to use shared constants across main and renderer processes

Files changed:
- packages/shared/config/constant.ts: Add API_SERVER_DEFAULTS constants
- src/main/apiServer/config.ts: Use stored host with fallback
- src/main/apiServer/middleware/openapi.ts: Use constants
- src/renderer/src/pages/settings/ToolSettings/ApiServerSettings/ApiServerSettings.tsx: Use config host and constants
- src/renderer/src/store/settings.ts: Use constants in initial state
- src/renderer/src/store/migrate.ts: Use constants in migration

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

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

* update

* fix(apiServer): use relative URL in OpenAPI spec for better compatibility

- Change server URL from hardcoded defaults to relative path '/'
- This ensures Swagger UI "Try it out" works correctly regardless of configured host/port
- Remove unused API_SERVER_DEFAULTS import

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

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

---------

Co-authored-by: Claude <noreply@anthropic.com>
2025-12-04 10:57:42 +08:00
Phantom
aeabc28451
chore(feishu-notify): modify notification card (#11656)
refactor(feishu-notify): simplify issue card layout by removing redundant elements

Remove unnecessary div elements and consolidate title display into the card header
2025-12-03 22:32:18 +08:00
槑囿脑袋
f571dd7af0
fix: ollama url (#11611)
* fix: ollama url

* feat: add Ollama provider integration and update dependencies

* fix: update Ollama provider handling and API host formatting

* feat: support Ollama Cloud

* test: formatOllamaApiHost

* chore

* fix: update Ollama provider check to use isOllamaProvider function

* fix: address PR review issues for Ollama provider

Critical fixes:
- Fix regex escape bug: /\v1$/ → /\/v1$/ in OpenAIBaseClient.ts
- Add comprehensive error handling for Ollama fetch API (network errors, non-200 responses, invalid JSON)

Minor improvements:
- Fix inconsistent optional chaining in formatOllamaApiHost
- Add null check in migration 180 for undefined state.llm.providers

All checks passed: lint, typecheck, tests (2313 tests)

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

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

---------

Co-authored-by: suyao <sy20010504@gmail.com>
Co-authored-by: Claude <noreply@anthropic.com>
2025-12-03 21:03:07 +08:00
SuYao
33457686ac
fix: update Inputbar components to support dynamic textarea height adjustment (#11587)
* fix: update Inputbar components to support dynamic textarea height adjustment

* fix: align drag handler maxHeight with hook configuration (500px)

- Update hardcoded maxHeight from 400 to 500 in InputbarCore drag handler
- This ensures consistency with useTextareaResize hook maxHeight parameter
- Resolves PR comment about maxHeight inconsistency between hook and drag handler

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

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

---------

Co-authored-by: Claude <noreply@anthropic.com>
2025-12-03 20:54:06 +08:00
Phantom
6696bcacb8
fix(settings): fix wrong type caused by as assertion in OpenAI settings (#11631)
* fix(settings): fix wrong type caused by as assertion and migration

Add migration step 180 to properly handle 'undefined' string values in OpenAI settings
Update selector components to use value conversion helpers for summaryText and verbosity

* feat(models): add null as supported verbosity level for OpenAI models

Update model utils and types to include null as a valid verbosity level option alongside undefined. This provides more flexibility in controlling verbosity behavior, with null representing an explicit "off" state. Tests and UI components are updated to reflect this change.

* fix(verbosity): fix wrong verbosity type definition and handling in #11281

* style: format

* fix(store): correct verbosity check in migration config

The condition was incorrectly checking for 'undefined' string instead of undefined value, and was assigning to summaryText instead of verbosity. This fixes the migration logic to properly handle the verbosity setting.

* docs(aiCore): improve comments for verbosity and summary types

Update type comments to better explain the behavior of verbosity and summary parameters in OpenAI API requests
2025-12-03 18:20:55 +08:00
Phantom
a1e95b55f8
fix: remove stale anthropic-beta header for oauth (#11600)
Fixes: [Bug]: Error when using claude-neptune-v3
Fixes #11597
2025-12-03 17:20:12 +08:00
Peijie Diao
600199dfcf
fix: topic name remains after deleting last topic (#11649)
* fix: topic name remains after deleting last topic

- Fix logic error when deleting the last topic
- Only clear messages in the last topic before the commit
- Now creates new topic before deleting the original one to ensure proper topic name update

Signed-off-by: Do1e <i@do1e.cn>

* fix(topic): integrate the same code in `handleConfirmDelete`

Signed-off-by: Do1e <i@do1e.cn>

---------

Signed-off-by: Do1e <i@do1e.cn>
2025-12-03 16:59:46 +08:00
suyao
f8428df247
feat: add pause and resume functionality to file watcher; enhance error handling in useInPlaceEdit hook 2025-12-03 16:53:27 +08:00
Zhaokun
77fd90ef7d
fix: Selected area in code block changes after scrolling (#11469)
* fix: improve code block copy in collapsed state with virtual scroll

- Add saveSelection mechanism to track selection across virtual scroll updates
- Implement custom copy handler to extract complete content from raw data
- Auto-expand code block when multi-line selection is detected in collapsed state
- Only enable auto-expand when codeCollapsible setting is enabled
- Add comprehensive logging for debugging selection and copy issues

Fixes issue where copying code in collapsed state would lose content from
virtualized rows that are not rendered in DOM. The solution captures
selection position (line + offset) during scroll and uses it to extract
complete content from the original source when copying.

* fix(CodeViewer): scope selection and copy to viewer container to prevent multiple blocks appearing selected\n\n- Add selectionBelongsToViewer() to ensure selection anchors are within this viewer\n- Guard saveSelection, copy handler, and selectionchange auto-expand logic\n- Avoids cross-viewer selection bleed when multiple CodeViewer instances exist on a page\n\nFollow-up to 37c2b5ecb (virtual scroll selection/copy).

* fix(CodeViewer): clear saved selection when active selection belongs to another viewer\n\n- Early-return in selectionchange handler when selection is outside this viewer\n- Complements scoping guards to avoid misleading multi-selection states

* fix(CodeViewer): change logger info to debug for selection and copy events

- Adjust logging level from info to debug for various selection and copy operations to reduce log verbosity.
- Ensure selection belongs to the current viewer before processing.

* fix(CodeViewer): remove invisible character from import statement

* fix(CodeViewer): complete useCallback deps to avoid stale closure

- saveSelection deps -> [selectionBelongsToViewer]
- handleCopy deps -> [selectionBelongsToViewer, expanded, saveSelection, rawLines]
- no behavior change; satisfy exhaustive-deps; reduce risk of stale refs

* fix(CodeViewer): improve selection handling for virtual scrolling and enhance comments

* fix(CodeViewer): handle clipboardData unavailability and remove unused ref

- Add null check for event.clipboardData to prevent silent copy failure
- When clipboardData is unavailable, fall back to browser default copy behavior
- Remove unused isRestoringSelectionRef and its dead code check
- Improve copy reliability in edge cases where clipboard API may be unavailable
2025-12-03 16:14:37 +08:00
SuYao
fb45d94efb
Fix/input schema (#11635)
* fix: update @modelcontextprotocol/sdk to v1.23.0 and enhance MCP tool schemas

* fix: add dotenv type definitions and implement parseKeyValueString utility with tests
2025-12-02 16:03:31 +08:00
f14XuanLv
3aedf6f138
fix: avoid sending empty anthropic-beta header (#11619)
Signed-off-by: f14xuanlv <2606574933@qq.com>
2025-12-02 12:53:09 +08:00
Phantom
3e6dc56196
fix(api): add withoutTrailingSharp utility and fix # handling in formatApiHost (#11604)
* docs(providerConfig): improve jsdoc for formatProviderApiHost function

* refactor(aiCore): improve provider handling with adaptProvider function

Introduce adaptProvider to centralize provider transformations and replace direct usage of handleSpecialProviders and formatProviderApiHost. This improves maintainability and provides consistent behavior across all provider usage scenarios.

* refactor(ProviderSettings): simplify api host formatting logic by using adaptProvider

Replace multiple format functions with a single adaptProvider utility to centralize host formatting logic and improve maintainability

* feat(api): add withoutTrailingSharp utility and update formatApiHost

add utility function to remove trailing # from URLs and update formatApiHost to use it
add comprehensive tests for new functionality

* feat(ProviderSetting): add help tooltip for api url selector

Add HelpTooltip component next to host selector to provide additional guidance about API URL configuration
2025-12-01 16:27:33 +08:00
kangfenmao
b3a58ec321 chore: update release notes for v1.7.1 2025-11-30 19:57:44 +08:00
Phantom
0097ca80e2
docs: improve CLAUDE.md PR workflow guidelines (#11548)
docs: update CLAUDE.md with PR workflow details

Add critical section about Pull Request workflow requirements including reading the template, following all sections, never skipping, and proper formatting
2025-11-30 18:39:47 +08:00
Phantom
d968df4612
fix(ApiService): properly handle and throw stream errors in API check (#11577)
* fix(ApiService): handle stream errors properly in checkApi

Ensure stream errors are properly caught and thrown when checking API availability

* docs(types): add type safety comment for ResponseError

Add FIXME comment highlighting weak type safety in ResponseError type
2025-11-30 18:34:56 +08:00
Copilot
2bd680361a
fix: set CLAUDE_CONFIG_DIR to avoid path encoding issues on Windows with non-ASCII usernames (#11550)
* Initial plan

* fix: set CLAUDE_CONFIG_DIR to avoid path encoding issues on Windows with non-ASCII usernames

Co-authored-by: DeJeune <67425183+DeJeune@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: DeJeune <67425183+DeJeune@users.noreply.github.com>
2025-11-30 17:58:37 +08:00
SuYao
cc676d4bef
fix: improve BashTool command display and enhance ToolTitle layout (#11572)
* fix: improve BashTool command display and enhance ToolTitle layout

* style(ant.css): fix overflow in collapse header text

* fix(i18n): translate toolPendingFallback in multiple languages

---------

Co-authored-by: icarus <eurfelux@gmail.com>
2025-11-30 17:58:23 +08:00
Phantom
3b1155b538
fix: make knowledge base tool always visible regardless of sidebar settings (#11553)
* refactor(knowledgeBaseTool): remove unused sidebar icon visibility check

* refactor(Inputbar): remove unused knowledge icon visibility logic

Simplify knowledge base selection by directly using assistant.knowledge_bases
2025-11-30 17:51:17 +08:00
Phantom
03ff6e1ca6
fix: stabilize home scroll behavior (#11576)
* feat(dom): extend scrollIntoView with Chromium-specific options

Add ChromiumScrollIntoViewOptions interface to support additional scroll container options

* refactor(hooks): optimize timer and scroll position hooks

- Use useMemo for scrollKey in useScrollPosition to avoid unnecessary recalculations
- Refactor useTimer to use useCallback for all functions to prevent unnecessary recreations
- Reorganize function order and improve cleanup logic in useTimer

* fix: stabilize home scroll behavior

* Update src/renderer/src/pages/home/Messages/ChatNavigation.tsx

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* fix(utils/dom): add null check for element in scrollIntoView

Prevent potential runtime errors by gracefully handling falsy elements with a warning log

* fix(hooks): use ref for scroll key to avoid stale closure

* fix(useScrollPosition): add cleanup for scroll handler to prevent memory leaks

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-11-30 17:31:32 +08:00
Phantom
706fac898a
fix(i18n): clarify image-generation endpoint type as OpenAI-based (#11554)
* fix(i18n): remove image-generation translations and clarify endpoint type

Update English locale to specify OpenAI for image generation
Add comments to clarify image-generation endpoint type relationship

* fix(i18n): correct portuguese translations in pt-pt.json
2025-11-30 15:39:09 +08:00