Skip to content

Assistant thread history seems to take messages from the begging instead of the end #40

@ValorHeart

Description

@ValorHeart

At that line: https://github.com/slack-samples/bolt-js-assistant-template/blob/main/app.js#L180
We take the thread history from the first message, without a limit, it defaults to 100 messages, and can be configured up to 999 messages.
But, as a developer, i'd like to consider my token window in a conversation, that's why I want to limit my history for up to 10 messages for example.
in that case, if I'll use that function as is and just add the limit option, I'll get the 10 first messages, which will make me miss the messages that happens just before the current user input, may I suggest to take the message from the bottom up as a best practice?
e.g.:

// Retrieve the Assistant thread history for context of question being asked
const thread = await client.conversations.replies({
  channel,
  ts: thread_ts,
  latest: message.ts,
});

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions