refactor(ui): use tokenlens as sole model source, remove provider listModels

Remove the per-provider listModels API (GET /providers/:id/models) and all
four provider implementations (OpenAI Compatible, OpenAI Responses, Anthropic,
Gemini). ModelCombobox now only shows tokenlens suggestions (tagged '推荐') plus
free-form custom input — no more unfiltered 'API' models from provider SDKs.

Fixes: switching provider type in ProviderDialog no longer shows stale models
from the original provider's API.

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode)
This commit is contained in:
jeffusion
2026-03-05 23:18:33 +08:00
committed by 路遥知码力
parent 71bd310459
commit fdfd49be63
12 changed files with 29 additions and 125 deletions

View File

@@ -55,29 +55,6 @@ llmConfigRouter.get('/providers/:id', (c) => {
});
});
llmConfigRouter.get('/providers/:id/models', async (c) => {
const id = c.req.param('id');
const provider = providerRepo.getById(id);
if (!provider) return c.json({ message: 'Provider not found' }, 404);
if (!secretRepo.has(id)) {
return c.json({ message: 'No API key configured' }, 400);
}
try {
llmGateway.invalidateProvider(id);
const providerInstance = llmGateway.getProviderInstance(id);
if (!providerInstance.listModels) {
return c.json({ message: 'This provider does not support listing models' }, 501);
}
const models = await providerInstance.listModels();
return c.json({ models });
} catch (error: any) {
return c.json({ message: error.message || 'Failed to fetch models' }, 500);
}
});
llmConfigRouter.post('/providers', async (c) => {
const body = await c.req.json<{
name: string;