mirror of
https://github.com/CherryHQ/cherry-studio.git
synced 2026-01-03 11:19:10 +08:00
test(services): 更新ApiService测试中的模型配置模拟
修改测试文件中的模型配置模拟,使用vi.importActual获取原始模块并扩展模拟实现,移除不再使用的SYSTEM_MODELS导入
This commit is contained in:
parent
176430a31f
commit
f670802b65
@ -15,7 +15,7 @@ import { ApiClientFactory } from '@renderer/aiCore/clients/ApiClientFactory'
|
|||||||
import { GeminiAPIClient } from '@renderer/aiCore/clients/gemini/GeminiAPIClient'
|
import { GeminiAPIClient } from '@renderer/aiCore/clients/gemini/GeminiAPIClient'
|
||||||
import { OpenAIResponseAPIClient } from '@renderer/aiCore/clients/openai/OpenAIResponseAPIClient'
|
import { OpenAIResponseAPIClient } from '@renderer/aiCore/clients/openai/OpenAIResponseAPIClient'
|
||||||
import { GenericChunk } from '@renderer/aiCore/middleware/schemas'
|
import { GenericChunk } from '@renderer/aiCore/middleware/schemas'
|
||||||
import { isVisionModel, SYSTEM_MODELS } from '@renderer/config/models'
|
import { isVisionModel } from '@renderer/config/models'
|
||||||
import { Assistant, MCPCallToolResponse, MCPToolResponse, Model, Provider, WebSearchSource } from '@renderer/types'
|
import { Assistant, MCPCallToolResponse, MCPToolResponse, Model, Provider, WebSearchSource } from '@renderer/types'
|
||||||
import {
|
import {
|
||||||
Chunk,
|
Chunk,
|
||||||
@ -48,25 +48,29 @@ vi.mock('@renderer/aiCore/clients/ApiClientFactory', () => ({
|
|||||||
}))
|
}))
|
||||||
|
|
||||||
// Mock the models config
|
// Mock the models config
|
||||||
vi.mock('@renderer/config/models', () => ({
|
vi.mock('@renderer/config/models', async () => {
|
||||||
isDedicatedImageGenerationModel: vi.fn(() => false),
|
const origin = await vi.importActual('@renderer/config/models')
|
||||||
isTextToImageModel: vi.fn(() => false),
|
|
||||||
isEmbeddingModel: vi.fn(() => false),
|
return {
|
||||||
isRerankModel: vi.fn(() => false),
|
...origin,
|
||||||
isVisionModel: vi.fn(() => false),
|
isDedicatedImageGenerationModel: vi.fn(() => false),
|
||||||
isReasoningModel: vi.fn(() => false),
|
isTextToImageModel: vi.fn(() => false),
|
||||||
isWebSearchModel: vi.fn(() => false),
|
isEmbeddingModel: vi.fn(() => false),
|
||||||
isOpenAIModel: vi.fn(() => false),
|
isRerankModel: vi.fn(() => false),
|
||||||
isFunctionCallingModel: vi.fn(() => true),
|
isVisionModel: vi.fn(() => false),
|
||||||
models: {
|
isReasoningModel: vi.fn(() => false),
|
||||||
gemini: {
|
isWebSearchModel: vi.fn(() => false),
|
||||||
id: 'gemini-2.5-pro',
|
isOpenAIModel: vi.fn(() => false),
|
||||||
name: 'Gemini 2.5 Pro'
|
isFunctionCallingModel: vi.fn(() => true),
|
||||||
}
|
models: {
|
||||||
},
|
gemini: {
|
||||||
isAnthropicModel: vi.fn(() => false),
|
id: 'gemini-2.5-pro',
|
||||||
SYSTEM_MODELS
|
name: 'Gemini 2.5 Pro'
|
||||||
}))
|
}
|
||||||
|
},
|
||||||
|
isAnthropicModel: vi.fn(() => false)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
// Mock uuid
|
// Mock uuid
|
||||||
vi.mock('uuid', () => ({
|
vi.mock('uuid', () => ({
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user