47 Commits

Author SHA1 Message Date
robin
65c54e5ce5 chore(deps): bump @openrouter/ai-sdk-provider to ^2.10.0 (#16467)
Signed-off-by: Robinnnnn <12162433+Robinnnnn@users.noreply.github.com>
2026-06-29 16:51:14 +08:00
SuYao
611944599f refactor(deps): replace lodash with es-toolkit/compat and drop it (#16528)
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Signed-off-by: suyao <sy20010504@gmail.com>
2026-06-29 12:28:57 +08:00
SuYao
16ebe2443c feat(ai-provider): route provider HTTP through proxy-aware net.fetch (#16207)
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-authored-by: fullex <106392080+0xfullex@users.noreply.github.com>
Signed-off-by: suyao <sy20010504@gmail.com>
2026-06-21 18:11:47 +08:00
SuYao
22ffb62f62 feat(richeditor): native @tiptap/markdown AST on Tiptap 3.26.1 (#16118)
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-authored-by: fullex <106392080+0xfullex@users.noreply.github.com>
Signed-off-by: suyao <sy20010504@gmail.com>
2026-06-17 18:38:54 +08:00
槑囿脑袋
20035a83ff feat(knowledge): engine-portable per-base index store and retrieval cutover (#15973)
Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
Co-authored-by: fullex <106392080+0xfullex@users.noreply.github.com>
Signed-off-by: eeee0717 <chentao020717Work@outlook.com>
2026-06-15 19:43:10 +08:00
xianzuyang9-blip
cdeaf05af0 fix(ai-core): align package exports with tsdown output (#15830)
Co-authored-by: SuYao <sy20010504@gmail.com>
Co-authored-by: fullex <106392080+0xfullex@users.noreply.github.com>
2026-06-09 18:01:37 +08:00
槑囿脑袋
67554c5703 feat(ai-service): add rerank runtime support (#15542)
Co-authored-by: 亢奋猫 <kangfenmao@qq.com>
Co-authored-by: fullex <106392080+0xfullex@users.noreply.github.com>
Signed-off-by: eeee0717 <chentao020717Work@outlook.com>
2026-06-06 17:33:18 +08:00
SuYao
5706307451 refactor(ai-service): consolidate AI runtime to main process (#14911)
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-authored-by: fullex <106392080+0xfullex@users.noreply.github.com>
Signed-off-by: suyao <sy20010504@gmail.com>
2026-06-05 00:06:51 +08:00
亢奋猫
26508591f8 refactor(paintings): migrate to v2 data layer and UI (#15154)
Co-authored-by: jidan745le <420511176@qq.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: SuYao <sy20010504@gmail.com>
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-authored-by: fullex <106392080+0xfullex@users.noreply.github.com>
Signed-off-by: jidan745le <420511176@qq.com>
Signed-off-by: suyao <sy20010504@gmail.com>
2026-06-02 15:18:53 +08:00
fullex
84e1732d28 refactor(knowledge): migrate to JobManager (#15213) 2026-05-21 10:54:59 +08:00
fullex
16f120bdd3 Merge branch 'main' of github.com:CherryHQ/cherry-studio into v2 2026-05-08 00:27:46 -07:00
SuYao
1f867749b8 fix(anthropic): support Claude Opus 4.7 (#14349)
### What this PR does

Before this PR:
- Selecting Claude Opus 4.7 (`claude-opus-4-7`) in Cherry Studio could
not work:
- The model is not in the catalog, so users could only add it manually
as a custom model.
- With reasoning enabled, Cherry would send `effort: 'max'` (4.6
mapping) instead of the native `xhigh` that 4.7 supports, and
`thinking.display` would default to `omitted` — stripping reasoning text
from the response and breaking Cherry's thinking UI.
- Temperature and top_p were still sent when `reasoning_effort` was
`default` or `none`, which Opus 4.7 rejects with HTTP 400 regardless of
reasoning settings.
- `getMaxTokens` subtracted a thinking budget for 4.6 / 4.7 (both use
adaptive thinking and do not send `budgetTokens`), incorrectly shrinking
`max_tokens`.

After this PR:
- `claude-opus-4-7` is catalogued under the Anthropic provider with a
128K output-token limit, routed through the existing `claude46`
reasoning-effort type so it shares the `[low, medium, high, xhigh]`
option list.
- Opus 4.7 sends native `xhigh` to Anthropic (Opus 4.6 still sends
`max`). Bedrock continues to map `xhigh → 'max'` until
`@ai-sdk/amazon-bedrock` adds `xhigh`.
- Adaptive thinking defaults to `display: 'summarized'` on Opus 4.7, so
reasoning text continues to stream back for Cherry's UI.
- `temperature` and `top_p` are dropped unconditionally for Opus 4.7 in
`getTemperature` / `getTopP`.
- `getMaxTokens` skips the budget subtraction for both 4.6 and 4.7
(shared adaptive-thinking path).
- At the agent-session dispatch site, `effort: 'xhigh'` is mapped to
`'max'` and the `display` field is stripped before reaching the Claude
Agent SDK (whose types do not yet include them).

Fixes #

### Why we need it and why it was done in this way

The following tradeoffs were made:
- Opus 4.7 shares the `claude46` thinking model type (same effort
options) instead of introducing a new `claude47` enum member. This
avoids churn in `ThinkingModelType` / `MODEL_SUPPORTED_OPTIONS`, and the
provider-boundary mapping (xhigh → native on 4.7, xhigh → max on 4.6)
cleanly expresses the only real difference.
- `thinking.display` is defaulted to `'summarized'` so existing Cherry
behavior (reasoning text streamed to the UI) is preserved. The Anthropic
API default is `'omitted'`, which would silently remove reasoning
content.
- `getMaxTokens` fix for 4.6 is applied alongside 4.7 because the same
code path is touched. This is in scope for the hotfix — the 4.7 path
cannot work correctly without it.
- The agent-session call site performs a local narrowing (`xhigh →
'max'`, strip `display`) rather than extending `AgentEffort` /
`AgentThinkingConfig` schemas. This keeps the change small and
compatible with the currently installed `@anthropic-ai/claude-agent-sdk`
type shape.

The following alternatives were considered:
- Introducing a new `claude47` `ThinkingModelType` variant and dedicated
option lists. Rejected — the effort list is identical to 4.6; a new
variant would duplicate data without adding behavior.
- Wiring `taskBudget` support (the agentic-workflow token budget
introduced in the same Vercel AI SDK PR). Intentionally out of scope —
Cherry has no UI or call site that would supply one, and it is not a
hotfix-class concern.
- Extending `AgentEffortSchema` and `AgentThinkingConfigSchema`
end-to-end. Rejected — the Claude Agent SDK still types `effort` as
`'low' | 'medium' | 'high' | 'max'` and `ThinkingAdaptive` as `{ type:
'adaptive' }`, so the schema widening would have to be undone at the SDK
boundary anyway.

Links to places where the discussion took place:
https://github.com/vercel/ai/pull/14529

### Breaking changes

None. Existing Claude 4.6 and earlier Claude models are unchanged.

### Special notes for your reviewer

- Targeted at `main` as a hotfix per the code-freeze policy. The same
fix should probably land on `v2` as well after this merges, but that is
a separate PR.
- `@ai-sdk/anthropic` is bumped to `^3.0.71` (minimum version that
exposes the Opus 4.7 / `xhigh` / `display` / `taskBudget` types). The
lockfile resolves to `3.0.71`. No other `@ai-sdk/*` packages are
touched.
- Added tests:
- `src/renderer/src/config/models/__tests__/utils.test.ts` —
`isClaude47SeriesModel` detection across direct API / Bedrock / Vertex
formats.
- `src/renderer/src/config/models/__tests__/reasoning.test.ts` —
`findTokenLimit` returns 128K for 4.7, and `getThinkModelType` routes
4.7 to `claude46`.
- `src/renderer/src/aiCore/utils/__tests__/reasoning.test.ts` —
`getAnthropicReasoningParams` returns `{ thinking: { type: 'adaptive',
display: 'summarized' }, effort: 'xhigh' }` for Opus 4.7 + xhigh, and
the `display` field is present even when no effort is set.
-
`src/renderer/src/aiCore/prepareParams/__tests__/model-parameters.test.ts`
— `getTemperature` / `getTopP` return `undefined` for Opus 4.7
regardless of reasoning settings.
- `pnpm lint` and `pnpm test` pass locally (3488 passed | 72 skipped).
One pre-existing Shiki tokenizer test is flaky under full-suite ordering
but passes in isolation and on clean `main`; unrelated to this change.

### Checklist

This checklist is not enforcing, but it's a reminder of items that could
be relevant to every PR.
Approvers are expected to review this list.

- [x] PR: The PR description is expressive enough and will help future
contributors
- [x] Code: [Write code that humans can
understand](https://en.wikiquote.org/wiki/Martin_Fowler#code-for-humans)
and [Keep it simple](https://en.wikipedia.org/wiki/KISS_principle)
- [x] Refactor: You have [left the code cleaner than you found it (Boy
Scout
Rule)](https://learning.oreilly.com/library/view/97-things-every/9780596809515/ch08.html)
- [x] Upgrade: Impact of this change on upgrade flows was considered and
addressed if required
- [x] Documentation: A [user-guide update](https://docs.cherry-ai.com)
was considered and is present (link) or not required. Check this only
when the PR introduces or changes a user-facing feature or behavior.
- [x] Self-review: I have reviewed my own code (e.g., via
[`/gh-pr-review`](/.claude/skills/gh-pr-review/SKILL.md), `gh pr diff`,
or GitHub UI) before requesting review from others

### Release note

```release-note
Add support for Claude Opus 4.7 (`claude-opus-4-7`), including native `xhigh` reasoning effort, adaptive thinking with summarized display (so reasoning text continues to stream to the UI), and the new API requirement that `temperature` / `top_p` be omitted.
```

---------

Signed-off-by: suyao <sy20010504@gmail.com>
2026-05-07 13:27:56 +08:00
fullex
1afd70b372 Merge branch 'main' of github.com:CherryHQ/cherry-studio into v2 2026-05-03 00:11:34 -07:00
槑囿脑袋
434d4a938f refactor(knowledge-data): adjust knowledge v2 data and service (#14719)
Co-authored-by: fullex <0xfullex@gmail.com>
Co-authored-by: fullex <106392080+0xfullex@users.noreply.github.com>
2026-05-01 19:24:48 +08:00
SuYao
06f93a0d2f fix(deps): bump @ai-sdk/deepseek to 2.0.30 (#14718)
### What this PR does

Before this PR:

- `@ai-sdk/deepseek` was pinned to `2.0.29`, missing an upstream fix for
`deepseek-v4` reasoning content in multi-turn conversations.

After this PR:

- Bumps `@ai-sdk/deepseek` from `2.0.29` to `2.0.30` (latest stable).
- Renames the local patch file to `@ai-sdk__deepseek@2.0.30.patch` and
updates the `pnpm.patchedDependencies` key. The patch (which adds the
`reasoning_effort` option for `high`/`max`) re-applies cleanly because
the patched regions are unchanged in `2.0.30`.

Fixes #

### Why we need it and why it was done in this way

Upstream `2.0.30` ships a single fix from vercel/ai commit `0498012`:
`fix(provider/deepseek): preserve reasoning_content for deepseek-v4 in
multi-turn requests`. It threads the `modelId` into
`convertToDeepSeekChatMessages`, stops dropping `reasoning` blocks
before the last user message for `deepseek-v4`, and ensures
`reasoning_content` is at least `""` rather than `undefined` so the
field is preserved across turns. Keeping the local patch in sync with
upstream prevents drift and unblocks future DeepSeek model rollouts.

The following tradeoffs were made:

- Patch file content is byte-identical; only the filename and
`pnpm.patchedDependencies` key are updated. This avoids gratuitous diff
churn while keeping the patch addressable to the new version.

The following alternatives were considered:

- Wait for a larger DeepSeek change before bumping — rejected; the
upstream fix is small, isolated, and there is no reason to delay.
- Move to `3.0.0-beta.x` — rejected; betas track AI SDK v6 and are out
of scope for the `main` branch hotfix lane.

Links to places where the discussion took place: N/A

### Breaking changes

None. Public API surface, exported types, and the `reasoning_effort`
patch behavior are unchanged.

### Special notes for your reviewer

- Verified the patch applied to `2.0.30` in `node_modules` — both the
local addition (`reasoning_effort`) and the upstream fix
(`isDeepSeekV4`) are present after `pnpm install`.
- `pnpm build:check` passes locally (4199 tests, 0 errors).
- This change is restricted to `main` per the code-freeze policy and is
delivered from a `hotfix/*` branch with no refactoring.

### Checklist

- [x] PR: The PR description is expressive enough and will help future
contributors
- [x] Code: Write code that humans can understand and Keep it simple
- [x] Refactor: You have left the code cleaner than you found it (Boy
Scout Rule)
- [x] Upgrade: Impact of this change on upgrade flows was considered and
addressed if required
- [ ] Documentation: A user-guide update was considered and is present
(link) or not required. Check this only when the PR introduces or
changes a user-facing feature or behavior.
- [x] Self-review: I have reviewed my own code before requesting review
from others

### Release note

```release-note
NONE
```

---------

Signed-off-by: suyao <sy20010504@gmail.com>
2026-04-30 14:17:43 +08:00
fullex
6a6b47562b Merge branch 'main' of github.com:CherryHQ/cherry-studio into v2 2026-04-29 20:32:41 -07:00
SuYao
26d877e0fa hotfix(image-generation): fix gpt-image-2 / gpt-image-1.5 failures and stuck pending placeholder (#14578)
<!-- Template from
https://github.com/kubevirt/kubevirt/blob/main/.github/PULL_REQUEST_TEMPLATE.md?-->
<!--  Thanks for sending a pull request!  Here are some tips for you:
1. Consider creating this PR as draft:
https://github.com/CherryHQ/cherry-studio/blob/main/CONTRIBUTING.md
-->

<!--

🚨 Branch Strategy Change (Effective April 3, 2026) 🚨

The `main` branch is now under CODE FREEZE.

- main branch: Only accepts critical bug fixes via `hotfix/*` branches.
Fix PRs must be minimal in scope and must not include any refactoring
code.
- v2 branch: All new features, refactoring, and optimizations should be
submitted to the `v2` branch.

If you are submitting a bug fix to main, please ensure your PR is from a
`hotfix/*` branch.

-->

### What this PR does

Before this PR:

- `gpt-image-2` (and any image-edit request routed through AiHubMix /
NewAPI / CherryIN) failed with `common.UnmarshalBodyReusable failed:
bind request body failed: invalid character '-' in numeric literal`. The
providers hard-coded `Content-Type: application/json` in
`authHeaders()`, but `OpenAICompatibleImageModel.doGenerate` uses
`postFormDataToApi` for `/images/edits` and relies on `fetch` to
auto-set `multipart/form-data; boundary=...`. Forcing JSON made the
server receive a multipart body under a JSON content-type and choke on
the leading `--boundary`.
- Even when the request reached the server, image uploads failed with
`unsupported mimetype ('image')` because `collectImagesFromMessages`
built data URIs using `block.file.type` — which is the `FileType` enum
(`"image"`), not a MIME type.
- Some saved/pasted images produced `ENOENT: ... <uuid>jpg` because
`saveBase64Image` / `savePastedImage` return `ext` without the leading
dot, and the caller was concatenating `file.id + file.ext`.
- After a successful image generation, a `BeatLoader` placeholder kept
spinning next to the finished image. `fetchImageGeneration` only emitted
`LLM_RESPONSE_COMPLETE`; the trailing loader in `Blocks/index.tsx` is
driven by `isMessageProcessing(message)`, which is only cleared when
`onComplete` runs on `BLOCK_COMPLETE`.
- If a `file` chunk arrived without a preceding `IMAGE_CREATED`, the
initial UNKNOWN placeholder block was never claimed, leaving an orphan
spinner below the image.
- `gpt-image-2` / `gpt-image-1.5` / `gpt-image-1*` / `chatgpt-image-*`
generations through any OpenAI-compatible provider still failed with
`400 Unknown parameter: 'response_format'` (see #14485, #14540, #14579).
The earlier `@ai-sdk/openai@3.0.53` patch (#14488) only covered
`OpenAIImageModel` (direct OpenAI + Azure via `@ai-sdk/azure`);
`OpenAICompatibleImageModel.doGenerate` unconditionally added
`response_format: "b64_json"` to the `/images/generations` body, so
every provider whose image model is wired to
`OpenAICompatibleImageModel` kept hitting the 400 — including `type:
'openai-compatible'` and the AiHubMix / NewAPI / CherryIN gateway image
models in this repo.

After this PR:

- `aihubmix-provider`, `newapi-provider`, and `cherryin-provider` no
longer hard-code `Content-Type` in auth headers. `postJsonToApi` still
defaults JSON for other endpoints, and `postFormDataToApi` is free to
let `fetch` set `multipart/form-data; boundary=...` for `/images/edits`.
- `collectImagesFromMessages` reads via
`window.api.file.base64Image(block.file.name)`, which returns a correct
`data:image/<ext>;base64,...` URI (with `jpg → jpeg` normalization) and
uses the consistent on-disk filename regardless of whether the stored
`ext` has a leading dot.
- `fetchImageGeneration` now emits `ChunkType.BLOCK_COMPLETE` before
`LLM_RESPONSE_COMPLETE`, so `onComplete` runs and the assistant message
transitions out of `PROCESSING`.
- `onImageGenerated` reuses the initial UNKNOWN placeholder when one
exists, so a `file` chunk without a prior `IMAGE_CREATED` no longer
leaves an orphan spinner.
- `gpt-image-2` is registered in `IMAGE_ENHANCEMENT_MODELS`.
- `patches/@ai-sdk__openai-compatible@2.0.37.patch` is extended with the
same `hasDefaultResponseFormat` guard that `@ai-sdk/openai` already
uses. `OpenAICompatibleImageModel.doGenerate` now spreads
`response_format: "b64_json"` only when the model ID does **not** start
with `chatgpt-image-`, `gpt-image-1-mini`, `gpt-image-1.5`,
`gpt-image-1`, or `gpt-image-2`. This fixes #14485, #14540, #14579 for
`openai-compatible` typed providers and the AiHubMix / NewAPI / CherryIN
gateways.

Fixes #14485
Fixes #14540
Fixes #14579

### Why we need it and why it was done in this way

The following tradeoffs were made:

- The `ext`-with-or-without-dot inconsistency exists in historical DB
records, so patching only `FileStorage.ts` would not help already-saved
rows. The fix uses `file.name` at the consumer side — always the real
on-disk filename across every save path — without touching the storage
layer.
- The provider `authHeaders()` change could theoretically affect
non-JSON, non-multipart requests, but all SDK models in use go through
`postJsonToApi`, which already defaults `Content-Type: application/json`
internally, so behavior is preserved.
- Extending the `@ai-sdk/openai-compatible` patch rather than overriding
`response_format` per-provider keeps the fix in one place and
automatically covers every caller of `OpenAICompatibleImageModel`
(current and future). The guard list mirrors the upstream
`@ai-sdk/openai` list, so the two stay in sync.

The following alternatives were considered:

- Normalizing `ext` in `FileStorage.saveBase64Image` /
`savePastedImage`: rejected because it would not repair existing records
and could regress other callers that have compensated for the dotless
form.
- Overriding `Content-Type` only inside the image model factory:
rejected as more surface area than needed; the global `authHeaders()`
already defers to `postJsonToApi` defaults.
- Stripping `response_format` in each custom provider (AiHubMix / NewAPI
/ CherryIN) instead of patching the SDK: rejected — it would leave
`type: 'openai-compatible'` users still broken and duplicate the
model-prefix list in three places.

Links to places where the discussion took place: #14485, #14540, #14579,
#14488

### Breaking changes

<!-- optional -->

None.

### Special notes for your reviewer

<!-- optional -->

Scope is intentionally minimal for the main branch freeze: no
refactoring, no new abstractions. Surface changes:

- `authHeaders()` in three custom providers (drops one hard-coded
header).
- `collectImagesFromMessages` (one helper, swaps input building).
- `fetchImageGeneration` (one extra chunk emission).
- `onImageGenerated` (placeholder-claim fallback).
- `IMAGE_ENHANCEMENT_MODELS` (one new entry).
- `patches/@ai-sdk__openai-compatible@2.0.37.patch` (adds
`hasDefaultResponseFormat` helper + conditional spread of
`response_format`; mirrors `@ai-sdk/openai@3.0.53` patch).

Drop the openai-compatible patch addition once
`@ai-sdk/openai-compatible` ships the equivalent check upstream.

### Checklist

This checklist is not enforcing, but it's a reminder of items that could
be relevant to every PR.
Approvers are expected to review this list.

- [x] PR: The PR description is expressive enough and will help future
contributors
- [x] Code: [Write code that humans can
understand](https://en.wikiquote.org/wiki/Martin_Fowler#code-for-humans)
and [Keep it simple](https://en.wikipedia.org/wiki/KISS_principle)
- [x] Refactor: You have [left the code cleaner than you found it (Boy
Scout
Rule)](https://learning.oreilly.com/library/view/97-things-every/9780596809515/ch08.html)
- [x] Upgrade: Impact of this change on upgrade flows was considered and
addressed if required
- [ ] Documentation: A [user-guide update](https://docs.cherry-ai.com)
was considered and is present (link) or not required. Check this only
when the PR introduces or changes a user-facing feature or behavior.
- [x] Self-review: I have reviewed my own code (e.g., via
[`/gh-pr-review`](/.claude/skills/gh-pr-review/SKILL.md), `gh pr diff`,
or GitHub UI) before requesting review from others

### Release note

<!--  Write your release note:
1. Enter your extended release note in the below block. If the PR
requires additional action from users switching to the new release,
include the string "action required".
2. If no release note is required, just write "NONE".
3. Only include user-facing changes (new features, bug fixes visible to
users, UI changes, behavior changes). For CI, maintenance, internal
refactoring, build tooling, or other non-user-facing work, write "NONE".
-->

```release-note
Fix image generation and editing for gpt-image-2 / gpt-image-1.5 / gpt-image-1* / chatgpt-image-* across AiHubMix, NewAPI, CherryIN, Azure OpenAI, and other OpenAI-compatible providers: requests no longer fail with `Unknown parameter: 'response_format'`, multipart content-type, or mimetype errors; generated/pasted images are resolved correctly; and the loading placeholder disappears once the image is rendered.
```

---------

Signed-off-by: suyao <sy20010504@gmail.com>
2026-04-26 00:34:41 +08:00
fullex
5ec8696fd2 Merge branch 'main' of github.com:CherryHQ/cherry-studio into v2 2026-04-23 19:13:26 -07:00
SuYao
c0b3c880e3 hotfix(ai-sdk/openai): patch @ai-sdk/openai to support gpt-image-2 (#14488)
### What this PR does

Before this PR:

Calling the newly-released `gpt-image-2` model (shipped 2026-04-21) via
OpenAI image generation fails with `400 Unknown parameter:
'response_format'`. `@ai-sdk/openai@3.0.49` (our current AI SDK v6 line
dep) unconditionally sends `response_format: 'b64_json'` for any model
not in its `defaultResponseFormatPrefixes` allow-list, and `gpt-image-2`
is not in that list.

After this PR:

`@ai-sdk/openai@3.0.49` is patched to add `gpt-image-2` to both
`modelMaxImagesPerCall` and `defaultResponseFormatPrefixes` in all four
compiled dist entry points (`dist/index.{js,mjs}`,
`dist/internal/index.{js,mjs}`). This mirrors vercel/ai#14680, which was
backported to `release-v6.0` via vercel/ai#14682 on 2026-04-21 but has
not yet been published to npm. The patch is registered in
`pnpm.patchedDependencies` alongside the existing AI SDK patches.

Fixes #14485

### Why we need it and why it was done in this way

The upstream fix (vercel/ai#14680 / #14682) is already merged into the
`release-v6.0` branch, so a patch is a stable, low-risk equivalent of
the forthcoming `@ai-sdk/openai@3.0.54+`. Once that version ships on
npm, this patch can be dropped and replaced with a dependency bump.

The following tradeoffs were made:

- Patching compiled `dist/` files instead of source: matches the
repository's existing convention (see
`patches/@ai-sdk__google@3.0.55.patch`,
`patches/@ai-sdk__openai-compatible@2.0.37.patch`) and avoids rebuilding
the package.
- Not touching `.d.ts` type declarations: the upstream
`OpenAIImageModelId` union already accepts `(string & {})`, so runtime
behavior is the only thing that needs correcting.

The following alternatives were considered:

- Waiting for the npm release of `@ai-sdk/openai@3.0.54` — rejected
because users are actively hitting the bug today.
- Using a pnpm `overrides` entry pointing at the `release-v6.0` git
branch — rejected because it pulls an unversioned moving target and
conflicts with the locked semver range.
- Stripping `response_format` in an `aiCore` plugin — rejected because
the fix belongs at the provider layer and a plugin would permanently
mask similar issues for other models.

Links to places where the discussion took place: vercel/ai#14680,
vercel/ai#14682

### Breaking changes

None.

### Special notes for your reviewer

- The patch adds `gpt-image-2` at the expected positions in each of the
four dist files; diff is small and mechanical. Verified locally:
`node_modules/@ai-sdk/openai/dist/index.js:1753,1761` now contain
`gpt-image-2` after `pnpm install`.
- UI model picker changes are intentionally out of scope. Users select
`gpt-image-2` by model ID today; once upstream publishes, a follow-up
can refresh `src/renderer/src/config/models/default.ts` and friends.

### Checklist

- [x] PR: The PR description is expressive enough and will help future
contributors
- [x] Code: [Write code that humans can
understand](https://en.wikiquote.org/wiki/Martin_Fowler#code-for-humans)
and [Keep it simple](https://en.wikipedia.org/wiki/KISS_principle)
- [x] Refactor: You have [left the code cleaner than you found it (Boy
Scout
Rule)](https://learning.oreilly.com/library/view/97-things-every/9780596809515/ch08.html)
- [x] Upgrade: Impact of this change on upgrade flows was considered and
addressed if required
- [ ] Documentation: A [user-guide update](https://docs.cherry-ai.com)
was considered and is present (link) or not required. Check this only
when the PR introduces or changes a user-facing feature or behavior.
- [x] Self-review: I have reviewed my own code (e.g., via
[`/gh-pr-review`](/.claude/skills/gh-pr-review/SKILL.md), `gh pr diff`,
or GitHub UI) before requesting review from others

### Release note

```release-note
fix(ai-sdk/openai): patch @ai-sdk/openai to support OpenAI's gpt-image-2 model, resolving "Unknown parameter: 'response_format'" errors.
```

---------

Signed-off-by: suyao <sy20010504@gmail.com>
2026-04-22 23:29:50 +08:00
槑囿脑袋
7f5486ca51 fix(v2): remove knowledge libsql vector indexes (#14280) 2026-04-15 21:42:56 +08:00
fullex
e3ab9704b4 Merge branch 'main' of github.com:CherryHQ/cherry-studio into v2 2026-04-11 04:40:00 -07:00
github-actions[bot]
668ed35429 chore: version packages (#14154)
This PR was opened by the [Changesets
release](https://github.com/changesets/action) GitHub action. When
you're ready to do a release, you can merge this and the packages will
be published to npm automatically. If you're not ready to do a release
yet, that's fine, whenever you add more changesets to main, this PR will
be updated.


# Releases
## @cherrystudio/ai-core@2.0.1

### Patch Changes

- [#14087](https://github.com/CherryHQ/cherry-studio/pull/14087)
[`1f72f98`](1f72f98905)
Thanks [@DeJeune](https://github.com/DeJeune)! - fix(providers):
azure-anthropic variant uses correct Anthropic toolFactories for web
search

- Add `TOutput` generic to `ProviderVariant` so `transform` output type
flows to `toolFactories` and `resolveModel`
- Add Anthropic-specific `toolFactories` to `azure-anthropic` variant
(fixes `provider.tools.webSearchPreview is not a function`)
- Fix `urlContext` factory incorrectly mapping to `webSearch` tool key
instead of `urlContext`
- Fix `BedrockExtension` `satisfies` type to use `AmazonBedrockProvider`
instead of `ProviderV3`

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2026-04-11 15:15:45 +08:00
槑囿脑袋
798a15e919 feat(v2): knowledge service backend (#14090)
Co-authored-by: SuYao <sy20010504@gmail.com>
Co-authored-by: fullex <106392080+0xfullex@users.noreply.github.com>
2026-04-10 21:24:06 +08:00
jidan745le
780a884c67 feat(data): provider/model data migration and registry service (backend only) (#14115)
### What this PR does

Before this PR:
- v2 migration did not include provider/model data migration from legacy
`llm` state.
- Provider/model data APIs and handlers were incomplete.
- `@cherrystudio/provider-registry` (formerly provider-catalog) package
was not integrated into the data layer.

After this PR:
- Add provider/model migration path (`ProviderModelMigrator` + mappings)
and register it in v2 migrator flow.
- Add `@cherrystudio/provider-registry` package with JSON-based registry
data, Zod-validated schemas, and lifecycle-managed
`ProviderRegistryService`.
- Complete provider/model schemas, services, handlers, shared API
schemas/types, and model merger utility.
- Complete provider API endpoints (`registry-models`, `auth-config`,
`api-keys`) aligned with lifecycle DI patterns.

**Note:** This PR is intentionally scoped to backend/data-layer only.
Renderer consumer migration will be submitted in a separate PR to
maintain domain separation.

Fixes #

N/A

### Why we need it and why it was done in this way

The following tradeoffs were made:
- Kept migration and data API implementation within current v2
architecture (handler -> service -> db schema) instead of adding
temporary compatibility layers.
- Replaced protobuf toolchain with JSON + Zod validation for simpler
data pipeline and better debuggability.
- Converted all numeric enums to string-valued `as-const` objects
(EndpointType, ModelCapability, Modality, etc.) for runtime
debuggability.
- Unified separate `baseUrls`, `modelsApiUrls`, `reasoningFormatTypes`
fields into a single `endpointConfigs` map keyed by EndpointType.

The following alternatives were considered:
- Keep protobuf-based registry data; rejected due to complexity of proto
toolchain and poor debuggability of binary data.
- Include renderer consumer migration in same PR; deferred to separate
PR for cleaner domain boundaries.

Links to places where the discussion took place:
- Original combined PR: #14034

### Breaking changes

None.

### Special notes for your reviewer

- This is a backend-only extraction from #14034, which contained both
backend and renderer consumer code. The renderer migration will follow
in a separate PR.
- Please focus review on migration flow (`ProviderModelMigrator`),
provider/model service contracts, and the registry package design.
- The `@cherrystudio/provider-registry` package was renamed from
`provider-catalog` and uses JSON data files instead of protobuf.

### Checklist

- [x] PR: The PR description is expressive enough and will help future
contributors
- [x] Code: Write code that humans can understand and Keep it simple
- [x] Refactor: You have left the code cleaner than you found it (Boy
Scout Rule)
- [ ] Upgrade: Impact of this change on upgrade flows was considered and
addressed if required
- [ ] Documentation: Not required (internal data layer, no user-facing
changes)
- [x] Self-review: I have reviewed my own code

### Release note

```release-note
NONE
```

---------

Signed-off-by: jidan745le <420511176@qq.com>
Signed-off-by: suyao <sy20010504@gmail.com>
Co-authored-by: suyao <sy20010504@gmail.com>
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Co-authored-by: fullex <106392080+0xfullex@users.noreply.github.com>
2026-04-10 19:12:33 +08:00
fullex
6541948556 Merge branch 'main' of github.com:CherryHQ/cherry-studio into v2 2026-04-09 23:23:32 -07:00
SuYao
1f72f98905 fix(providers): azure-anthropic web search uses correct Anthropic toolFactories (#14087)
### What this PR does

Before this PR:

Using web search with the `azure-anthropic` variant throws
`provider.tools.webSearchPreview is not a function` because it falls
back to the Azure base extension's `toolFactories`, which calls
`webSearchPreview` — a method that doesn't exist on `AnthropicProvider`.

Additionally, the `urlContext` tool factory for Anthropic incorrectly
maps `webFetch` to the `webSearch` tool key instead of `urlContext`.

After this PR:

- `azure-anthropic` variant has its own Anthropic-specific
`toolFactories` (webSearch + urlContext)
- `ProviderVariant` gains a `TOutput` generic so `transform` output type
correctly flows to `toolFactories` and `resolveModel`
- `urlContext` factory correctly maps to `urlContext` tool key (not
`webSearch`)
- `BedrockExtension` uses `AmazonBedrockProvider` instead of
`ProviderV3` in its `satisfies` type

### Why we need it and why it was done in this way

The root cause is that `ProviderVariant` typed `toolFactories` against
`TProvider` (the base provider), but `transform` can return a completely
different provider type. Adding `TOutput` generic (defaulting to
`TProvider`) lets variants declare their output type, so `toolFactories`
gets the correct type without casts.

The following tradeoffs were made:

- `variants` array type uses `ProviderVariant<TSettings, TProvider,
any>` to allow heterogeneous output types per variant

The following alternatives were considered:

- Using `unknown` + `as` casts in each toolFactory — rejected for being
less type-safe

### Breaking changes

None. The `TOutput` generic defaults to `TProvider`, so existing code is
unaffected.

### Special notes for your reviewer

The `urlContext` → `webSearch` key bug exists in the original
`AnthropicExtension` too (not just the variant), both are fixed in this
PR.

### Checklist

- [x] PR: The PR description is expressive enough and will help future
contributors
- [x] Code: Write code that humans can understand and Keep it simple
- [x] Refactor: You have left the code cleaner than you found it (Boy
Scout Rule)
- [ ] Upgrade: Impact of this change on upgrade flows was considered and
addressed if required
- [ ] Documentation: A user-guide update was considered and is present
(link) or not required
- [x] Self-review: I have reviewed my own code before requesting review
from others

### Release note

```release-note
fix: Azure Anthropic web search no longer crashes with "webSearchPreview is not a function"
```

---------

Signed-off-by: suyao <sy20010504@gmail.com>
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-authored-by: 亢奋猫 <kangfenmao@qq.com>
2026-04-10 10:42:31 +08:00
SuYao
27e3363ab4 refactor(ui): migrate Tooltip from HeroUI to shadcn/Radix UI (#13563)
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Co-authored-by: fullex <106392080+0xfullex@users.noreply.github.com>
2026-04-07 13:12:03 +08:00
SuYao
fe502e8504 feat(aiCore): add createAgent factory for ToolLoopAgent with plugin pipeline (#14032)
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-authored-by: fullex <106392080+0xfullex@users.noreply.github.com>
2026-04-04 16:20:18 +08:00
suyao
6b14fcd5ce refactor: bump AI SDK deps and fix provider API host formatting
- Bump @ai-sdk/* packages to latest versions and update patches
- Fix newapi provider: defer API version suffix to build phase so gemini
  endpoints get /v1beta instead of /v1
- Fix Azure provider: split host formatting so azure-anthropic (Claude)
  endpoints don't get the /openai suffix meant for Azure OpenAI
- Re-add @ai-sdk/google getModelPath patch (includes("models/") check)
- Support azure-openai provider type in Claude Code agent service by
  auto-constructing the /anthropic base URL for Claude models

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: suyao <sy20010504@gmail.com>
2026-04-03 14:18:02 +08:00
github-actions[bot]
4083bd7083 chore: version packages (#13974)
This PR was opened by the [Changesets
release](https://github.com/changesets/action) GitHub action. When
you're ready to do a release, you can merge this and the packages will
be published to npm automatically. If you're not ready to do a release
yet, that's fine, whenever you add more changesets to main, this PR will
be updated.


# Releases
## @cherrystudio/ai-core@2.0.0

### Major Changes

- [#12235](https://github.com/CherryHQ/cherry-studio/pull/12235)
[`1c0a5a9`](1c0a5a95fa)
Thanks [@DeJeune](https://github.com/DeJeune)! - Migrate to AI SDK v6 -
complete rewrite of provider and middleware architecture

- **BREAKING**: Remove all legacy API clients, middleware pipeline, and
barrel `index.ts`
- **Image generation**: Migrate to native AI SDK
`generateImage`/`editImage`, remove legacy image middleware
- **Embedding**: Migrate to AI SDK `embedMany`, remove legacy embedding
clients
- **Model listing**: Refactor `ModelListService` to Strategy Registry
pattern, consolidate schema files
- **OpenRouter image**: Native image endpoint support via
`@openrouter/ai-sdk-provider` 2.3.3
- **GitHub Copilot**: Simplify extension by removing `ProviderV2` cast
and `wrapProvider`
- **Rename**: `index_new.ts` → `AiProvider.ts`, `ModelListService.ts` →
`listModels.ts`

### Patch Changes

- [#13787](https://github.com/CherryHQ/cherry-studio/pull/13787)
[`6b4c928`](6b4c928056)
Thanks [@EurFelux](https://github.com/EurFelux)! - Add missing
@openrouter/ai-sdk-provider dependency to fix package build

- [#12783](https://github.com/CherryHQ/cherry-studio/pull/12783)
[`336176b`](336176be08)
Thanks [@EurFelux](https://github.com/EurFelux)! - Baseline release for
previously unmanaged package changes while introducing changesets-based
publishing

- Updated dependencies
\[[`336176b`](336176be08)]:
    -   @cherrystudio/ai-sdk-provider@0.1.6

## @cherrystudio/ai-sdk-provider@0.1.6

### Patch Changes

- [#12783](https://github.com/CherryHQ/cherry-studio/pull/12783)
[`336176b`](336176be08)
Thanks [@EurFelux](https://github.com/EurFelux)! - Baseline release for
previously unmanaged package changes while introducing changesets-based
publishing

## @cherrystudio/extension-table-plus@3.0.12

### Patch Changes

- [#13840](https://github.com/CherryHQ/cherry-studio/pull/13840)
[`ae13786`](ae13786b55)
Thanks [@EurFelux](https://github.com/EurFelux)! - Add local
tsconfig.json to fix dts build failure in packages:build

- [#13817](https://github.com/CherryHQ/cherry-studio/pull/13817)
[`7c2610b`](7c2610b1e3)
Thanks [@EurFelux](https://github.com/EurFelux)! - Remove reference to
non-existent tsconfig.build.json to fix CI build failure

- [#12783](https://github.com/CherryHQ/cherry-studio/pull/12783)
[`336176b`](336176be08)
Thanks [@EurFelux](https://github.com/EurFelux)! - Baseline release for
previously unmanaged package changes while introducing changesets-based
publishing

---------

Signed-off-by: icarus <eurfelux@gmail.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: icarus <eurfelux@gmail.com>
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-03 14:18:02 +08:00
kangfenmao
d64e2e58f4 refactor: clean up aiCore by removing unused exports, dead types, and over-engineered abstractions 2026-04-03 14:18:02 +08:00
kangfenmao
d2c55a4914 feat: migrate to AI SDK v6 with complete rewrite of provider and middleware architecture 2026-04-03 14:18:02 +08:00
SuYao
a58bbf52fd refactor: migrate to ai sdk v6 Phase 3 (#12235)
Continued from #12227

## Summary

Phase 3 of AI SDK v6 migration:

- **Image generation**: Migrate to native AI SDK
`generateImage`/`editImage`, remove legacy image middleware
- **Embedding**: Migrate to AI SDK `embedMany`, remove legacy embedding
clients
- **Model listing**: Refactor `ModelListService` to Strategy Registry
pattern (`listModels.ts`), consolidate 7 schema files into one
`schemas.ts`
- **OpenRouter image**: Bump `@openrouter/ai-sdk-provider` to 2.3.3 with
native image endpoint support, remove `isNativeImageGenerationProvider`
guard
- **GitHub Copilot**: Simplify extension by removing `ProviderV2` cast
and `wrapProvider`
- **Legacy removal**: Delete all legacy API clients, middleware
pipeline, and barrel `index.ts`
- **Rename**: `index_new.ts` → `AiProvider.ts`, `ModelListService.ts` →
`listModels.ts`

## Manual Test Plan

### P0 — Core paths + PR change focus

#### 1. Core Chat
- [ ] OpenAI model (e.g. GPT-4o): send text, verify streaming output
- [ ] Anthropic model (e.g. Claude Sonnet): verify chat works
- [ ] Gemini model: verify chat works
- [ ] DeepSeek model: verify chat works
- [ ] Reasoning mode (o3-mini, DeepSeek R1): verify thinking process
displays
- [ ] Send message with image (multimodal): verify model recognizes
image
- [ ] Abort mid-stream: verify clean termination, no errors

#### 2. Image Generation (key change area)
- [ ] DALL-E 3 / GPT-Image-1: verify image generation works
- [ ] OpenRouter image model: verify **native image endpoint** is used
(no longer chat completions)
- [ ] Image editing: upload image + text prompt, verify editImage path
- [ ] Verify generated images display correctly (both base64 and URL
formats)

#### 3. Model Listing (refactored area)
- [ ] Sync OpenAI models: verify names and groups
- [ ] Sync Gemini models: verify `models/` prefix stripped
- [ ] Sync Ollama models (local): verify display
- [ ] Sync OpenRouter models: verify chat + embedding models both appear
- [ ] Sync SiliconFlow models: verify grouping (e.g. `deepseek-ai/`)
- [ ] Sync GitHub Models
- [ ] Sync Together models
- [ ] Sync NewAPI service (e.g. CherryIn)
- [ ] Sync PPIO models: verify chat + embedding + reranker endpoints
merged

### P1 — Affected by refactor

#### 4. Provider Extensions
- [ ] GitHub Copilot: verify chat works (simplified wrapProvider logic)
- [ ] Ollama: verify chat works
- [ ] Vertex AI / Bedrock: verify chat works (if configured)

#### 5. MCP Tool Calling
- [ ] Enable MCP server, send tool-requiring message, verify tool
execution
- [ ] Verify both prompt tool use and function calling modes

#### 6. Auxiliary Functions
- [ ] Auto topic title generation (fetchMessagesSummary)
- [ ] Note summary (fetchNoteSummary)
- [ ] Translation/generation (fetchGenerate)
- [ ] API check (click "Check" button in settings)

### P2 — Indirect impact

#### 7. Knowledge Base
- [ ] Create knowledge base, associate with assistant, verify RAG
retrieval and embedding

#### 8. Web Search
- [ ] Enable native web search (Gemini/Perplexity), verify search
results in response

#### 9. Tracing
- [ ] Enable developer mode, send message, verify trace spans recorded
and displayed

---------

Signed-off-by: suyao <sy20010504@gmail.com>
Co-authored-by: Claude Sonnet 4.5 <noreply@anthropic.com>
Co-authored-by: icarus <eurfelux@gmail.com>
Co-authored-by: fullex <106392080+0xfullex@users.noreply.github.com>
2026-04-03 14:18:02 +08:00
suyao
72a536295b Merge remote-tracking branch 'origin/main' into DeJeune/merge-settings-routes 2026-04-03 00:19:37 +08:00
suyao
00d1980082 Merge remote-tracking branch 'origin/main' into DeJeune/cape-town
Merge main branch changes including CherryClaw agent system (#13359),
new settings routes (skills, channels, scheduled-tasks), and various
fixes. Adapted merged code to v2 architecture:

- Migrated new routes to TanStack Router (file-based routing)
- Migrated TasksSettings from react-router-dom/Redux to TanStack Router/CacheService
- Migrated baseCallbacks.ts from Redux dispatch to StreamingService
- Added agent bootstrap initialization to v2 entry point
- Replaced antd Switch with @cherrystudio/ui Switch in AgentModal

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: suyao <sy20010504@gmail.com>
2026-04-02 23:49:15 +08:00
suyao
897be8c2ed fix: use empty changeset for root-only changes
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: suyao <sy20010504@gmail.com>
2026-04-02 20:29:50 +08:00
suyao
8c20fb45e0 fix: resolve TS errors in claudecode service and add changeset
- Extract `modelInfo.provider` into a local `provider` variable with
  an explicit undefined guard to satisfy strict null checks
- Add changeset for the AI SDK bump

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: suyao <sy20010504@gmail.com>
2026-04-02 20:29:49 +08:00
github-actions[bot]
07bbed0d83 chore: version packages (#13974)
This PR was opened by the [Changesets
release](https://github.com/changesets/action) GitHub action. When
you're ready to do a release, you can merge this and the packages will
be published to npm automatically. If you're not ready to do a release
yet, that's fine, whenever you add more changesets to main, this PR will
be updated.


# Releases
## @cherrystudio/ai-core@2.0.0

### Major Changes

- [#12235](https://github.com/CherryHQ/cherry-studio/pull/12235)
[`1c0a5a9`](1c0a5a95fa)
Thanks [@DeJeune](https://github.com/DeJeune)! - Migrate to AI SDK v6 -
complete rewrite of provider and middleware architecture

- **BREAKING**: Remove all legacy API clients, middleware pipeline, and
barrel `index.ts`
- **Image generation**: Migrate to native AI SDK
`generateImage`/`editImage`, remove legacy image middleware
- **Embedding**: Migrate to AI SDK `embedMany`, remove legacy embedding
clients
- **Model listing**: Refactor `ModelListService` to Strategy Registry
pattern, consolidate schema files
- **OpenRouter image**: Native image endpoint support via
`@openrouter/ai-sdk-provider` 2.3.3
- **GitHub Copilot**: Simplify extension by removing `ProviderV2` cast
and `wrapProvider`
- **Rename**: `index_new.ts` → `AiProvider.ts`, `ModelListService.ts` →
`listModels.ts`

### Patch Changes

- [#13787](https://github.com/CherryHQ/cherry-studio/pull/13787)
[`6b4c928`](6b4c928056)
Thanks [@EurFelux](https://github.com/EurFelux)! - Add missing
@openrouter/ai-sdk-provider dependency to fix package build

- [#12783](https://github.com/CherryHQ/cherry-studio/pull/12783)
[`336176b`](336176be08)
Thanks [@EurFelux](https://github.com/EurFelux)! - Baseline release for
previously unmanaged package changes while introducing changesets-based
publishing

- Updated dependencies
\[[`336176b`](336176be08)]:
    -   @cherrystudio/ai-sdk-provider@0.1.6

## @cherrystudio/ai-sdk-provider@0.1.6

### Patch Changes

- [#12783](https://github.com/CherryHQ/cherry-studio/pull/12783)
[`336176b`](336176be08)
Thanks [@EurFelux](https://github.com/EurFelux)! - Baseline release for
previously unmanaged package changes while introducing changesets-based
publishing

## @cherrystudio/extension-table-plus@3.0.12

### Patch Changes

- [#13840](https://github.com/CherryHQ/cherry-studio/pull/13840)
[`ae13786`](ae13786b55)
Thanks [@EurFelux](https://github.com/EurFelux)! - Add local
tsconfig.json to fix dts build failure in packages:build

- [#13817](https://github.com/CherryHQ/cherry-studio/pull/13817)
[`7c2610b`](7c2610b1e3)
Thanks [@EurFelux](https://github.com/EurFelux)! - Remove reference to
non-existent tsconfig.build.json to fix CI build failure

- [#12783](https://github.com/CherryHQ/cherry-studio/pull/12783)
[`336176b`](336176be08)
Thanks [@EurFelux](https://github.com/EurFelux)! - Baseline release for
previously unmanaged package changes while introducing changesets-based
publishing

---------

Signed-off-by: icarus <eurfelux@gmail.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: icarus <eurfelux@gmail.com>
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-02 19:45:11 +08:00
suyao
4dc1aac287 Merge remote-tracking branch 'origin/main' into DeJeune/merge-main-to-v2
Signed-off-by: suyao <sy20010504@gmail.com>

# Conflicts:
#	packages/aiCore/src/core/plugins/built-in/webSearchPlugin/helper.ts
#	pnpm-lock.yaml
#	src/main/ipc.ts
#	src/main/services/CodeCliService.ts
#	src/main/services/ProxyManager.ts
#	src/main/services/WebviewService.ts
#	src/main/services/WindowService.ts
#	src/main/services/__tests__/ProxyManager.test.ts
#	src/main/services/agents/services/claudecode/index.ts
#	src/preload/index.ts
#	src/renderer/src/aiCore/index_new.ts
#	src/renderer/src/aiCore/legacy/clients/BaseApiClient.ts
#	src/renderer/src/aiCore/legacy/clients/__tests__/index.clientCompatibilityTypes.test.ts
#	src/renderer/src/aiCore/legacy/clients/ovms/OVMSClient.ts
#	src/renderer/src/aiCore/legacy/clients/types.ts
#	src/renderer/src/aiCore/legacy/clients/zhipu/ZhipuAPIClient.ts
#	src/renderer/src/aiCore/legacy/middleware/feat/ImageGenerationMiddleware.ts
#	src/renderer/src/aiCore/plugins/PluginBuilder.ts
#	src/renderer/src/pages/code/CodeCliPage.tsx
#	src/renderer/src/pages/home/Messages/Blocks/ErrorBlock.tsx
#	src/renderer/src/pages/paintings/ZhipuPage.tsx
#	src/renderer/src/pages/settings/ProviderSettings/ModelList/ModelListItem.tsx
#	src/renderer/src/pages/settings/ProviderSettings/ProviderSetting.tsx
#	src/renderer/src/services/AssistantService.ts
#	src/renderer/src/services/__tests__/ApiService.test.ts
#	tsconfig.web.json
2026-04-02 18:03:03 +08:00
kangfenmao
206de8e8fc refactor: clean up aiCore by removing unused exports, dead types, and over-engineered abstractions 2026-04-02 16:31:18 +08:00
kangfenmao
c851b941fe feat: migrate to AI SDK v6 with complete rewrite of provider and middleware architecture 2026-04-02 16:18:26 +08:00
SuYao
1c0a5a95fa refactor: migrate to ai sdk v6 Phase 3 (#12235)
Continued from #12227

## Summary

Phase 3 of AI SDK v6 migration:

- **Image generation**: Migrate to native AI SDK
`generateImage`/`editImage`, remove legacy image middleware
- **Embedding**: Migrate to AI SDK `embedMany`, remove legacy embedding
clients
- **Model listing**: Refactor `ModelListService` to Strategy Registry
pattern (`listModels.ts`), consolidate 7 schema files into one
`schemas.ts`
- **OpenRouter image**: Bump `@openrouter/ai-sdk-provider` to 2.3.3 with
native image endpoint support, remove `isNativeImageGenerationProvider`
guard
- **GitHub Copilot**: Simplify extension by removing `ProviderV2` cast
and `wrapProvider`
- **Legacy removal**: Delete all legacy API clients, middleware
pipeline, and barrel `index.ts`
- **Rename**: `index_new.ts` → `AiProvider.ts`, `ModelListService.ts` →
`listModels.ts`

## Manual Test Plan

### P0 — Core paths + PR change focus

#### 1. Core Chat
- [ ] OpenAI model (e.g. GPT-4o): send text, verify streaming output
- [ ] Anthropic model (e.g. Claude Sonnet): verify chat works
- [ ] Gemini model: verify chat works
- [ ] DeepSeek model: verify chat works
- [ ] Reasoning mode (o3-mini, DeepSeek R1): verify thinking process
displays
- [ ] Send message with image (multimodal): verify model recognizes
image
- [ ] Abort mid-stream: verify clean termination, no errors

#### 2. Image Generation (key change area)
- [ ] DALL-E 3 / GPT-Image-1: verify image generation works
- [ ] OpenRouter image model: verify **native image endpoint** is used
(no longer chat completions)
- [ ] Image editing: upload image + text prompt, verify editImage path
- [ ] Verify generated images display correctly (both base64 and URL
formats)

#### 3. Model Listing (refactored area)
- [ ] Sync OpenAI models: verify names and groups
- [ ] Sync Gemini models: verify `models/` prefix stripped
- [ ] Sync Ollama models (local): verify display
- [ ] Sync OpenRouter models: verify chat + embedding models both appear
- [ ] Sync SiliconFlow models: verify grouping (e.g. `deepseek-ai/`)
- [ ] Sync GitHub Models
- [ ] Sync Together models
- [ ] Sync NewAPI service (e.g. CherryIn)
- [ ] Sync PPIO models: verify chat + embedding + reranker endpoints
merged

### P1 — Affected by refactor

#### 4. Provider Extensions
- [ ] GitHub Copilot: verify chat works (simplified wrapProvider logic)
- [ ] Ollama: verify chat works
- [ ] Vertex AI / Bedrock: verify chat works (if configured)

#### 5. MCP Tool Calling
- [ ] Enable MCP server, send tool-requiring message, verify tool
execution
- [ ] Verify both prompt tool use and function calling modes

#### 6. Auxiliary Functions
- [ ] Auto topic title generation (fetchMessagesSummary)
- [ ] Note summary (fetchNoteSummary)
- [ ] Translation/generation (fetchGenerate)
- [ ] API check (click "Check" button in settings)

### P2 — Indirect impact

#### 7. Knowledge Base
- [ ] Create knowledge base, associate with assistant, verify RAG
retrieval and embedding

#### 8. Web Search
- [ ] Enable native web search (Gemini/Perplexity), verify search
results in response

#### 9. Tracing
- [ ] Enable developer mode, send message, verify trace spans recorded
and displayed

---------

Signed-off-by: suyao <sy20010504@gmail.com>
Co-authored-by: Claude Sonnet 4.5 <noreply@anthropic.com>
Co-authored-by: icarus <eurfelux@gmail.com>
Co-authored-by: fullex <106392080+0xfullex@users.noreply.github.com>
2026-04-02 15:38:23 +08:00
Phantom
7a08921423 chore(changeset): ignore @cherrystudio/ui in changeset checks (#13872)
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-29 10:14:48 +08:00
Phantom
ae13786b55 fix(extension-table-plus): add local tsconfig.json to fix dts build failure (#13840)
### What this PR does

Before this PR:
`pnpm packages:build` fails on `extension-table-plus` because tsdown
auto-detects the root `tsconfig.json` which contains `references`,
causing `rolldown-plugin-dts` to error out.

After this PR:
A local `tsconfig.json` is added to the `extension-table-plus` package,
consistent with other packages (`aiCore`, `ai-sdk-provider`). `pnpm
packages:build` completes successfully.

Fixes the remaining issue from #13817

### Why we need it and why it was done in this way

The previous fix (#13817) removed the reference to a non-existent
`tsconfig.build.json`, but without a local tsconfig, tsdown falls back
to the root `tsconfig.json` which has `references` — incompatible with
`rolldown-plugin-dts` for dts generation.

The following tradeoffs were made: None.

The following alternatives were considered:
- Using `dts: { build: true }` in tsdown config, but adding a local
tsconfig is more consistent with other packages in the monorepo.

### Breaking changes

None.

### Special notes for your reviewer

Verified with `pnpm packages:build` — all three packages build
successfully.

### Checklist

- [x] PR: The PR description is expressive enough and will help future
contributors
- [x] Code: [Write code that humans can
understand](https://en.wikiquote.org/wiki/Martin_Fowler#code-for-humans)
and [Keep it simple](https://en.wikipedia.org/wiki/KISS_principle)
- [x] Refactor: You have [left the code cleaner than you found it (Boy
Scout
Rule)](https://learning.oreilly.com/library/view/97-things-every/9780596809515/ch08.html)
- [x] Upgrade: Impact of this change on upgrade flows was considered and
addressed if required
- [ ] Documentation: A [user-guide update](https://docs.cherry-ai.com)
was considered and is present (link) or not required. Check this only
when the PR introduces or changes a user-facing feature or behavior.
- [x] Self-review: I have reviewed my own code (e.g., via
[`/gh-pr-review`](/.claude/skills/gh-pr-review/SKILL.md), `gh pr diff`,
or GitHub UI) before requesting review from others

### Release note

```release-note
NONE
```

---------

Signed-off-by: icarus <eurfelux@gmail.com>
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-28 00:04:51 +08:00
Phantom
7c2610b1e3 fix(extension-table-plus): remove reference to non-existent tsconfig.build.json (#13817)
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-27 09:51:03 +08:00
Phantom
6b4c928056 fix(aiCore): add missing @openrouter/ai-sdk-provider dependency (#13787)
### What this PR does

Before this PR:

The `@cherrystudio/ai-core` package imports
`@openrouter/ai-sdk-provider` in its source code (`schemas.ts` and
`types.ts`), but this dependency was not declared in
`packages/aiCore/package.json`. This caused `tsdown` to inline-bundle it
and exit with an error, failing the **Release Packages** CI workflow.

After this PR:

`@openrouter/ai-sdk-provider` is properly declared as a dependency in
`packages/aiCore/package.json`, so `tsdown` treats it as an external
dependency and the build succeeds.

Fixes #

N/A

### Why we need it and why it was done in this way

The following tradeoffs were made:

None — this is a straightforward missing dependency declaration.

The following alternatives were considered:

None.

Links to places where the discussion took place:

N/A

### Breaking changes

None.

### Special notes for your reviewer

The root `package.json` already has `@openrouter/ai-sdk-provider@^2.2.3`
with a patch applied. The aiCore package now correctly declares the same
version range so it resolves through the workspace.

### Checklist

- [x] PR: The PR description is expressive enough and will help future
contributors
- [x] Code: [Write code that humans can
understand](https://en.wikiquote.org/wiki/Martin_Fowler#code-for-humans)
and [Keep it simple](https://en.wikipedia.org/wiki/KISS_principle)
- [x] Refactor: You have [left the code cleaner than you found it (Boy
Scout
Rule)](https://learning.oreilly.com/library/view/97-things-every/9780596809515/ch08.html)
- [x] Upgrade: Impact of this change on upgrade flows was considered and
addressed if required
- [ ] Documentation: A [user-guide update](https://docs.cherry-ai.com)
was considered and is present (link) or not required. Check this only
when the PR introduces or changes a user-facing feature or behavior.
- [x] Self-review: I have reviewed my own code (e.g., via
[`/gh-pr-review`](/.claude/skills/gh-pr-review/SKILL.md), `gh pr diff`,
or GitHub UI) before requesting review from others

### Release note

```release-note
NONE
```

---------

Signed-off-by: icarus <eurfelux@gmail.com>
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-26 13:16:17 +08:00
Phantom
336176be08 feat: introduce changeset for monorepo version management (#12783)
## Summary

This PR introduces
[changesets](https://github.com/changesets/changesets) to automate
version management and publishing for the Cherry Studio monorepo.

## Changes

### Changeset Setup
- `.changeset/config.json` - Changeset configuration with GitHub
changelog integration
- `.changeset/README.md` - Documentation for using changesets and CI/CD
release flow
- `.changeset/initial-setup.md` - Initial changeset marking the setup

### CI/CD Workflows
- `.github/workflows/release-packages.yml` - Automated release workflow
(creates Version Packages PR, publishes on merge)
- `.github/workflows/snapshot.yml` - Manual snapshot release workflow
- `.github/workflows/ci.yml` - Added `changeset-check` job to verify PRs
include changesets when packages are modified

### Package Updates
- `package.json` - Added changeset scripts (`changeset`,
`changeset:status`, `changeset:version`, `changeset:publish`,
`packages:build`, `packages:release`)
- `packages/aiCore/package.json` - Added `prepublishOnly` script
- `packages/ai-sdk-provider/package.json` - Added `prepublishOnly`
script
- `packages/extension-table-plus/package.json` - Added `prepublishOnly`
script
- `packages/extension-table-plus/CHANGELOG-OLD.md` - Backup of
historical changelog

## How It Works

1. **Developers**: Run `pnpm changeset add` in PRs that modify packages
2. **CI**: `changeset-check` job validates PRs include changesets when
needed
3. **Accumulate**: Merging PRs with changesets auto-creates/updates a
"Version Packages" PR
4. **Release**: Maintainers merge the Version Packages PR when ready →
packages are published to npm

## Requirements

- [ ] `NPM_TOKEN` secret must be configured in GitHub repository
settings

## Test Plan

- [x] `pnpm changeset:status` runs successfully
- [x] `GITHUB_TOKEN=$(gh auth token) pnpm changeset:version` bumps
versions and generates changelogs correctly
- [x] `pnpm packages:build` builds all packages in correct order
- [x] `pnpm format` passes

## Release Note

```release-note
NONE (internal tooling change)
```

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

---------

Signed-off-by: icarus <eurfelux@gmail.com>
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-25 17:00:45 +08:00