惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

V
Visual Studio Blog
Y
Y Combinator Blog
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
Hugging Face - Blog
Hugging Face - Blog
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
The Cloudflare Blog
L
LangChain Blog
美团技术团队
N
Netflix TechBlog - Medium
量子位
酷 壳 – CoolShell
酷 壳 – CoolShell
B
Blog
博客园 - 司徒正美
爱范儿
爱范儿
D
DataBreaches.Net
月光博客
月光博客
U
Unit 42
B
Blog RSS Feed
Engineering at Meta
Engineering at Meta
Apple Machine Learning Research
Apple Machine Learning Research
Jina AI
Jina AI
MongoDB | Blog
MongoDB | Blog
腾讯CDC

Recent Commits to openclaw:main

test: merge chat side-result checks · openclaw/openclaw@ddd2c2a test: merge cron history checks · openclaw/openclaw@f7eb746 test: merge responsive navigation shell checks · openclaw/openclaw@c2e4b47 docs(changelog): add codex oauth fixes · openclaw/openclaw@628e6cd test: merge navigation routing cases · openclaw/openclaw@5d8cecb Tests: mock channel registry bundled fallback · openclaw/openclaw@2b08233 Secrets: avoid broad web search discovery for single plugin config · openclaw/openclaw@a464f59 test: merge config view browser checks · openclaw/openclaw@20cf511 fix(status): align oauth health with runtime · openclaw/openclaw@eed7116 feat: add macOS screen snapshots for monitor preview (#67954) thanks … · openclaw/openclaw@f377db1 fix: report shared auth scopes in hello-ok (#67810) thanks @BunsDev · openclaw/openclaw@0b6c39b Auto-reply: avoid eager bundled route fallback · openclaw/openclaw@3ea1bf4 Tests: narrow session binding contract setup · openclaw/openclaw@54e4e16 fix(macOS): enable undo/redo in webchat composer text input (#34962) · openclaw/openclaw@00951dc Tests: speed up channel setup promotion · openclaw/openclaw@82b529a Docs: refresh agent instructions · openclaw/openclaw@5775fe2 fix(auth): serialize OAuth refresh across agents to fix #26322 (#67876) · openclaw/openclaw@8e79080 test: allow ollama public surface boundary test · openclaw/openclaw@7d4f1a6 Docs: add test performance guardrails · openclaw/openclaw@89706d3 Tests: restore context-engine usage proof · openclaw/openclaw@e4c4f95 Tests: slim context engine runtime coverage · openclaw/openclaw@74c198f ci: retry failed custom checkouts · openclaw/openclaw@0ee5baf test: trim duplicate provider auth onboarding cases · openclaw/openclaw@1ffc02e matrix: fix sessions_spawn --thread subagent session spawning (#67643) · openclaw/openclaw@1ce2596 test: reduce auth choice fixture churn · openclaw/openclaw@857b9cd test: mock health status config boundaries · openclaw/openclaw@9d5ab4a test: mock onboard config io boundary · openclaw/openclaw@299694d test: mock legacy state plugin boundaries · openclaw/openclaw@2713089 test: mock channel install boundaries · openclaw/openclaw@b945248 test: mock doctor preview channel boundaries · openclaw/openclaw@b1a3ad4
test(live): read gateway provider models · openclaw/openc...
vincentkoc · 2026-05-07 · via Recent Commits to openclaw:main

@@ -1410,6 +1410,83 @@ type LiveModelRegistry = {

14101410

getAll(): Array<Model<Api>>;

14111411

};

141214121413+

function toGatewayLiveModel(params: {

1414+

provider: string;

1415+

providerConfig: ModelProviderConfig;

1416+

modelConfig: NonNullable<ModelProviderConfig["models"]>[number];

1417+

}): Model<Api> | null {

1418+

const id = params.modelConfig.id?.trim();

1419+

const api = params.modelConfig.api ?? params.providerConfig.api;

1420+

const baseUrl = params.modelConfig.baseUrl ?? params.providerConfig.baseUrl;

1421+

if (!id || !api || !baseUrl) {

1422+

return null;

1423+

}

1424+

const input = params.modelConfig.input.filter(

1425+

(value): value is "text" | "image" => value === "text" || value === "image",

1426+

);

1427+

return {

1428+

id,

1429+

name: params.modelConfig.name ?? id,

1430+

api: api as Api,

1431+

provider: params.provider,

1432+

baseUrl,

1433+

reasoning: params.modelConfig.reasoning ?? false,

1434+

thinkingLevelMap: params.modelConfig.thinkingLevelMap,

1435+

input: input.length > 0 ? input : ["text"],

1436+

cost: params.modelConfig.cost ?? {

1437+

input: 0,

1438+

output: 0,

1439+

cacheRead: 0,

1440+

cacheWrite: 0,

1441+

},

1442+

contextWindow: params.modelConfig.contextWindow ?? 128_000,

1443+

maxTokens: params.modelConfig.maxTokens ?? 16_384,

1444+

compat: params.modelConfig.compat ?? params.providerConfig.compat,

1445+

};

1446+

}

1447+1448+

async function loadProviderScopedConfiguredModels(params: {

1449+

agentDir: string;

1450+

providerList: readonly string[];

1451+

}): Promise<Array<Model<Api>>> {

1452+

const modelsPath = path.join(params.agentDir, "models.json");

1453+

let parsed: { providers?: Record<string, ModelProviderConfig> };

1454+

try {

1455+

parsed = JSON.parse(await fs.readFile(modelsPath, "utf8")) as {

1456+

providers?: Record<string, ModelProviderConfig>;

1457+

};

1458+

} catch {

1459+

return [];

1460+

}

1461+1462+

const providers = parsed.providers ?? {};

1463+

const models: Array<Model<Api>> = [];

1464+

const seen = new Set<string>();

1465+

for (const rawProvider of params.providerList) {

1466+

const normalizedProvider = normalizeProviderId(rawProvider);

1467+

const entry = Object.entries(providers).find(

1468+

([provider]) => normalizeProviderId(provider) === normalizedProvider,

1469+

);

1470+

if (!entry) {

1471+

continue;

1472+

}

1473+

const [provider, providerConfig] = entry;

1474+

for (const modelConfig of providerConfig.models ?? []) {

1475+

const model = toGatewayLiveModel({ provider, providerConfig, modelConfig });

1476+

if (!model) {

1477+

continue;

1478+

}

1479+

const key = `${normalizeProviderId(model.provider)}/${model.id.toLowerCase()}`;

1480+

if (seen.has(key)) {

1481+

continue;

1482+

}

1483+

seen.add(key);

1484+

models.push(model);

1485+

}

1486+

}

1487+

return models;

1488+

}

1489+14131490

function loadProviderScopedBuiltInModels(providerList: readonly string[]): Array<Model<Api>> {

14141491

const models: Array<Model<Api>> = [];

14151492

const seen = new Set<string>();

@@ -1430,6 +1507,17 @@ function loadProviderScopedBuiltInModels(providerList: readonly string[]): Array

14301507

return models;

14311508

}

143215091510+

async function loadProviderScopedModels(params: {

1511+

agentDir: string;

1512+

providerList: readonly string[];

1513+

}): Promise<Array<Model<Api>>> {

1514+

const configured = await loadProviderScopedConfiguredModels(params);

1515+

if (configured.length > 0) {

1516+

return configured;

1517+

}

1518+

return loadProviderScopedBuiltInModels(params.providerList);

1519+

}

1520+14331521

function createStaticLiveModelRegistry(models: Array<Model<Api>>): LiveModelRegistry {

14341522

return {

14351523

find(provider, modelId) {

@@ -2459,7 +2547,10 @@ describeLive("gateway live (dev agent, profile keys)", () => {

24592547

let all: Array<Model<Api>>;

24602548

if (useProviderScopedBuiltIns) {

24612549

logProgress("[all-models] loading provider-scoped model refs");

2462-

all = loadProviderScopedBuiltInModels(providerList);

2550+

all = await withGatewayLiveSetupTimeout(

2551+

loadProviderScopedModels({ agentDir, providerList }),

2552+

"[all-models] load provider-scoped model refs",

2553+

);

24632554

modelRegistry = createStaticLiveModelRegistry(all);

24642555

} else {

24652556

logProgress("[all-models] loading auth profiles");