mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-11 02:14:33 +00:00
refactor: rename to openclaw
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import type { Api, Model } from "@mariozechner/pi-ai";
|
||||
import { discoverAuthStorage, discoverModels } from "@mariozechner/pi-coding-agent";
|
||||
|
||||
import { resolveMoltbotAgentDir } from "../../agents/agent-paths.js";
|
||||
import { resolveOpenClawAgentDir } from "../../agents/agent-paths.js";
|
||||
import type { AuthProfileStore } from "../../agents/auth-profiles.js";
|
||||
import { listProfilesForProvider } from "../../agents/auth-profiles.js";
|
||||
import {
|
||||
@@ -9,8 +9,8 @@ import {
|
||||
resolveAwsSdkEnvVarName,
|
||||
resolveEnvApiKey,
|
||||
} from "../../agents/model-auth.js";
|
||||
import { ensureMoltbotModelsJson } from "../../agents/models-config.js";
|
||||
import type { MoltbotConfig } from "../../config/config.js";
|
||||
import { ensureOpenClawModelsJson } from "../../agents/models-config.js";
|
||||
import type { OpenClawConfig } from "../../config/config.js";
|
||||
import type { ModelRow } from "./list.types.js";
|
||||
import { modelKey } from "./shared.js";
|
||||
|
||||
@@ -30,7 +30,7 @@ const isLocalBaseUrl = (baseUrl: string) => {
|
||||
}
|
||||
};
|
||||
|
||||
const hasAuthForProvider = (provider: string, cfg: MoltbotConfig, authStore: AuthProfileStore) => {
|
||||
const hasAuthForProvider = (provider: string, cfg: OpenClawConfig, authStore: AuthProfileStore) => {
|
||||
if (listProfilesForProvider(authStore, provider).length > 0) return true;
|
||||
if (provider === "amazon-bedrock" && resolveAwsSdkEnvVarName()) return true;
|
||||
if (resolveEnvApiKey(provider)) return true;
|
||||
@@ -38,9 +38,9 @@ const hasAuthForProvider = (provider: string, cfg: MoltbotConfig, authStore: Aut
|
||||
return false;
|
||||
};
|
||||
|
||||
export async function loadModelRegistry(cfg: MoltbotConfig) {
|
||||
await ensureMoltbotModelsJson(cfg);
|
||||
const agentDir = resolveMoltbotAgentDir();
|
||||
export async function loadModelRegistry(cfg: OpenClawConfig) {
|
||||
await ensureOpenClawModelsJson(cfg);
|
||||
const agentDir = resolveOpenClawAgentDir();
|
||||
const authStorage = discoverAuthStorage(agentDir);
|
||||
const registry = discoverModels(authStorage, agentDir);
|
||||
const models = registry.getAll() as Model<Api>[];
|
||||
@@ -55,7 +55,7 @@ export function toModelRow(params: {
|
||||
tags: string[];
|
||||
aliases?: string[];
|
||||
availableKeys?: Set<string>;
|
||||
cfg?: MoltbotConfig;
|
||||
cfg?: OpenClawConfig;
|
||||
authStore?: AuthProfileStore;
|
||||
}): ModelRow {
|
||||
const { model, key, tags, aliases = [], availableKeys, cfg, authStore } = params;
|
||||
|
||||
Reference in New Issue
Block a user