fix(slack): respect historyLimit=0 when fetching thread replies
Skip thread replies fetch when historyLimit <= 0 to honor user config that disables context injection (extra tokens or privacy concerns).
This commit is contained in:
parent
eb8e004499
commit
dd4da8ec3e
@ -496,12 +496,14 @@ export async function prepareSlackMessage(params: {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Fetch recent thread replies (excluding starter and current message).
|
// Fetch recent thread replies (excluding starter and current message).
|
||||||
|
// Respect historyLimit=0 to disable context injection.
|
||||||
|
if (ctx.historyLimit > 0) {
|
||||||
const threadReplies = await resolveSlackThreadReplies({
|
const threadReplies = await resolveSlackThreadReplies({
|
||||||
channelId: message.channel,
|
channelId: message.channel,
|
||||||
threadTs,
|
threadTs,
|
||||||
client: ctx.app.client,
|
client: ctx.app.client,
|
||||||
excludeTs: message.ts,
|
excludeTs: message.ts,
|
||||||
limit: ctx.historyLimit > 0 ? ctx.historyLimit : 10,
|
limit: ctx.historyLimit,
|
||||||
});
|
});
|
||||||
if (threadReplies.length > 0) {
|
if (threadReplies.length > 0) {
|
||||||
const formattedReplies = await Promise.all(
|
const formattedReplies = await Promise.all(
|
||||||
@ -523,6 +525,7 @@ export async function prepareSlackMessage(params: {
|
|||||||
threadRepliesBody = formattedReplies.join("\n\n");
|
threadRepliesBody = formattedReplies.join("\n\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Use thread starter media if current message has none
|
// Use thread starter media if current message has none
|
||||||
const effectiveMedia = media ?? threadStarterMedia;
|
const effectiveMedia = media ?? threadStarterMedia;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user