mirror of
https://github.com/openclaw/openclaw.git
synced 2026-08-25 20:05:46 -06:00
perf(slack): reuse thread history text projection (#128022)
Co-authored-by: Amp <amp@ampcode.com>
This commit is contained in:
committed by
GitHub
parent
736b0c424b
commit
07f2129c30
@@ -239,7 +239,7 @@ export async function resolveSlackThreadHistory(params: {
|
||||
|
||||
// Slack recommends no more than 200 per page.
|
||||
const fetchLimit = 200;
|
||||
const retained: SlackRepliesPageMessage[] = [];
|
||||
const retained: Array<[message: SlackRepliesPageMessage, text: string | undefined]> = [];
|
||||
let cursor: string | undefined;
|
||||
let pagesFetched = 0;
|
||||
|
||||
@@ -263,7 +263,7 @@ export async function resolveSlackThreadHistory(params: {
|
||||
if (params.currentMessageTs && msg.ts === params.currentMessageTs) {
|
||||
continue;
|
||||
}
|
||||
retained.push(msg);
|
||||
retained.push([msg, text]);
|
||||
}
|
||||
if (retained.length > maxMessages) {
|
||||
retained.splice(0, retained.length - maxMessages);
|
||||
@@ -282,13 +282,13 @@ export async function resolveSlackThreadHistory(params: {
|
||||
return [];
|
||||
}
|
||||
|
||||
return retained.map((msg) => ({
|
||||
return retained.map(([message, text]) => ({
|
||||
// For file-only messages, create a placeholder showing attached filenames.
|
||||
text: resolveSlackMessageText(msg) ?? formatSlackFilePlaceholder(msg.files),
|
||||
userId: msg.user,
|
||||
botId: msg.bot_id,
|
||||
ts: msg.ts,
|
||||
files: msg.files,
|
||||
text: text ?? formatSlackFilePlaceholder(message.files),
|
||||
userId: message.user,
|
||||
botId: message.bot_id,
|
||||
ts: message.ts,
|
||||
files: message.files,
|
||||
}));
|
||||
} catch (err) {
|
||||
logVerbose(
|
||||
|
||||
Reference in New Issue
Block a user