mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-09 18:54:31 +00:00
chore: Enable "curly" rule to avoid single-statement if confusion/errors.
This commit is contained in:
@@ -93,13 +93,17 @@ export async function buildProviderStatusIndex(
|
||||
|
||||
function resolveDefaultAccountId(cfg: OpenClawConfig, provider: ChannelId): string {
|
||||
const plugin = getChannelPlugin(provider);
|
||||
if (!plugin) return DEFAULT_ACCOUNT_ID;
|
||||
if (!plugin) {
|
||||
return DEFAULT_ACCOUNT_ID;
|
||||
}
|
||||
return resolveChannelDefaultAccountId({ plugin, cfg });
|
||||
}
|
||||
|
||||
function shouldShowProviderEntry(entry: ProviderAccountStatus, cfg: OpenClawConfig): boolean {
|
||||
const plugin = getChannelPlugin(entry.provider);
|
||||
if (!plugin) return Boolean(entry.configured);
|
||||
if (!plugin) {
|
||||
return Boolean(entry.configured);
|
||||
}
|
||||
if (plugin.meta.showConfigured === false) {
|
||||
const providerConfig = (cfg as Record<string, unknown>)[plugin.id];
|
||||
return Boolean(entry.configured) || Boolean(providerConfig);
|
||||
@@ -117,11 +121,15 @@ function formatProviderEntry(entry: ProviderAccountStatus): string {
|
||||
}
|
||||
|
||||
export function summarizeBindings(cfg: OpenClawConfig, bindings: AgentBinding[]): string[] {
|
||||
if (bindings.length === 0) return [];
|
||||
if (bindings.length === 0) {
|
||||
return [];
|
||||
}
|
||||
const seen = new Map<string, string>();
|
||||
for (const binding of bindings) {
|
||||
const channel = normalizeChannelId(binding.match.channel);
|
||||
if (!channel) continue;
|
||||
if (!channel) {
|
||||
continue;
|
||||
}
|
||||
const accountId = binding.match.accountId ?? resolveDefaultAccountId(cfg, channel);
|
||||
const key = providerAccountKey(channel, accountId);
|
||||
if (!seen.has(key)) {
|
||||
@@ -147,10 +155,14 @@ export function listProvidersForAgent(params: {
|
||||
const seen = new Set<string>();
|
||||
for (const binding of params.bindings) {
|
||||
const channel = normalizeChannelId(binding.match.channel);
|
||||
if (!channel) continue;
|
||||
if (!channel) {
|
||||
continue;
|
||||
}
|
||||
const accountId = binding.match.accountId ?? resolveDefaultAccountId(params.cfg, channel);
|
||||
const key = providerAccountKey(channel, accountId);
|
||||
if (seen.has(key)) continue;
|
||||
if (seen.has(key)) {
|
||||
continue;
|
||||
}
|
||||
seen.add(key);
|
||||
const status = params.providerStatus.get(key);
|
||||
if (status) {
|
||||
|
||||
Reference in New Issue
Block a user