mirror of
https://github.com/CherryHQ/cherry-studio.git
synced 2026-01-05 12:29:44 +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 { AnthropicAPIClient } from '@renderer/aiCore/clients/anthropic/AnthropicAPIClient'
|
||||||
import { isAnthropicModel } from '@renderer/config/models'
|
|
||||||
import { AnthropicSdkRawChunk, AnthropicSdkRawOutput } from '@renderer/types/sdk'
|
import { AnthropicSdkRawChunk, AnthropicSdkRawOutput } from '@renderer/types/sdk'
|
||||||
|
|
||||||
import { AnthropicStreamListener } from '../../clients/types'
|
import { AnthropicStreamListener } from '../../clients/types'
|
||||||
@ -16,9 +15,8 @@ export const RawStreamListenerMiddleware: CompletionsMiddleware =
|
|||||||
|
|
||||||
// 在这里可以监听到从SDK返回的最原始流
|
// 在这里可以监听到从SDK返回的最原始流
|
||||||
if (result.rawOutput) {
|
if (result.rawOutput) {
|
||||||
const model = params.assistant.model
|
|
||||||
// TODO: 后面下放到AnthropicAPIClient
|
// TODO: 后面下放到AnthropicAPIClient
|
||||||
if (isAnthropicModel(model)) {
|
if (ctx.apiClientInstance instanceof AnthropicAPIClient) {
|
||||||
const anthropicListener: AnthropicStreamListener<AnthropicSdkRawChunk> = {
|
const anthropicListener: AnthropicStreamListener<AnthropicSdkRawChunk> = {
|
||||||
onMessage: (message) => {
|
onMessage: (message) => {
|
||||||
if (ctx._internal?.toolProcessingState) {
|
if (ctx._internal?.toolProcessingState) {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user