Adds dynamic Claude model fetching and management #1
@@ -50,7 +50,6 @@ export class AnthropicClient {
|
|||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('Error generating prompts:', error);
|
console.error('Error generating prompts:', error);
|
||||||
if (error instanceof Error) {
|
if (error instanceof Error) {
|
||||||
new Notice(`Failed to generate prompts: ${error.message}`);
|
|
||||||
throw error;
|
throw error;
|
||||||
}
|
}
|
||||||
|
|
|||||||
throw new Error('Unknown error occurred while generating prompts');
|
throw new Error('Unknown error occurred while generating prompts');
|
||||||
|
|||||||
Reference in new issue
Block a user
⚠️ Potential issue | 🔴 Critical
🧩 Analysis chain
Pagination is not handled for model listing.
The
ModelsListResponseinterface includeshas_more,first_id, andlast_idfields that indicate pagination support, butfetchModels()only retrieves the first page of results. If Anthropic returns more than one page of models, subsequent pages are silently ignored.Verify whether pagination is needed:
If pagination is required, consider implementing it or documenting the limitation. Otherwise, if all Claude models fit in a single page, add a comment explaining why pagination isn't needed.
🏁 Script executed:
Length of output: 128
I'll verify whether pagination is actually used or documented elsewhere in the codebase.
Length of output: 1321
🏁 Script executed:
Length of output: 2163
🌐 Web query:
💡 Result:
By default the List Models endpoint returns 20 models per page. You can set the query param limit to any integer 1–1000 to change this. Pagination uses before_id / after_id with has_more, first_id and last_id in the response. [1]
Implement pagination in
fetchModels()or document why it's not needed.Verification confirms the issue: The
ModelsListResponseinterface includes pagination fields, but the implementation only retrieves the first page. Anthropic's models API endpoint returns 20 models per page by default, and pagination fields are never used anywhere in the codebase. If Anthropic returns more than 20 models, subsequent pages are silently ignored.Either:
has_more,last_id)🤖 Prompt for AI Agents
✅ Addressed in commits
e96ef65toee7faef