@sicilianwildcat/aiready 0.1.1 → 0.1.2
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/cli.js +27 -2
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -608,12 +608,37 @@ var OllamaProvider = class {
|
|
|
608
608
|
return response.choices[0]?.message?.content ?? "";
|
|
609
609
|
}
|
|
610
610
|
};
|
|
611
|
+
var NON_CHAT_MODEL_SUBSTRINGS = [
|
|
612
|
+
"codex",
|
|
613
|
+
// coding agent — different API surface
|
|
614
|
+
"image",
|
|
615
|
+
// image generation
|
|
616
|
+
"tts",
|
|
617
|
+
// text to speech
|
|
618
|
+
"transcribe",
|
|
619
|
+
// audio to text
|
|
620
|
+
"whisper",
|
|
621
|
+
// audio transcription
|
|
622
|
+
"computer-use",
|
|
623
|
+
// computer use agent
|
|
624
|
+
"search-preview",
|
|
625
|
+
// search-augmented interface
|
|
626
|
+
"realtime"
|
|
627
|
+
// realtime audio API
|
|
628
|
+
];
|
|
629
|
+
function isChatCompatibleOpenAIModel(id) {
|
|
630
|
+
const isChatFamily = id.startsWith("gpt-") || id.startsWith("o1") || id.startsWith("o3");
|
|
631
|
+
if (!isChatFamily || id.includes(":")) {
|
|
632
|
+
return false;
|
|
633
|
+
}
|
|
634
|
+
return !NON_CHAT_MODEL_SUBSTRINGS.some((s) => id.includes(s));
|
|
635
|
+
}
|
|
611
636
|
async function listOpenAIModels(apiKey) {
|
|
612
637
|
try {
|
|
613
638
|
const baseURL = process.env["OPENAI_BASE_URL"];
|
|
614
639
|
const client = new import_openai.default({ apiKey, ...baseURL ? { baseURL } : {} });
|
|
615
640
|
const response = await client.models.list();
|
|
616
|
-
const chatModels = response.data.filter((m) =>
|
|
641
|
+
const chatModels = response.data.filter((m) => isChatCompatibleOpenAIModel(m.id)).sort((a, b) => b.created - a.created).map((m) => ({ id: m.id, label: m.id }));
|
|
617
642
|
return chatModels.length > 0 ? chatModels : OPENAI_FALLBACK_MODELS;
|
|
618
643
|
} catch {
|
|
619
644
|
return OPENAI_FALLBACK_MODELS;
|
|
@@ -700,7 +725,7 @@ async function promptModelId(provider, apiKey) {
|
|
|
700
725
|
}
|
|
701
726
|
const models = await listOpenAIModels(apiKey);
|
|
702
727
|
return (0, import_prompts.select)({
|
|
703
|
-
message: "Select model:",
|
|
728
|
+
message: "Select model: (chat-compatible models only)",
|
|
704
729
|
choices: models.map((m) => ({ name: m.label, value: m.id }))
|
|
705
730
|
});
|
|
706
731
|
}
|