mirror of
https://github.com/CherryHQ/cherry-studio.git
synced 2026-01-09 14:59:27 +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}`)) {
|
if (openRouterReasoningCache.get(`openrouter-${block.id}`)) {
|
||||||
options.openrouter = {
|
options.openrouter = {
|
||||||
reasoning_details: (sanitizeJson(openRouterReasoningCache.get(`openrouter-${block.id}`)) as JSONValue[]) || []
|
reasoning_details:
|
||||||
}
|
(sanitizeJson(openRouterReasoningCache.get(`openrouter-${block.id}`)) as JSONValue[]) || []
|
||||||
|
}
|
||||||
}
|
}
|
||||||
toolCallParts.push({
|
toolCallParts.push({
|
||||||
type: 'tool-call',
|
type: 'tool-call',
|
||||||
|
|||||||
@ -6,6 +6,29 @@ import { isDeepSeekHybridInferenceModel } from '../reasoning'
|
|||||||
import { isFunctionCallingModel } from '../tooluse'
|
import { isFunctionCallingModel } from '../tooluse'
|
||||||
import { isPureGenerateImageModel, isTextToImageModel } from '../vision'
|
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', () => ({
|
vi.mock('@renderer/hooks/useStore', () => ({
|
||||||
getStoreProviders: vi.fn(() => [])
|
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', () => ({
|
vi.mock('@renderer/hooks/useSettings', () => ({
|
||||||
useSettings: vi.fn(() => ({})),
|
useSettings: vi.fn(() => ({})),
|
||||||
useNavbarPosition: vi.fn(() => ({ navbarPosition: 'left' })),
|
useNavbarPosition: vi.fn(() => ({ navbarPosition: 'left' })),
|
||||||
@ -98,6 +121,10 @@ vi.mock('../websearch', () => ({
|
|||||||
isOpenAIWebSearchChatCompletionOnlyModel: vi.fn()
|
isOpenAIWebSearchChatCompletionOnlyModel: vi.fn()
|
||||||
}))
|
}))
|
||||||
|
|
||||||
|
vi.mock('../tooluse', () => ({
|
||||||
|
isFunctionCallingModel: vi.fn()
|
||||||
|
}))
|
||||||
|
|
||||||
const createModel = (overrides: Partial<Model> = {}): Model => ({
|
const createModel = (overrides: Partial<Model> = {}): Model => ({
|
||||||
id: 'gpt-4o',
|
id: 'gpt-4o',
|
||||||
name: 'gpt-4o',
|
name: 'gpt-4o',
|
||||||
@ -125,6 +152,7 @@ describe('model utils', () => {
|
|||||||
generateImageMock.mockReturnValue(false)
|
generateImageMock.mockReturnValue(false)
|
||||||
reasoningMock.mockReturnValue(false)
|
reasoningMock.mockReturnValue(false)
|
||||||
openAIWebSearchOnlyMock.mockReturnValue(false)
|
openAIWebSearchOnlyMock.mockReturnValue(false)
|
||||||
|
isFunctionCallingModelMock.mockReturnValue(true)
|
||||||
})
|
})
|
||||||
|
|
||||||
describe('OpenAI model detection', () => {
|
describe('OpenAI model detection', () => {
|
||||||
|
|||||||
@ -10,6 +10,7 @@ export {
|
|||||||
SUPPORTED_IMAGE_ENDPOINT_LIST,
|
SUPPORTED_IMAGE_ENDPOINT_LIST,
|
||||||
validateApiHost,
|
validateApiHost,
|
||||||
withoutTrailingApiVersion,
|
withoutTrailingApiVersion,
|
||||||
|
withoutTrailingSharp,
|
||||||
withoutTrailingSlash
|
withoutTrailingSlash
|
||||||
} from '@shared/api'
|
} from '@shared/api'
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user