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"
|
||||
| "synthetic"
|
||||
| "venice"
|
||||
| "qwen";
|
||||
| "qwen"
|
||||
| "ollama";
|
||||
|
||||
export type AuthChoiceGroup = {
|
||||
value: AuthChoiceGroupId;
|
||||
@ -91,6 +92,12 @@ const AUTH_CHOICE_GROUP_DEFS: {
|
||||
hint: "API key",
|
||||
choices: ["openrouter-api-key"],
|
||||
},
|
||||
{
|
||||
value: "ollama",
|
||||
label: "Ollama",
|
||||
hint: "Open-source model runner",
|
||||
choices: ["ollama"],
|
||||
},
|
||||
{
|
||||
value: "ai-gateway",
|
||||
label: "Vercel AI Gateway",
|
||||
@ -238,6 +245,11 @@ export function buildAuthChoiceOptions(params: {
|
||||
label: "MiniMax M2.1 Lightning",
|
||||
hint: "Faster, higher output cost",
|
||||
});
|
||||
options.push({
|
||||
value: "ollama",
|
||||
label: "Ollama",
|
||||
hint: "Open-source model runner (llama, qwen, etc.)",
|
||||
});
|
||||
if (params.includeSkip) {
|
||||
options.push({ value: "skip", label: "Skip for now" });
|
||||
}
|
||||
|
||||
@ -44,6 +44,11 @@ export async function promptAuthChoiceGrouped(params: {
|
||||
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({
|
||||
message: `${group.label} auth method`,
|
||||
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 { applyAuthChoiceMiniMax } from "./auth-choice.apply.minimax.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 { applyAuthChoiceQwenPortal } from "./auth-choice.apply.qwen-portal.js";
|
||||
import type { AuthChoice } from "./onboard-types.js";
|
||||
@ -46,6 +47,7 @@ export async function applyAuthChoice(
|
||||
applyAuthChoiceGoogleGeminiCli,
|
||||
applyAuthChoiceCopilotProxy,
|
||||
applyAuthChoiceQwenPortal,
|
||||
applyAuthChoiceOllama,
|
||||
];
|
||||
|
||||
for (const handler of handlers) {
|
||||
|
||||
@ -28,6 +28,7 @@ const PREFERRED_PROVIDER_BY_AUTH_CHOICE: Partial<Record<AuthChoice, string>> = {
|
||||
minimax: "lmstudio",
|
||||
"opencode-zen": "opencode",
|
||||
"qwen-portal": "qwen-portal",
|
||||
ollama: "ollama",
|
||||
};
|
||||
|
||||
export function resolvePreferredProviderForAuthChoice(choice: AuthChoice): string | undefined {
|
||||
|
||||
@ -31,6 +31,7 @@ export type AuthChoice =
|
||||
| "github-copilot"
|
||||
| "copilot-proxy"
|
||||
| "qwen-portal"
|
||||
| "ollama"
|
||||
| "skip";
|
||||
export type GatewayAuthChoice = "off" | "token" | "password";
|
||||
export type ResetScope = "config" | "config+creds+sessions" | "full";
|
||||
|
||||
Loading…
Reference in New Issue
Block a user