mirror of
https://github.com/CherryHQ/cherry-studio.git
synced 2025-12-24 10:40:07 +08:00
fix: unexpected anthropic model recognization (#9517)
* fix: unexpected anthropic model recognization * refactor(RawStreamListenerMiddleware): replace model provider retrieval with API client instance check
This commit is contained in:
parent
a398010213
commit
e90b9a5a95
@ -1,5 +1,4 @@
|
||||
import { AnthropicAPIClient } from '@renderer/aiCore/clients/anthropic/AnthropicAPIClient'
|
||||
import { isAnthropicModel } from '@renderer/config/models'
|
||||
import { AnthropicSdkRawChunk, AnthropicSdkRawOutput } from '@renderer/types/sdk'
|
||||
|
||||
import { AnthropicStreamListener } from '../../clients/types'
|
||||
@ -16,9 +15,8 @@ export const RawStreamListenerMiddleware: CompletionsMiddleware =
|
||||
|
||||
// 在这里可以监听到从SDK返回的最原始流
|
||||
if (result.rawOutput) {
|
||||
const model = params.assistant.model
|
||||
// TODO: 后面下放到AnthropicAPIClient
|
||||
if (isAnthropicModel(model)) {
|
||||
if (ctx.apiClientInstance instanceof AnthropicAPIClient) {
|
||||
const anthropicListener: AnthropicStreamListener<AnthropicSdkRawChunk> = {
|
||||
onMessage: (message) => {
|
||||
if (ctx._internal?.toolProcessingState) {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user