Adds dynamic Claude model fetching and management #1
@@ -217,9 +217,14 @@ export class AnthropicClient {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Sort models for stable dropdown UX across sessions/pages
|
||||||
|
const sorted = allModels.slice().sort((a, b) =>
|
||||||
|
(a.display_name ?? a.id).localeCompare(b.display_name ?? b.id)
|
||||||
|
);
|
||||||
|
|
||||||
// Return combined response with all models
|
// Return combined response with all models
|
||||||
return {
|
return {
|
||||||
data: allModels,
|
data: sorted,
|
||||||
first_id: firstId,
|
first_id: firstId,
|
||||||
has_more: false, // We've fetched all pages
|
has_more: false, // We've fetched all pages
|
||||||
last_id: lastId
|
last_id: lastId
|
||||||
@@ -320,8 +325,8 @@ export class AnthropicClient {
|
|||||||
const prompts: string[] = [];
|
const prompts: string[] = [];
|
||||||
|
|
||||||
for (const line of lines) {
|
for (const line of lines) {
|
||||||
// Remove numbering (1., 2., etc.) and clean up the prompt
|
// Remove list prefixes: numbered (1., 1)), bullets (-, *, •)
|
||||||
const cleaned = line.replace(/^\d+\.\s*/, '').trim();
|
const cleaned = line.replace(/^\s*(?:\d+[.)]|[-*•])\s*/, '').trim();
|
||||||
if (cleaned.length > 0) {
|
if (cleaned.length > 0) {
|
||||||
prompts.push(cleaned);
|
prompts.push(cleaned);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user