mirror of
https://wget.la/https://github.com/Wxw-Gu/WechatExplorer
synced 2026-10-08 07:21:19 +08:00
fix: 增加thinking disabled
修改退群监控模板 定时日报保存日报历史
This commit is contained in:
@@ -37,6 +37,44 @@ const provider = (id: string, modelId: string, vision: boolean): AIProviderConfi
|
||||
describe('AI provider vision routing', () => {
|
||||
afterAll(() => rmSync(root, { recursive: true, force: true }))
|
||||
|
||||
it('sends the disabled thinking control only when it is selected', async () => {
|
||||
const service = new AIProviderService()
|
||||
const configured = provider('thinking-provider', 'deepseek-v4-flash-vision-exp', false)
|
||||
configured.advanced.thinking = 'disabled'
|
||||
expect(service.save(configured).success).toBe(true)
|
||||
expect(service.setDefault(configured.id).success).toBe(true)
|
||||
|
||||
const fetchMock = vi
|
||||
.fn()
|
||||
.mockResolvedValue(
|
||||
new Response(
|
||||
JSON.stringify({ choices: [{ message: { content: 'ok' }, finish_reason: 'stop' }] }),
|
||||
{ headers: { 'content-type': 'application/json' } }
|
||||
)
|
||||
)
|
||||
vi.stubGlobal('fetch', fetchMock)
|
||||
try {
|
||||
const result = await service.chat([{ role: 'user', content: 'hello' }])
|
||||
expect(result).toMatchObject({ success: true, data: 'ok', finishReason: 'stop' })
|
||||
const body = JSON.parse(fetchMock.mock.calls[0][1].body as string) as Record<string, unknown>
|
||||
expect(body).toMatchObject({
|
||||
model: 'deepseek-v4-flash-vision-exp',
|
||||
thinking: { type: 'disabled' }
|
||||
})
|
||||
|
||||
configured.advanced.thinking = 'default'
|
||||
expect(service.save(configured).success).toBe(true)
|
||||
await service.chat([{ role: 'user', content: 'hello' }])
|
||||
const defaultBody = JSON.parse(fetchMock.mock.calls[1][1].body as string) as Record<
|
||||
string,
|
||||
unknown
|
||||
>
|
||||
expect(defaultBody).not.toHaveProperty('thinking')
|
||||
} finally {
|
||||
vi.unstubAllGlobals()
|
||||
}
|
||||
})
|
||||
|
||||
it('keeps DeepSeek as the text model while routing images to a verified vision model', () => {
|
||||
const service = new AIProviderService()
|
||||
expect(service.save(provider('deepseek', 'deepseek-chat', false)).success).toBe(true)
|
||||
|
||||
Reference in New Issue
Block a user