mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-04 06:40:22 +00:00
refactor: dedupe channel extension readers
This commit is contained in:
@@ -8,6 +8,7 @@ import {
|
||||
} from "openclaw/plugin-sdk/account-resolution";
|
||||
import { safeParseJsonWithSchema, safeParseWithSchema } from "openclaw/plugin-sdk/extension-shared";
|
||||
import { isSecretRef } from "openclaw/plugin-sdk/secret-input";
|
||||
import { normalizeOptionalString } from "openclaw/plugin-sdk/text-runtime";
|
||||
import { z } from "zod";
|
||||
import type { GoogleChatAccountConfig } from "./types.config.js";
|
||||
|
||||
@@ -103,7 +104,7 @@ function resolveCredentialsFromConfig(params: {
|
||||
);
|
||||
}
|
||||
|
||||
const file = account.serviceAccountFile?.trim();
|
||||
const file = normalizeOptionalString(account.serviceAccountFile);
|
||||
if (file) {
|
||||
return { credentialsFile: file, source: "file" };
|
||||
}
|
||||
@@ -114,7 +115,7 @@ function resolveCredentialsFromConfig(params: {
|
||||
if (envInline) {
|
||||
return { credentials: envInline, source: "env" };
|
||||
}
|
||||
const envFile = process.env[ENV_SERVICE_ACCOUNT_FILE]?.trim();
|
||||
const envFile = normalizeOptionalString(process.env[ENV_SERVICE_ACCOUNT_FILE]);
|
||||
if (envFile) {
|
||||
return { credentialsFile: envFile, source: "env" };
|
||||
}
|
||||
@@ -138,7 +139,7 @@ export function resolveGoogleChatAccount(params: {
|
||||
|
||||
return {
|
||||
accountId,
|
||||
name: merged.name?.trim() || undefined,
|
||||
name: normalizeOptionalString(merged.name),
|
||||
enabled,
|
||||
config: merged,
|
||||
credentialSource: credentials.source,
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { resolveInboundMentionDecision } from "openclaw/plugin-sdk/channel-inbound";
|
||||
import { normalizeOptionalString } from "openclaw/plugin-sdk/text-runtime";
|
||||
import {
|
||||
GROUP_POLICY_BLOCKED_LABEL,
|
||||
createChannelPairingController,
|
||||
@@ -397,6 +398,6 @@ export async function applyGoogleChatInboundAccessPolicy(params: {
|
||||
ok: true,
|
||||
commandAuthorized,
|
||||
effectiveWasMentioned,
|
||||
groupSystemPrompt: groupEntry?.systemPrompt?.trim() || undefined,
|
||||
groupSystemPrompt: normalizeOptionalString(groupEntry?.systemPrompt),
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user