claudish 4.6.4 → 4.6.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +58 -24
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -31575,23 +31575,39 @@ async function getFreeModels() {
|
|
|
31575
31575
|
async function getAllModelsForSearch() {
|
|
31576
31576
|
const litellmBaseUrl = process.env.LITELLM_BASE_URL;
|
|
31577
31577
|
const litellmApiKey = process.env.LITELLM_API_KEY;
|
|
31578
|
-
const
|
|
31579
|
-
fetchAllModels().then((models) => models.map(toModelInfo)),
|
|
31580
|
-
fetchXAIModels(),
|
|
31581
|
-
fetchGeminiModels(),
|
|
31582
|
-
fetchOpenAIModels(),
|
|
31583
|
-
fetchGLMDirectModels(),
|
|
31584
|
-
fetchGLMCodingModels(),
|
|
31585
|
-
fetchOllamaCloudModels(),
|
|
31586
|
-
fetchZenFreeModels()
|
|
31578
|
+
const fetchEntries = [
|
|
31579
|
+
{ name: "OpenRouter", promise: fetchAllModels().then((models) => models.map(toModelInfo)) },
|
|
31580
|
+
{ name: "xAI", promise: fetchXAIModels() },
|
|
31581
|
+
{ name: "Gemini", promise: fetchGeminiModels() },
|
|
31582
|
+
{ name: "OpenAI", promise: fetchOpenAIModels() },
|
|
31583
|
+
{ name: "GLM", promise: fetchGLMDirectModels() },
|
|
31584
|
+
{ name: "GLM Coding", promise: fetchGLMCodingModels() },
|
|
31585
|
+
{ name: "OllamaCloud", promise: fetchOllamaCloudModels() },
|
|
31586
|
+
{ name: "Zen", promise: fetchZenFreeModels() }
|
|
31587
31587
|
];
|
|
31588
31588
|
if (litellmBaseUrl && litellmApiKey) {
|
|
31589
|
-
|
|
31590
|
-
}
|
|
31591
|
-
const
|
|
31592
|
-
const
|
|
31593
|
-
|
|
31594
|
-
|
|
31589
|
+
fetchEntries.push({ name: "LiteLLM", promise: fetchLiteLLMModels(litellmBaseUrl, litellmApiKey) });
|
|
31590
|
+
}
|
|
31591
|
+
const settled = await Promise.allSettled(fetchEntries.map((e) => e.promise));
|
|
31592
|
+
const fetchResults = {};
|
|
31593
|
+
for (let i = 0;i < settled.length; i++) {
|
|
31594
|
+
const result = settled[i];
|
|
31595
|
+
fetchResults[fetchEntries[i].name] = result.status === "fulfilled" ? result.value : [];
|
|
31596
|
+
}
|
|
31597
|
+
const directApiModels = [
|
|
31598
|
+
...fetchResults["xAI"],
|
|
31599
|
+
...fetchResults["Gemini"],
|
|
31600
|
+
...fetchResults["OpenAI"],
|
|
31601
|
+
...fetchResults["GLM"],
|
|
31602
|
+
...fetchResults["GLM Coding"]
|
|
31603
|
+
];
|
|
31604
|
+
const allModels = [
|
|
31605
|
+
...fetchResults["Zen"],
|
|
31606
|
+
...fetchResults["OllamaCloud"],
|
|
31607
|
+
...directApiModels,
|
|
31608
|
+
...fetchResults["LiteLLM"] || [],
|
|
31609
|
+
...fetchResults["OpenRouter"]
|
|
31610
|
+
];
|
|
31595
31611
|
return allModels;
|
|
31596
31612
|
}
|
|
31597
31613
|
function formatModelChoice(model, showSource = false) {
|
|
@@ -31709,25 +31725,43 @@ async function selectModel(options = {}) {
|
|
|
31709
31725
|
}
|
|
31710
31726
|
}
|
|
31711
31727
|
}
|
|
31712
|
-
const
|
|
31713
|
-
const
|
|
31714
|
-
|
|
31715
|
-
|
|
31716
|
-
|
|
31717
|
-
|
|
31728
|
+
const providerCounts = new Map;
|
|
31729
|
+
for (const m of models) {
|
|
31730
|
+
if (m.source) {
|
|
31731
|
+
providerCounts.set(m.source, (providerCounts.get(m.source) || 0) + 1);
|
|
31732
|
+
}
|
|
31733
|
+
}
|
|
31734
|
+
let filteredModels = models;
|
|
31735
|
+
if (!freeOnly && !message && providerCounts.size > 1) {
|
|
31736
|
+
const providerChoices = [
|
|
31737
|
+
{ name: `All providers (${models.length} models)`, value: "__all__" },
|
|
31738
|
+
...Array.from(providerCounts.entries()).sort((a, b) => b[1] - a[1]).map(([source, count]) => ({
|
|
31739
|
+
name: `${source} (${count})`,
|
|
31740
|
+
value: source
|
|
31741
|
+
}))
|
|
31742
|
+
];
|
|
31743
|
+
const selectedProvider = await dist_default5({
|
|
31744
|
+
message: "Filter by provider:",
|
|
31745
|
+
choices: providerChoices
|
|
31746
|
+
});
|
|
31747
|
+
if (selectedProvider !== "__all__") {
|
|
31748
|
+
filteredModels = models.filter((m) => m.source === selectedProvider);
|
|
31749
|
+
}
|
|
31750
|
+
}
|
|
31751
|
+
const promptMessage = message || (freeOnly ? "Select a FREE model:" : "Select a model (type to search):");
|
|
31718
31752
|
const selected = await dist_default4({
|
|
31719
31753
|
message: promptMessage,
|
|
31720
31754
|
pageSize: 20,
|
|
31721
31755
|
source: async (term) => {
|
|
31722
31756
|
if (!term) {
|
|
31723
|
-
return
|
|
31757
|
+
return filteredModels.slice(0, 30).map((m) => ({
|
|
31724
31758
|
name: formatModelChoice(m, true),
|
|
31725
31759
|
value: m.id,
|
|
31726
31760
|
description: m.description?.slice(0, 80)
|
|
31727
31761
|
}));
|
|
31728
31762
|
}
|
|
31729
31763
|
const { provider: filterProvider, searchTerm } = parseProviderFilter(term);
|
|
31730
|
-
let pool =
|
|
31764
|
+
let pool = filteredModels;
|
|
31731
31765
|
if (filterProvider) {
|
|
31732
31766
|
pool = models.filter((m) => m.source === filterProvider);
|
|
31733
31767
|
}
|
|
@@ -34856,7 +34890,7 @@ async function fetchGLMCodingModels2() {
|
|
|
34856
34890
|
return [];
|
|
34857
34891
|
}
|
|
34858
34892
|
}
|
|
34859
|
-
var __filename5, __dirname5, VERSION = "4.6.
|
|
34893
|
+
var __filename5, __dirname5, VERSION = "4.6.6", CACHE_MAX_AGE_DAYS3 = 2, MODELS_JSON_PATH, CLAUDISH_CACHE_DIR3, ALL_MODELS_JSON_PATH2;
|
|
34860
34894
|
var init_cli = __esm(() => {
|
|
34861
34895
|
init_config();
|
|
34862
34896
|
init_model_loader();
|