mirror of
https://github.com/CherryHQ/cherry-studio.git
synced 2025-12-24 18:50:56 +08:00
fix: test
This commit is contained in:
parent
fd0be32ab4
commit
08a537bfe4
@ -322,9 +322,10 @@ function convertAnthropicToAiMessages(params: MessageCreateParams): ModelMessage
|
||||
}
|
||||
}
|
||||
if (openRouterReasoningCache.get(`openrouter-${block.id}`)) {
|
||||
options.openrouter = {
|
||||
reasoning_details: (sanitizeJson(openRouterReasoningCache.get(`openrouter-${block.id}`)) as JSONValue[]) || []
|
||||
}
|
||||
options.openrouter = {
|
||||
reasoning_details:
|
||||
(sanitizeJson(openRouterReasoningCache.get(`openrouter-${block.id}`)) as JSONValue[]) || []
|
||||
}
|
||||
}
|
||||
toolCallParts.push({
|
||||
type: 'tool-call',
|
||||
|
||||
@ -6,6 +6,29 @@ import { isDeepSeekHybridInferenceModel } from '../reasoning'
|
||||
import { isFunctionCallingModel } from '../tooluse'
|
||||
import { isPureGenerateImageModel, isTextToImageModel } from '../vision'
|
||||
|
||||
vi.mock('@renderer/i18n', () => ({
|
||||
__esModule: true,
|
||||
default: {
|
||||
t: vi.fn((key: string) => key)
|
||||
}
|
||||
}))
|
||||
|
||||
vi.mock('@renderer/services/AssistantService', () => ({
|
||||
getProviderByModel: vi.fn().mockReturnValue({
|
||||
id: 'openai',
|
||||
type: 'openai',
|
||||
name: 'OpenAI',
|
||||
models: []
|
||||
}),
|
||||
getAssistantSettings: vi.fn(),
|
||||
getDefaultAssistant: vi.fn().mockReturnValue({
|
||||
id: 'default',
|
||||
name: 'Default Assistant',
|
||||
prompt: '',
|
||||
settings: {}
|
||||
})
|
||||
}))
|
||||
|
||||
vi.mock('@renderer/hooks/useStore', () => ({
|
||||
getStoreProviders: vi.fn(() => [])
|
||||
}))
|
||||
|
||||
@ -68,6 +68,29 @@ vi.mock('@renderer/store/settings', () => {
|
||||
)
|
||||
})
|
||||
|
||||
vi.mock('@renderer/i18n', () => ({
|
||||
__esModule: true,
|
||||
default: {
|
||||
t: vi.fn((key: string) => key)
|
||||
}
|
||||
}))
|
||||
|
||||
vi.mock('@renderer/services/AssistantService', () => ({
|
||||
getProviderByModel: vi.fn().mockReturnValue({
|
||||
id: 'openai',
|
||||
type: 'openai',
|
||||
name: 'OpenAI',
|
||||
models: []
|
||||
}),
|
||||
getAssistantSettings: vi.fn(),
|
||||
getDefaultAssistant: vi.fn().mockReturnValue({
|
||||
id: 'default',
|
||||
name: 'Default Assistant',
|
||||
prompt: '',
|
||||
settings: {}
|
||||
})
|
||||
}))
|
||||
|
||||
vi.mock('@renderer/hooks/useSettings', () => ({
|
||||
useSettings: vi.fn(() => ({})),
|
||||
useNavbarPosition: vi.fn(() => ({ navbarPosition: 'left' })),
|
||||
@ -98,6 +121,10 @@ vi.mock('../websearch', () => ({
|
||||
isOpenAIWebSearchChatCompletionOnlyModel: vi.fn()
|
||||
}))
|
||||
|
||||
vi.mock('../tooluse', () => ({
|
||||
isFunctionCallingModel: vi.fn()
|
||||
}))
|
||||
|
||||
const createModel = (overrides: Partial<Model> = {}): Model => ({
|
||||
id: 'gpt-4o',
|
||||
name: 'gpt-4o',
|
||||
@ -125,6 +152,7 @@ describe('model utils', () => {
|
||||
generateImageMock.mockReturnValue(false)
|
||||
reasoningMock.mockReturnValue(false)
|
||||
openAIWebSearchOnlyMock.mockReturnValue(false)
|
||||
isFunctionCallingModelMock.mockReturnValue(true)
|
||||
})
|
||||
|
||||
describe('OpenAI model detection', () => {
|
||||
|
||||
@ -10,6 +10,7 @@ export {
|
||||
SUPPORTED_IMAGE_ENDPOINT_LIST,
|
||||
validateApiHost,
|
||||
withoutTrailingApiVersion,
|
||||
withoutTrailingSharp,
|
||||
withoutTrailingSlash
|
||||
} from '@shared/api'
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user