CF Workers Telegram Bot - v12.6.20
    Preparing search index...

    Class HistoryManager

    Class representing a manager for conversation history stored in KV

    Index

    Constructors

    Methods

    • Add a message and its response to the history

      Parameters

      • userId: string | number

        the telegram user ID

      • prompt: string

        the user message

      • response: string

        the bot response

      • OptionalthreadId: number

        optional thread ID

      Returns Promise<void>

    • Clear the conversation history for a user

      Parameters

      • userId: string | number

        the telegram user ID

      • OptionalthreadId: number

        optional thread ID

      Returns Promise<void>

    • Get the conversation history for a user

      Parameters

      • userId: string | number

        the telegram user ID

      • OptionalthreadId: number

        optional thread ID

      Returns Promise<{ content: string; role: string }[]>

      array of messages