refactor: remove HIDDEN_ROUTER_MODELS workaround for openrouter/auto
The openrouter/auto model now works correctly after fixing the double-prefix bug. Remove the workaround that hid it from model selection lists. Users can now manually select openrouter/auto in the model picker. Co-Authored-By: Claude Sonnet 4.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
77f6133351
commit
455c2c2e3a
@ -34,7 +34,7 @@ vi.mock("../agents/model-auth.js", () => ({
|
|||||||
}));
|
}));
|
||||||
|
|
||||||
describe("promptDefaultModel", () => {
|
describe("promptDefaultModel", () => {
|
||||||
it("filters internal router models from the selection list", async () => {
|
it("includes openrouter/auto in the selection list", async () => {
|
||||||
loadModelCatalog.mockResolvedValue([
|
loadModelCatalog.mockResolvedValue([
|
||||||
{
|
{
|
||||||
provider: "openrouter",
|
provider: "openrouter",
|
||||||
@ -64,15 +64,17 @@ describe("promptDefaultModel", () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
const options = select.mock.calls[0]?.[0]?.options ?? [];
|
const options = select.mock.calls[0]?.[0]?.options ?? [];
|
||||||
expect(options.some((opt) => opt.value === "openrouter/auto")).toBe(false);
|
expect(options.some((opt: { value: string }) => opt.value === "openrouter/auto")).toBe(true);
|
||||||
expect(options.some((opt) => opt.value === "openrouter/meta-llama/llama-3.3-70b:free")).toBe(
|
expect(
|
||||||
true,
|
options.some(
|
||||||
);
|
(opt: { value: string }) => opt.value === "openrouter/meta-llama/llama-3.3-70b:free",
|
||||||
|
),
|
||||||
|
).toBe(true);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe("promptModelAllowlist", () => {
|
describe("promptModelAllowlist", () => {
|
||||||
it("filters internal router models from the selection list", async () => {
|
it("includes openrouter/auto in the selection list", async () => {
|
||||||
loadModelCatalog.mockResolvedValue([
|
loadModelCatalog.mockResolvedValue([
|
||||||
{
|
{
|
||||||
provider: "openrouter",
|
provider: "openrouter",
|
||||||
@ -95,7 +97,7 @@ describe("promptModelAllowlist", () => {
|
|||||||
await promptModelAllowlist({ config, prompter });
|
await promptModelAllowlist({ config, prompter });
|
||||||
|
|
||||||
const options = multiselect.mock.calls[0]?.[0]?.options ?? [];
|
const options = multiselect.mock.calls[0]?.[0]?.options ?? [];
|
||||||
expect(options.some((opt: { value: string }) => opt.value === "openrouter/auto")).toBe(false);
|
expect(options.some((opt: { value: string }) => opt.value === "openrouter/auto")).toBe(true);
|
||||||
expect(
|
expect(
|
||||||
options.some(
|
options.some(
|
||||||
(opt: { value: string }) => opt.value === "openrouter/meta-llama/llama-3.3-70b:free",
|
(opt: { value: string }) => opt.value === "openrouter/meta-llama/llama-3.3-70b:free",
|
||||||
|
|||||||
@ -17,11 +17,6 @@ const KEEP_VALUE = "__keep__";
|
|||||||
const MANUAL_VALUE = "__manual__";
|
const MANUAL_VALUE = "__manual__";
|
||||||
const PROVIDER_FILTER_THRESHOLD = 30;
|
const PROVIDER_FILTER_THRESHOLD = 30;
|
||||||
|
|
||||||
// Models that are internal routing features and should not be shown in selection lists.
|
|
||||||
// These may be valid as defaults (e.g., set automatically during auth flow) but are not
|
|
||||||
// directly callable via API and would cause "Unknown model" errors if selected manually.
|
|
||||||
const HIDDEN_ROUTER_MODELS = new Set(["openrouter/auto"]);
|
|
||||||
|
|
||||||
type PromptDefaultModelParams = {
|
type PromptDefaultModelParams = {
|
||||||
config: ClawdbotConfig;
|
config: ClawdbotConfig;
|
||||||
prompter: WizardPrompter;
|
prompter: WizardPrompter;
|
||||||
@ -208,8 +203,6 @@ export async function promptDefaultModel(
|
|||||||
}) => {
|
}) => {
|
||||||
const key = modelKey(entry.provider, entry.id);
|
const key = modelKey(entry.provider, entry.id);
|
||||||
if (seen.has(key)) return;
|
if (seen.has(key)) return;
|
||||||
// Skip internal router models that can't be directly called via API.
|
|
||||||
if (HIDDEN_ROUTER_MODELS.has(key)) return;
|
|
||||||
const hints: string[] = [];
|
const hints: string[] = [];
|
||||||
if (entry.name && entry.name !== entry.id) hints.push(entry.name);
|
if (entry.name && entry.name !== entry.id) hints.push(entry.name);
|
||||||
if (entry.contextWindow) hints.push(`ctx ${formatTokenK(entry.contextWindow)}`);
|
if (entry.contextWindow) hints.push(`ctx ${formatTokenK(entry.contextWindow)}`);
|
||||||
@ -336,7 +329,6 @@ export async function promptModelAllowlist(params: {
|
|||||||
}) => {
|
}) => {
|
||||||
const key = modelKey(entry.provider, entry.id);
|
const key = modelKey(entry.provider, entry.id);
|
||||||
if (seen.has(key)) return;
|
if (seen.has(key)) return;
|
||||||
if (HIDDEN_ROUTER_MODELS.has(key)) return;
|
|
||||||
const hints: string[] = [];
|
const hints: string[] = [];
|
||||||
if (entry.name && entry.name !== entry.id) hints.push(entry.name);
|
if (entry.name && entry.name !== entry.id) hints.push(entry.name);
|
||||||
if (entry.contextWindow) hints.push(`ctx ${formatTokenK(entry.contextWindow)}`);
|
if (entry.contextWindow) hints.push(`ctx ${formatTokenK(entry.contextWindow)}`);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user