mirror of https://github.com/openclaw/openclaw.git
refactor: share outbound base session setup
This commit is contained in:
parent
2ebc7e3ded
commit
a4a7958678
|
|
@ -532,6 +532,21 @@ function resolveMatrixSession(
|
|||
};
|
||||
}
|
||||
|
||||
function buildSimpleBaseSession(params: {
|
||||
route: ResolveOutboundSessionRouteParams;
|
||||
channel: string;
|
||||
peer: RoutePeer;
|
||||
}) {
|
||||
const baseSessionKey = buildBaseSessionKey({
|
||||
cfg: params.route.cfg,
|
||||
agentId: params.route.agentId,
|
||||
channel: params.channel,
|
||||
accountId: params.route.accountId,
|
||||
peer: params.peer,
|
||||
});
|
||||
return { baseSessionKey, peer: params.peer };
|
||||
}
|
||||
|
||||
function resolveMSTeamsSession(
|
||||
params: ResolveOutboundSessionRouteParams,
|
||||
): OutboundSessionRoute | null {
|
||||
|
|
@ -596,13 +611,10 @@ function resolveMattermostSession(
|
|||
if (!rawId) {
|
||||
return null;
|
||||
}
|
||||
const peer: RoutePeer = { kind: isUser ? "direct" : "channel", id: rawId };
|
||||
const baseSessionKey = buildBaseSessionKey({
|
||||
cfg: params.cfg,
|
||||
agentId: params.agentId,
|
||||
const { baseSessionKey, peer } = buildSimpleBaseSession({
|
||||
route: params,
|
||||
channel: "mattermost",
|
||||
accountId: params.accountId,
|
||||
peer,
|
||||
peer: { kind: isUser ? "direct" : "channel", id: rawId },
|
||||
});
|
||||
const threadId = normalizeThreadId(params.replyToId ?? params.threadId);
|
||||
const threadKeys = resolveThreadSessionKeys({
|
||||
|
|
|
|||
Loading…
Reference in New Issue