mirror of
https://github.com/openclaw/openclaw.git
synced 2026-02-19 18:39:20 -05:00
feat: switch anthropic onboarding defaults to sonnet
This commit is contained in:
@@ -6,8 +6,11 @@ import {
|
||||
} from "./auth-choice.api-key.js";
|
||||
import type { ApplyAuthChoiceParams, ApplyAuthChoiceResult } from "./auth-choice.apply.js";
|
||||
import { buildTokenProfileId, validateAnthropicSetupToken } from "./auth-token.js";
|
||||
import { applyAgentDefaultModelPrimary } from "./onboard-auth.config-shared.js";
|
||||
import { applyAuthProfileConfig, setAnthropicApiKey } from "./onboard-auth.js";
|
||||
|
||||
const DEFAULT_ANTHROPIC_MODEL = "anthropic/claude-sonnet-4-6";
|
||||
|
||||
export async function applyAuthChoiceAnthropic(
|
||||
params: ApplyAuthChoiceParams,
|
||||
): Promise<ApplyAuthChoiceResult | null> {
|
||||
@@ -55,6 +58,9 @@ export async function applyAuthChoiceAnthropic(
|
||||
provider,
|
||||
mode: "token",
|
||||
});
|
||||
if (params.setDefaultModel) {
|
||||
nextConfig = applyAgentDefaultModelPrimary(nextConfig, DEFAULT_ANTHROPIC_MODEL);
|
||||
}
|
||||
return { config: nextConfig };
|
||||
}
|
||||
|
||||
@@ -94,6 +100,9 @@ export async function applyAuthChoiceAnthropic(
|
||||
provider: "anthropic",
|
||||
mode: "api_key",
|
||||
});
|
||||
if (params.setDefaultModel) {
|
||||
nextConfig = applyAgentDefaultModelPrimary(nextConfig, DEFAULT_ANTHROPIC_MODEL);
|
||||
}
|
||||
return { config: nextConfig };
|
||||
}
|
||||
|
||||
|
||||
@@ -29,8 +29,8 @@ function sanitizeTokenValue(value: string | undefined): string | undefined {
|
||||
}
|
||||
|
||||
const ANTHROPIC_OAUTH_MODEL_KEYS = [
|
||||
"anthropic/claude-opus-4-6",
|
||||
"anthropic/claude-sonnet-4-6",
|
||||
"anthropic/claude-opus-4-6",
|
||||
"anthropic/claude-opus-4-5",
|
||||
"anthropic/claude-sonnet-4-5",
|
||||
"anthropic/claude-haiku-4-5",
|
||||
@@ -121,7 +121,7 @@ export async function promptAuthConfig(
|
||||
config: next,
|
||||
prompter,
|
||||
allowedKeys: anthropicOAuth ? ANTHROPIC_OAUTH_MODEL_KEYS : undefined,
|
||||
initialSelections: anthropicOAuth ? ["anthropic/claude-opus-4-6"] : undefined,
|
||||
initialSelections: anthropicOAuth ? ["anthropic/claude-sonnet-4-6"] : undefined,
|
||||
message: anthropicOAuth ? "Anthropic OAuth models" : undefined,
|
||||
});
|
||||
if (allowlistSelection.models) {
|
||||
|
||||
@@ -151,6 +151,14 @@ function addModelSelectOption(params: {
|
||||
params.seen.add(key);
|
||||
}
|
||||
|
||||
function isAnthropicLegacyModel(entry: { provider: string; id: string }): boolean {
|
||||
return (
|
||||
entry.provider === "anthropic" &&
|
||||
typeof entry.id === "string" &&
|
||||
entry.id.toLowerCase().startsWith("claude-3")
|
||||
);
|
||||
}
|
||||
|
||||
async function promptManualModel(params: {
|
||||
prompter: WizardPrompter;
|
||||
allowBlank: boolean;
|
||||
@@ -251,6 +259,9 @@ export async function promptDefaultModel(
|
||||
|
||||
if (hasPreferredProvider && preferredProvider) {
|
||||
models = models.filter((entry) => entry.provider === preferredProvider);
|
||||
if (preferredProvider === "anthropic") {
|
||||
models = models.filter((entry) => !isAnthropicLegacyModel(entry));
|
||||
}
|
||||
}
|
||||
|
||||
const agentDir = params.agentDir;
|
||||
|
||||
Reference in New Issue
Block a user