Skip to content

Add footer_actions parameter to ChatMessage#605

Open
ghostiee-11 wants to merge 2 commits intopanel-extensions:mainfrom
ghostiee-11:feat/chat-message-footer-actions
Open

Add footer_actions parameter to ChatMessage#605
ghostiee-11 wants to merge 2 commits intopanel-extensions:mainfrom
ghostiee-11:feat/chat-message-footer-actions

Conversation

@ghostiee-11
Copy link
Copy Markdown
Contributor

@ghostiee-11 ghostiee-11 commented Mar 21, 2026

Description

Adds a footer_actions parameter to ChatMessage that lets downstream libraries place custom icon buttons in the message action row, before the built-in edit and copy icons.

Companion PR: This is the upstream change needed for holoviz/lumen#1764 (Add follow-up suggestion chips after successful queries).

Motivation

While working on follow-up suggestion features for Lumen AI (holoviz/lumen#1764), I needed a way to add a small icon button (lightbulb) inline with the existing edit/copy icons below each message. The current footer_objects parameter renders below the action row, which looks visually disconnected. footer_actions renders inside the action row for a native, consistent look.

What's new

  • New footer_actions Children parameter on ChatMessage (Python)
  • Rendered before edit/copy/reaction icons in ChatMessage.jsx
  • No breaking changes -- footer_objects continues to work as before

Usage

from panel_material_ui import IconButton
from panel_material_ui.chat import ChatMessage

btn = IconButton(icon="lightbulb", size="small", description="Suggest a query")
msg = ChatMessage(object="Results here", footer_actions=[btn])

How Has This Been Tested?

  • Manual testing with standalone Panel app
  • Verified icon renders inline before edit/copy icons
  • Verified clicking the icon triggers Python callbacks
  • Confirmed footer_objects still works independently

AI Disclosure

I identified the need for this parameter while integrating follow-up suggestions into Lumen AI. AI tools helped scaffold the implementation. I reviewed and tested all code manually.

@ghostiee-11 ghostiee-11 requested a review from philippjfr as a code owner March 21, 2026 09:15
@codecov
Copy link
Copy Markdown

codecov bot commented Mar 21, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 82.04%. Comparing base (ac57c5d) to head (30de96d).
⚠️ Report is 2 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #605      +/-   ##
==========================================
+ Coverage   82.03%   82.04%   +0.01%     
==========================================
  Files          31       31              
  Lines        3228     3230       +2     
==========================================
+ Hits         2648     2650       +2     
  Misses        580      580              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

ghostiee-11 added a commit to ghostiee-11/lumen that referenced this pull request Mar 21, 2026
Switch from inline Button chips in footer_objects to a single yellow
lightbulb IconButton in footer_actions. The icon appears before
edit/copy icons and cycles through suggestions on click, populating
the ChatAreaInput without auto-submitting.

Falls back to footer_objects on older pmui versions that lack
footer_actions support.

Addresses review feedback requesting a cleaner icon button approach
instead of inline chips.

Depends on panel-extensions/panel-material-ui#605 for footer_actions.
ghostiee-11 added a commit to ghostiee-11/lumen that referenced this pull request Mar 21, 2026
Replace inline suggestion chips with a single yellow lightbulb
IconButton that cycles through AI-generated follow-up suggestions
on click, populating the ChatAreaInput without auto-submitting.

- Add FollowUpSuggestion/FollowUpSuggestions models
- Add suggest_followup() to Coordinator with llm_spec="ui"
- Add _add_followup_icon_to_footer() using footer_actions with
  fallback to footer_objects for older pmui versions
- Add follow_up_suggestions settings toggle
- Add docs for the feature
- 15 tests (11 UI + 4 coordinator)

Depends on panel-extensions/panel-material-ui#605 for footer_actions.
@ahuang11
Copy link
Copy Markdown
Contributor

I think your changes are intertwined with #604

Comment on lines +81 to +84
footer_actions = Children(default=[], doc="""
A list of icon button objects to display in the action row
of the message footer, alongside the edit and copy icons.""")

Copy link
Copy Markdown
Contributor

@ahuang11 ahuang11 Mar 24, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Torn between having instantiated icon buttons or something like https://github.com/holoviz/panel/blob/main/panel/chat/interface.py#L122-L146

Image

OR whether that's too complicated

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the Children approach is the right call here. The dict-based CallbackIcon pattern from Panel's ChatInterface works well for a fixed set of built-in actions, but for footer_actions the user is bringing their own widgets, so passing instantiated components gives them full control over styling, callbacks, toggle behavior, etc. without us having to design a config schema for every possible option.

It also stays consistent with how footer_objects and header_objects already work in ChatMessage.

Let me know if you'd prefer the dict approach though!

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So actions is a loaded term in panel-material-ui because Menu components do use it for the dictionary-like specification. So if we are calling it footer_action then I would lean to the dict approach.

Adds a new `footer_actions` Children parameter to ChatMessage that
renders icon button objects in the action row before the edit and
copy icons. This allows downstream libraries like Lumen AI to add
custom action buttons (e.g. follow-up suggestion icons) that appear
inline with the built-in message actions.
@ghostiee-11 ghostiee-11 force-pushed the feat/chat-message-footer-actions branch from 05ec50f to da95e40 Compare March 24, 2026 07:13
@ghostiee-11
Copy link
Copy Markdown
Contributor Author

I think your changes are intertwined with #604

Yupp.. sorry for this, fixed it!!

ghostiee-11 added a commit to ghostiee-11/lumen that referenced this pull request Mar 24, 2026
Add a lightbulb icon to message footer that populates the chat input
with an AI-generated follow-up suggestion on click. Uses the cheapest
'ui' LLM spec for efficient generation.

- Add FollowUpSuggestion model in models.py
- Add suggest_followup() to Coordinator with llm_spec='ui'
- Add follow_up_suggestions.jinja2 extending Actor/main.jinja2
- Add lightbulb icon to footer_actions (fallback to footer_objects)
- Add follow_up_suggestions settings toggle
- 14 tests (10 UI + 4 coordinator) + docs

Depends on panel-extensions/panel-material-ui#605 for footer_actions.
ghostiee-11 added a commit to ghostiee-11/lumen that referenced this pull request Mar 24, 2026
Add a lightbulb icon to message footer that populates the chat input
with an AI-generated follow-up suggestion on click. Uses the cheapest
'ui' LLM spec for efficient generation.

- Add FollowUpSuggestion model in models.py
- Add suggest_followup() to Coordinator with llm_spec='ui'
- Add follow_up_suggestions.jinja2 extending Actor/main.jinja2
- Add lightbulb icon to footer_actions (fallback to footer_objects)
- Add follow_up_suggestions settings toggle
- 14 tests (10 UI + 4 coordinator) + docs

Depends on panel-extensions/panel-material-ui#605 for footer_actions.
Comment thread tests/chat/test_message_edit.py Outdated
@ahuang11
Copy link
Copy Markdown
Contributor

ahuang11 commented Mar 26, 2026

We need to document it under panel-material-ui/examples/reference/chat/ChatMessage.ipynb

I tested it and to make it look like the other icons:
image

from panel_material_ui import IconButton
from panel_material_ui.chat import ChatMessage

btn = IconButton(
    icon="lightbulb_outlined",
    active_icon="check",
    margin=(0, 0),
    toggle_duration=1000,
    description=f"Copy to clipboard",
    size="small",
    color="default",
    icon_size="0.8em",
)
msg = ChatMessage(object="Results here", footer_actions=[btn])
msg.show()

Comment thread src/panel_material_ui/chat/ChatMessage.jsx Outdated
- Move footer_actions to render after copy, edit, and reaction icons
- Add alignItems center to action row for consistent alignment
- Add footer_actions parameter to ChatMessage reference notebook
- Move IconButton import to top of test file
- Update docstring to reflect new icon order
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants