Manages the chat flow and UI interaction

Constructors

  • Parameters

    • container: HTMLElement

    Returns ChatManager

Properties

onUserAction?: (prompt: string) => void

Methods

  • Appends a message to the chat container.

    Parameters

    • role: "user" | "ai"

      'user' | 'ai'

    • text: string

      The message content

    Returns HTMLElement

    The created message element

  • Sends a message using the selected provider and updates the UI.

    Parameters

    • text: string

      User prompt

    • providerType: ProviderType

      Selected provider

    • apiKey: null | string

      API Key for the provider

    • Optionaloptions: { baseUrl?: string; modelName?: string }

      Local settings (url, model)

    Returns Promise<void>

  • Analyzes page content and offers actions.

    Parameters

    • content: string

    Returns Promise<void>

  • Smoothly scrolls the chat history to the bottom.

    Returns void