fix(coding-agent): improve auth setup warnings
This commit is contained in:
25
packages/coding-agent/src/core/auth-guidance.ts
Normal file
25
packages/coding-agent/src/core/auth-guidance.ts
Normal file
@@ -0,0 +1,25 @@
|
||||
import { join } from "node:path";
|
||||
import { getDocsPath } from "../config.js";
|
||||
|
||||
const UNKNOWN_PROVIDER = "unknown";
|
||||
|
||||
export function getProviderLoginHelp(): string {
|
||||
return [
|
||||
"Use /login to log into a provider via OAuth or API key. See:",
|
||||
` ${join(getDocsPath(), "providers.md")}`,
|
||||
` ${join(getDocsPath(), "models.md")}`,
|
||||
].join("\n");
|
||||
}
|
||||
|
||||
export function formatNoModelsAvailableMessage(): string {
|
||||
return `No models available. ${getProviderLoginHelp()}`;
|
||||
}
|
||||
|
||||
export function formatNoModelSelectedMessage(): string {
|
||||
return `No model selected.\n\n${getProviderLoginHelp()}\n\nThen use /model to select a model.`;
|
||||
}
|
||||
|
||||
export function formatNoApiKeyFoundMessage(provider: string): string {
|
||||
const providerDisplay = provider === UNKNOWN_PROVIDER ? "the selected model" : provider;
|
||||
return `No API key found for ${providerDisplay}.\n\n${getProviderLoginHelp()}`;
|
||||
}
|
||||
Reference in New Issue
Block a user