mirror of
https://github.com/getcompanion-ai/co-mono.git
synced 2026-04-17 10:02:23 +00:00
fix: point auth error messages to docs/authentication.md
This commit is contained in:
parent
9c0c09e1c5
commit
88f184f433
2 changed files with 6 additions and 5 deletions
|
|
@ -14,6 +14,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { readFileSync } from "node:fs";
|
import { readFileSync } from "node:fs";
|
||||||
|
import { join } from "node:path";
|
||||||
import type {
|
import type {
|
||||||
Agent,
|
Agent,
|
||||||
AgentEvent,
|
AgentEvent,
|
||||||
|
|
@ -24,7 +25,7 @@ import type {
|
||||||
} from "@mariozechner/pi-agent-core";
|
} from "@mariozechner/pi-agent-core";
|
||||||
import type { AssistantMessage, ImageContent, Message, Model, TextContent } from "@mariozechner/pi-ai";
|
import type { AssistantMessage, ImageContent, Message, Model, TextContent } from "@mariozechner/pi-ai";
|
||||||
import { isContextOverflow, modelsAreEqual, resetApiProviders, supportsXhigh } from "@mariozechner/pi-ai";
|
import { isContextOverflow, modelsAreEqual, resetApiProviders, supportsXhigh } from "@mariozechner/pi-ai";
|
||||||
import { getAuthPath } from "../config.js";
|
import { getDocsPath } from "../config.js";
|
||||||
import { theme } from "../modes/interactive/theme/theme.js";
|
import { theme } from "../modes/interactive/theme/theme.js";
|
||||||
import { stripFrontmatter } from "../utils/frontmatter.js";
|
import { stripFrontmatter } from "../utils/frontmatter.js";
|
||||||
import { sleep } from "../utils/sleep.js";
|
import { sleep } from "../utils/sleep.js";
|
||||||
|
|
@ -693,7 +694,7 @@ export class AgentSession {
|
||||||
if (!this.model) {
|
if (!this.model) {
|
||||||
throw new Error(
|
throw new Error(
|
||||||
"No model selected.\n\n" +
|
"No model selected.\n\n" +
|
||||||
`Use /login, set an API key environment variable, or create ${getAuthPath()}\n\n` +
|
`Use /login or set an API key environment variable. See ${join(getDocsPath(), "authentication.md")}\n\n` +
|
||||||
"Then use /model to select a model.",
|
"Then use /model to select a model.",
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
@ -711,7 +712,7 @@ export class AgentSession {
|
||||||
}
|
}
|
||||||
throw new Error(
|
throw new Error(
|
||||||
`No API key found for ${this.model.provider}.\n\n` +
|
`No API key found for ${this.model.provider}.\n\n` +
|
||||||
`Use /login, set an API key environment variable, or create ${getAuthPath()}`,
|
`Use /login or set an API key environment variable. See ${join(getDocsPath(), "authentication.md")}`,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
import { join } from "node:path";
|
import { join } from "node:path";
|
||||||
import { Agent, type AgentMessage, type ThinkingLevel } from "@mariozechner/pi-agent-core";
|
import { Agent, type AgentMessage, type ThinkingLevel } from "@mariozechner/pi-agent-core";
|
||||||
import type { Message, Model } from "@mariozechner/pi-ai";
|
import type { Message, Model } from "@mariozechner/pi-ai";
|
||||||
import { getAgentDir, getAuthPath } from "../config.js";
|
import { getAgentDir, getDocsPath } from "../config.js";
|
||||||
import { AgentSession } from "./agent-session.js";
|
import { AgentSession } from "./agent-session.js";
|
||||||
import { AuthStorage } from "./auth-storage.js";
|
import { AuthStorage } from "./auth-storage.js";
|
||||||
import type { ExtensionRunner, LoadExtensionsResult, ToolDefinition } from "./extensions/index.js";
|
import type { ExtensionRunner, LoadExtensionsResult, ToolDefinition } from "./extensions/index.js";
|
||||||
|
|
@ -221,7 +221,7 @@ export async function createAgentSession(options: CreateAgentSessionOptions = {}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// No models available - set message so user knows to /login or configure keys
|
// No models available - set message so user knows to /login or configure keys
|
||||||
modelFallbackMessage = `No models available. Use /login, set an API key environment variable, or create ${getAuthPath()}`;
|
modelFallbackMessage = `No models available. Use /login or set an API key environment variable. See ${join(getDocsPath(), "authentication.md")}`;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue