mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-09 08:57:40 +00:00
refactor: dedupe runtime and helper flows
This commit is contained in:
@@ -142,13 +142,7 @@ export function resolveThreadBindingIdleTimeoutMsForChannel(params: {
|
||||
channel: string;
|
||||
accountId?: string;
|
||||
}): number {
|
||||
const channel = normalizeChannelId(params.channel);
|
||||
const accountId = normalizeAccountId(params.accountId);
|
||||
const { root, account } = resolveChannelThreadBindings({
|
||||
cfg: params.cfg,
|
||||
channel,
|
||||
accountId,
|
||||
});
|
||||
const { root, account } = resolveThreadBindingChannelScope(params);
|
||||
return resolveThreadBindingIdleTimeoutMs({
|
||||
channelIdleHoursRaw: account?.idleHours ?? root?.idleHours,
|
||||
sessionIdleHoursRaw: params.cfg.session?.threadBindings?.idleHours,
|
||||
@@ -160,19 +154,27 @@ export function resolveThreadBindingMaxAgeMsForChannel(params: {
|
||||
channel: string;
|
||||
accountId?: string;
|
||||
}): number {
|
||||
const channel = normalizeChannelId(params.channel);
|
||||
const accountId = normalizeAccountId(params.accountId);
|
||||
const { root, account } = resolveChannelThreadBindings({
|
||||
cfg: params.cfg,
|
||||
channel,
|
||||
accountId,
|
||||
});
|
||||
const { root, account } = resolveThreadBindingChannelScope(params);
|
||||
return resolveThreadBindingMaxAgeMs({
|
||||
channelMaxAgeHoursRaw: account?.maxAgeHours ?? root?.maxAgeHours,
|
||||
sessionMaxAgeHoursRaw: params.cfg.session?.threadBindings?.maxAgeHours,
|
||||
});
|
||||
}
|
||||
|
||||
function resolveThreadBindingChannelScope(params: {
|
||||
cfg: OpenClawConfig;
|
||||
channel: string;
|
||||
accountId?: string;
|
||||
}) {
|
||||
const channel = normalizeChannelId(params.channel);
|
||||
const accountId = normalizeAccountId(params.accountId);
|
||||
return resolveChannelThreadBindings({
|
||||
cfg: params.cfg,
|
||||
channel,
|
||||
accountId,
|
||||
});
|
||||
}
|
||||
|
||||
export function formatThreadBindingDisabledError(params: {
|
||||
channel: string;
|
||||
accountId: string;
|
||||
|
||||
Reference in New Issue
Block a user