feat(auth): wire Ollama into auth choice flow
- Add 'ollama' to AuthChoice type - Add Ollama group to auth choice options and prompt - Register Ollama handler in applyAuthChoice - Map ollama auth choice to ollama provider
This commit is contained in:
parent
a4779a3560
commit
1ee0e79618
@ -22,7 +22,8 @@ export type AuthChoiceGroupId =
|
|||||||
| "minimax"
|
| "minimax"
|
||||||
| "synthetic"
|
| "synthetic"
|
||||||
| "venice"
|
| "venice"
|
||||||
| "qwen";
|
| "qwen"
|
||||||
|
| "ollama";
|
||||||
|
|
||||||
export type AuthChoiceGroup = {
|
export type AuthChoiceGroup = {
|
||||||
value: AuthChoiceGroupId;
|
value: AuthChoiceGroupId;
|
||||||
@ -91,6 +92,12 @@ const AUTH_CHOICE_GROUP_DEFS: {
|
|||||||
hint: "API key",
|
hint: "API key",
|
||||||
choices: ["openrouter-api-key"],
|
choices: ["openrouter-api-key"],
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
value: "ollama",
|
||||||
|
label: "Ollama",
|
||||||
|
hint: "Open-source model runner",
|
||||||
|
choices: ["ollama"],
|
||||||
|
},
|
||||||
{
|
{
|
||||||
value: "ai-gateway",
|
value: "ai-gateway",
|
||||||
label: "Vercel AI Gateway",
|
label: "Vercel AI Gateway",
|
||||||
@ -238,6 +245,11 @@ export function buildAuthChoiceOptions(params: {
|
|||||||
label: "MiniMax M2.1 Lightning",
|
label: "MiniMax M2.1 Lightning",
|
||||||
hint: "Faster, higher output cost",
|
hint: "Faster, higher output cost",
|
||||||
});
|
});
|
||||||
|
options.push({
|
||||||
|
value: "ollama",
|
||||||
|
label: "Ollama",
|
||||||
|
hint: "Open-source model runner (llama, qwen, etc.)",
|
||||||
|
});
|
||||||
if (params.includeSkip) {
|
if (params.includeSkip) {
|
||||||
options.push({ value: "skip", label: "Skip for now" });
|
options.push({ value: "skip", label: "Skip for now" });
|
||||||
}
|
}
|
||||||
|
|||||||
@ -44,6 +44,11 @@ export async function promptAuthChoiceGrouped(params: {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Auto-select if there's only one option in the group
|
||||||
|
if (group.options.length === 1) {
|
||||||
|
return group.options[0].value;
|
||||||
|
}
|
||||||
|
|
||||||
const methodSelection = (await params.prompter.select({
|
const methodSelection = (await params.prompter.select({
|
||||||
message: `${group.label} auth method`,
|
message: `${group.label} auth method`,
|
||||||
options: [...group.options, { value: BACK_VALUE, label: "Back" }],
|
options: [...group.options, { value: BACK_VALUE, label: "Back" }],
|
||||||
|
|||||||
@ -9,6 +9,7 @@ import { applyAuthChoiceGoogleAntigravity } from "./auth-choice.apply.google-ant
|
|||||||
import { applyAuthChoiceGoogleGeminiCli } from "./auth-choice.apply.google-gemini-cli.js";
|
import { applyAuthChoiceGoogleGeminiCli } from "./auth-choice.apply.google-gemini-cli.js";
|
||||||
import { applyAuthChoiceMiniMax } from "./auth-choice.apply.minimax.js";
|
import { applyAuthChoiceMiniMax } from "./auth-choice.apply.minimax.js";
|
||||||
import { applyAuthChoiceOAuth } from "./auth-choice.apply.oauth.js";
|
import { applyAuthChoiceOAuth } from "./auth-choice.apply.oauth.js";
|
||||||
|
import { applyAuthChoiceOllama } from "./auth-choice.apply.ollama.js";
|
||||||
import { applyAuthChoiceOpenAI } from "./auth-choice.apply.openai.js";
|
import { applyAuthChoiceOpenAI } from "./auth-choice.apply.openai.js";
|
||||||
import { applyAuthChoiceQwenPortal } from "./auth-choice.apply.qwen-portal.js";
|
import { applyAuthChoiceQwenPortal } from "./auth-choice.apply.qwen-portal.js";
|
||||||
import type { AuthChoice } from "./onboard-types.js";
|
import type { AuthChoice } from "./onboard-types.js";
|
||||||
@ -46,6 +47,7 @@ export async function applyAuthChoice(
|
|||||||
applyAuthChoiceGoogleGeminiCli,
|
applyAuthChoiceGoogleGeminiCli,
|
||||||
applyAuthChoiceCopilotProxy,
|
applyAuthChoiceCopilotProxy,
|
||||||
applyAuthChoiceQwenPortal,
|
applyAuthChoiceQwenPortal,
|
||||||
|
applyAuthChoiceOllama,
|
||||||
];
|
];
|
||||||
|
|
||||||
for (const handler of handlers) {
|
for (const handler of handlers) {
|
||||||
|
|||||||
@ -28,6 +28,7 @@ const PREFERRED_PROVIDER_BY_AUTH_CHOICE: Partial<Record<AuthChoice, string>> = {
|
|||||||
minimax: "lmstudio",
|
minimax: "lmstudio",
|
||||||
"opencode-zen": "opencode",
|
"opencode-zen": "opencode",
|
||||||
"qwen-portal": "qwen-portal",
|
"qwen-portal": "qwen-portal",
|
||||||
|
ollama: "ollama",
|
||||||
};
|
};
|
||||||
|
|
||||||
export function resolvePreferredProviderForAuthChoice(choice: AuthChoice): string | undefined {
|
export function resolvePreferredProviderForAuthChoice(choice: AuthChoice): string | undefined {
|
||||||
|
|||||||
@ -31,6 +31,7 @@ export type AuthChoice =
|
|||||||
| "github-copilot"
|
| "github-copilot"
|
||||||
| "copilot-proxy"
|
| "copilot-proxy"
|
||||||
| "qwen-portal"
|
| "qwen-portal"
|
||||||
|
| "ollama"
|
||||||
| "skip";
|
| "skip";
|
||||||
export type GatewayAuthChoice = "off" | "token" | "password";
|
export type GatewayAuthChoice = "off" | "token" | "password";
|
||||||
export type ResetScope = "config" | "config+creds+sessions" | "full";
|
export type ResetScope = "config" | "config+creds+sessions" | "full";
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user