fix: 增加thinking disabled

修改退群监控模板
定时日报保存日报历史
This commit is contained in:
Wxw-Gu
2026-09-01 11:40:14 +08:00
parent 25b72c3d76
commit 1c8bbae1f0
21 changed files with 343 additions and 34 deletions
@@ -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)