refactor(api): LLM 提供商管理调用适配后端通用 manage 接口

- manage.ts 扩展 manageLlmProvider,端点联合类型纳入 llm/manage
- useLlmProviderDirectory 的目录/模型查询、授权启动/轮询/断开
  全部改走 POST /llm/manage(target+action+params 透传)
- 系统设置页 LLM 测试调用改走 manage,provider 字段转为 target
- 同步更新 composable 与系统设置页测试断言(GET mock 转 POST)
This commit is contained in:
jxxghp
2026-08-16 07:50:39 +08:00
parent f8f43058c5
commit b65682da53
5 changed files with 54 additions and 37 deletions
@@ -445,20 +445,23 @@ describe('AccountSettingSystem', () => {
await fireEvent.click(testLlm)
await waitFor(() => expect(mocks.toastError).toHaveBeenCalledWith('LLM 调用测试失败:provider rejected'))
const firstCall = mocks.apiPost.mock.calls[0]
expect(firstCall?.[0]).toBe('llm/test')
expect(firstCall?.[0]).toBe('llm/manage')
expect(firstCall?.[1]).toEqual({
api_key: 'secret-key',
api_protocol: 'responses',
base_url: 'https://llm.example/v1',
base_url_preset: 'custom',
enabled: true,
model: 'gpt-5',
provider: 'openai',
thinking_level: 'high',
temperature: 0.7,
use_proxy: false,
user_agent: 'MoviePilot-Test',
web_search_mode: 'builtin',
target: 'openai',
action: 'test',
params: {
api_key: 'secret-key',
api_protocol: 'responses',
base_url: 'https://llm.example/v1',
base_url_preset: 'custom',
enabled: true,
model: 'gpt-5',
thinking_level: 'high',
temperature: 0.7,
use_proxy: false,
user_agent: 'MoviePilot-Test',
web_search_mode: 'builtin',
},
})
expect(firstCall?.[2]).toEqual({ signal: expect.any(AbortSignal) })
expect(testLlm).toBeEnabled()