mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-10 16:14:58 +00:00
Onboard: move volcengine/byteplus auth from .env to profiles
This commit is contained in:
committed by
Peter Steinberger
parent
2ef109f00a
commit
59e5f12bf9
@@ -1,5 +1,4 @@
|
||||
import { resolveEnvApiKey } from "../agents/model-auth.js";
|
||||
import { upsertSharedEnvVar } from "../infra/env-file.js";
|
||||
import {
|
||||
formatApiKeyPreview,
|
||||
normalizeApiKeyInput,
|
||||
@@ -7,6 +6,7 @@ import {
|
||||
} from "./auth-choice.api-key.js";
|
||||
import type { ApplyAuthChoiceParams, ApplyAuthChoiceResult } from "./auth-choice.apply.js";
|
||||
import { applyPrimaryModel } from "./model-picker.js";
|
||||
import { applyAuthProfileConfig, setVolcengineApiKey } from "./onboard-auth.js";
|
||||
|
||||
/** Default model for Volcano Engine auth onboarding. */
|
||||
export const VOLCENGINE_DEFAULT_MODEL = "volcengine-plan/ark-code-latest";
|
||||
@@ -25,18 +25,13 @@ export async function applyAuthChoiceVolcengine(
|
||||
initialValue: true,
|
||||
});
|
||||
if (useExisting) {
|
||||
const result = upsertSharedEnvVar({
|
||||
key: "VOLCANO_ENGINE_API_KEY",
|
||||
value: envKey.apiKey,
|
||||
await setVolcengineApiKey(envKey.apiKey, params.agentDir);
|
||||
const configWithAuth = applyAuthProfileConfig(params.config, {
|
||||
profileId: "volcengine:default",
|
||||
provider: "volcengine",
|
||||
mode: "api_key",
|
||||
});
|
||||
if (!process.env.VOLCANO_ENGINE_API_KEY) {
|
||||
process.env.VOLCANO_ENGINE_API_KEY = envKey.apiKey;
|
||||
}
|
||||
await params.prompter.note(
|
||||
`Copied VOLCANO_ENGINE_API_KEY to ${result.path} for launchd compatibility.`,
|
||||
"Volcano Engine API Key",
|
||||
);
|
||||
const configWithModel = applyPrimaryModel(params.config, VOLCENGINE_DEFAULT_MODEL);
|
||||
const configWithModel = applyPrimaryModel(configWithAuth, VOLCENGINE_DEFAULT_MODEL);
|
||||
return {
|
||||
config: configWithModel,
|
||||
agentModelOverride: VOLCENGINE_DEFAULT_MODEL,
|
||||
@@ -55,17 +50,13 @@ export async function applyAuthChoiceVolcengine(
|
||||
}
|
||||
|
||||
const trimmed = normalizeApiKeyInput(String(key));
|
||||
const result = upsertSharedEnvVar({
|
||||
key: "VOLCANO_ENGINE_API_KEY",
|
||||
value: trimmed,
|
||||
await setVolcengineApiKey(trimmed, params.agentDir);
|
||||
const configWithAuth = applyAuthProfileConfig(params.config, {
|
||||
profileId: "volcengine:default",
|
||||
provider: "volcengine",
|
||||
mode: "api_key",
|
||||
});
|
||||
process.env.VOLCANO_ENGINE_API_KEY = trimmed;
|
||||
await params.prompter.note(
|
||||
`Saved VOLCANO_ENGINE_API_KEY to ${result.path} for launchd compatibility.`,
|
||||
"Volcano Engine API Key",
|
||||
);
|
||||
|
||||
const configWithModel = applyPrimaryModel(params.config, VOLCENGINE_DEFAULT_MODEL);
|
||||
const configWithModel = applyPrimaryModel(configWithAuth, VOLCENGINE_DEFAULT_MODEL);
|
||||
return {
|
||||
config: configWithModel,
|
||||
agentModelOverride: VOLCENGINE_DEFAULT_MODEL,
|
||||
|
||||
Reference in New Issue
Block a user