fix: apply custom params to rephraser (#12969)

<!-- 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
-->

<!--

⚠️ Important: Redux/IndexedDB Data-Changing Feature PRs Temporarily On
Hold ⚠️

Please note: For our current development cycle, we are not accepting
feature Pull Requests that introduce changes to Redux data models or
IndexedDB schemas.

While we value your contributions, PRs of this nature will be blocked
without merge. We welcome all other contributions (bug fixes, perf
enhancements, docs, etc.). Thank you!

Once version 2.0.0 is released, we will resume reviewing feature PRs.

-->

### What this PR does

Fixes #12968 

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

Otherwise, even if `store: false` is set for the assistant, the
rephraser's request is still logged in OpenAI console, which is a big
security problem.

#7214

### Breaking changes

<!-- optional -->

If this PR introduces breaking changes, please describe the changes and
the impact on users.

### Special notes for your reviewer

<!-- optional -->

### 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. You want a
user-guide update if it's a user facing feature.

### 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".
-->

```release-note
Question rephraser now respects custom parameter set for assistant.
```
This commit is contained in:
Samuel Huang
2026-02-20 01:03:10 -05:00
committed by GitHub
parent cc3d440245
commit 38c29c194e

View File

@@ -4,6 +4,7 @@
import { loggerService } from '@logger'
import type { AiSdkMiddlewareConfig } from '@renderer/aiCore/middleware/AiSdkMiddlewareBuilder'
import { buildStreamTextParams } from '@renderer/aiCore/prepareParams'
import { buildProviderOptions } from '@renderer/aiCore/utils/options'
import { isDedicatedImageGenerationModel, isEmbeddingModel, isFunctionCallingModel } from '@renderer/config/models'
import { getStoreSetting } from '@renderer/hooks/useSettings'
import i18n from '@renderer/i18n'
@@ -306,6 +307,7 @@ export async function fetchMessagesSummary({
}
const AI = new AiProviderNew(model, providerWithRotatedKey)
const actualProvider = AI.getActualProvider()
const topicId = messages?.find((message) => message.topicId)?.topicId || ''
@@ -350,9 +352,17 @@ export async function fetchMessagesSummary({
model
}
const { providerOptions, standardParams } = buildProviderOptions(summaryAssistant, model, actualProvider, {
enableReasoning: false,
enableWebSearch: false,
enableGenerateImage: false
})
const llmMessages = {
system: prompt,
prompt: conversation
prompt: conversation,
providerOptions,
...standardParams
}
const middlewareConfig: AiSdkMiddlewareConfig = {