mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-09 01:58:26 +00:00
refactor!: rename chat providers to channels
This commit is contained in:
26
src/channels/plugins/media-limits.ts
Normal file
26
src/channels/plugins/media-limits.ts
Normal file
@@ -0,0 +1,26 @@
|
||||
import type { ClawdbotConfig } from "../../config/config.js";
|
||||
import { normalizeAccountId } from "../../routing/session-key.js";
|
||||
|
||||
const MB = 1024 * 1024;
|
||||
|
||||
export function resolveChannelMediaMaxBytes(params: {
|
||||
cfg: ClawdbotConfig;
|
||||
// Channel-specific config lives under different keys; keep this helper generic
|
||||
// so shared plugin helpers don't need channel-id branching.
|
||||
resolveChannelLimitMb: (params: {
|
||||
cfg: ClawdbotConfig;
|
||||
accountId: string;
|
||||
}) => number | undefined;
|
||||
accountId?: string | null;
|
||||
}): number | undefined {
|
||||
const accountId = normalizeAccountId(params.accountId);
|
||||
const channelLimit = params.resolveChannelLimitMb({
|
||||
cfg: params.cfg,
|
||||
accountId,
|
||||
});
|
||||
if (channelLimit) return channelLimit * MB;
|
||||
if (params.cfg.agents?.defaults?.mediaMaxMb) {
|
||||
return params.cfg.agents.defaults.mediaMaxMb * MB;
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
Reference in New Issue
Block a user