Skip to content

Add message threading and per-message metadata view #541

@paullizer

Description

@paullizer

Summary:
Introduce a first-class threading model for conversations and a per-message metadata view in the UI. Threading will associate user messages with the hidden system prompt and assistant responses, tool/plugin invocations, and image generation events. The metadata view surfaces core context (agent, model, workspace, button states, IDs, timestamps, etc.) for each message. This enables edit/delete/retry flows with clear ripple-effect visibility while preserving prior generated content for cycling and audit.

Motivation:

  • Today we only temporally connect messages by timestamps, which is fragile and doesn’t capture relationships or causality.
  • Scientists/investigators need a holistic understanding of what was done, what came after, and how edits/ retries affect outcomes without losing prior outputs.
  • Threading provides durable associations and ordering independent of timestamps and supports advanced actions like edit, delete, and retry.

Proposed Feature Set:

  • Message Threading:

    • Associate user messages with the corresponding system message (hidden from chat but sent to the model) and the assistant response.
    • Link tool/plugin calls and image generation events to the originating message.
    • Connect message threads in series so we know sequence causality regardless of timestamps.
    • Track attempts per thread (e.g., retries increment attempt counters).
    • Preserve previous content while allowing cycling through versions.
  • Per-Message Metadata View:

    • A structured metadata pane per message showing:
      • Conversation ID
      • Thread ID, Previous Thread ID, Active flag
      • Attempt number
      • Role (user/system/assistant/tool)
      • Timestamp
      • Agent details (display name, augmented flag)
      • Model details (Selected Model vs Frontend Model)
      • Workspace & Document Selection state
      • Button States (e.g., Image Generation: Disabled, Document Search: Disabled)
      • Global toggles (Search Enabled: Disabled, Global Agent: Disabled, Streaming: Disabled)
      • Chat Context summary
      • Optional: Avatar/profile info and message input context
    • A dedicated “Thread Information” block (Thread ID, Previous Thread, Active, Attempt).
    • A “Message Details” block (Conversation ID, Role, Timestamp).
    • A “Generation Details” block (Model, Agent).
    • Panels for “User Information”, “Agent Selection”, “Model Selection”, and “Workspace & Document Selection”.
    • Consistent card layout for agent outputs (e.g., an “Agent output card” with summary fields).

UI/UX Design Notes:

  • Top-level header reflects the current operation (e.g., “find candidate with id …”) — keep generic to any data domain.
  • Left/center: a large info panel grouping:
    • User Information
    • Thread Information
    • Button States
    • Workspace & Document Selection
    • Agent Selection
    • Model Selection
    • Chat Context
  • Main content: agent output card that presents a structured summary.
  • Bottom/right: small avatar, thread details block, and message input area/bottom toolbar.
  • Toggle visibility for Streaming, Image Generation, Document Search states in Button States panel.
  • Distinguish Selected Model from Frontend Model and show Agent Augmented flag.

Data Model Updates:

  • Thread entity:
    • id
    • previous_thread_id (nullable)
    • active (bool)
    • attempt (int)
    • created_at, updated_at
  • Message entity additions:
    • thread_id (FK)
    • role (user/system/assistant/tool)
    • series_index (integer ordering within thread; independent of timestamp)
    • linked_message_ids (associations to system/assistant/tool/image-gen messages)
    • metadata (JSON: agent, model, workspace, button states, toggles, etc.)
    • deleted_at (nullable for soft delete)
  • Ordering rules:
    • Primary order by series_index within thread; timestamps are secondary.

Behavior:

  • Mask:
    • Help provide more control over what the model receives as part of conversation history. You may like some parts of the models response but not want all of it.
    • Mask selected parts of a message to remove them from being sent to the model on subsequent submissions.
    • Mast entire message to remove it from being sent to the model on subsequent submissions.
  • Edit:
    • Creates a new message version in the same thread; series_index advances.
    • Prior content remains accessible; UI shows ripple warning indicating downstream messages may diverge.
  • Delete:
    • Soft-deletes a message; thread remains intact; downstream associations remain but flagged.
  • Retry:
    • Increments thread attempt; generates new assistant/tool outputs linked to the originating user message.
  • Image/tool linkage:
    • Tool and image-generation messages are explicitly linked to their triggering message and appear in the thread chain.

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