mirror of
https://github.com/jeffusion/gitea-ai-assistant.git
synced 2026-06-02 23:16:43 +00:00
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:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user