mirror of
https://github.com/CherryHQ/cherry-studio.git
synced 2025-12-25 11:20:07 +08:00
filter: copilot
This commit is contained in:
parent
8c9d79a7d4
commit
4d77202afd
@ -15,6 +15,7 @@ import {
|
||||
isSupportVerbosityModel
|
||||
} from '../openai'
|
||||
import { isQwenMTModel } from '../qwen'
|
||||
import { isFunctionCallingModel } from '../tooluse'
|
||||
import {
|
||||
agentModelFilter,
|
||||
getModelSupportedVerbosity,
|
||||
@ -112,6 +113,7 @@ const textToImageMock = vi.mocked(isTextToImageModel)
|
||||
const generateImageMock = vi.mocked(isGenerateImageModel)
|
||||
const reasoningMock = vi.mocked(isOpenAIReasoningModel)
|
||||
const openAIWebSearchOnlyMock = vi.mocked(isOpenAIWebSearchChatCompletionOnlyModel)
|
||||
const isFunctionCallingModelMock = vi.mocked(isFunctionCallingModel)
|
||||
|
||||
describe('model utils', () => {
|
||||
beforeEach(() => {
|
||||
@ -457,6 +459,12 @@ describe('model utils', () => {
|
||||
expect(agentModelFilter(createModel({ id: 'rerank' }))).toBe(false)
|
||||
})
|
||||
|
||||
it('filters out non-function-call models', () => {
|
||||
rerankMock.mockReturnValue(false)
|
||||
isFunctionCallingModelMock.mockReturnValueOnce(false)
|
||||
expect(agentModelFilter(createModel({ id: 'DeepSeek R1' }))).toBe(false)
|
||||
})
|
||||
|
||||
it('filters out text-to-image models', () => {
|
||||
rerankMock.mockReturnValue(false)
|
||||
textToImageMock.mockReturnValueOnce(true)
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
import type OpenAI from '@cherrystudio/openai'
|
||||
import { isEmbeddingModel, isRerankModel } from '@renderer/config/models/embedding'
|
||||
import { getProviderByModel } from '@renderer/services/AssistantService'
|
||||
import { type Model, SystemProviderIds } from '@renderer/types'
|
||||
import type { OpenAIVerbosity, ValidOpenAIVerbosity } from '@renderer/types/aiCoreTypes'
|
||||
import { getLowerBaseModelName } from '@renderer/utils'
|
||||
@ -184,6 +185,12 @@ export const ZHIPU_RESULT_TOKENS = ['<|begin_of_box|>', '<|end_of_box|>'] as con
|
||||
|
||||
// TODO: 支持提示词模式的工具调用
|
||||
export const agentModelFilter = (model: Model): boolean => {
|
||||
const provider = getProviderByModel(model)
|
||||
|
||||
// 需要适配,且容易超出限额
|
||||
if (provider.id === SystemProviderIds.copilot) {
|
||||
return false
|
||||
}
|
||||
return (
|
||||
!isEmbeddingModel(model) &&
|
||||
!isRerankModel(model) &&
|
||||
|
||||
Loading…
Reference in New Issue
Block a user