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