You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
TLDR:
I think this is a kind of niche issue. I only discovered it in the combination of Bootstrap and a pn.Card element within a ChatFeed. How ever I think it is important to fix it, as it looks to me that something deep in the system does not align.
My Scenario:
I am using AutoGen for a Multi-Agent-Chat setup. In this setup, a user asks a question, many LLM calls will happen under the hood and a final answer is returned. I would like to show those many intermediate LLM calls in a collapsible and somehow differently styled box, which is why I use the pn.Card element. This does work, how ever it breaks as soon as I put it into a Bootstrap template as explained below.
ALL software version info
panel 1.3.6
param 1.13.0
(More info that is probably not relevant: python 3.10, MacOS, usage in Notebook, Firefox)
Description of expected behavior and the observed behavior
Complete, minimal, self-contained example code that reproduces the issue
import panel as pn
from panel.chat import ChatInterface, ChatMessage
active_wip = None
def ask_question(contents, user=None, instance=None):
chat_ui.append(ChatMessage(contents, user="user"))
active_wip = pn.chat.ChatFeed(
scroll=True,
height=300,
callback_exception="raise",
height_policy="fixed",
card_params = dict(
collapsible=True,
collapsed=True,
title="Work in Progress", background = "red"),
styles={"background": "WhiteSmoke"},
)
# This works in combination with BootstrapTemplate
# chat_ui.append(active_wip)
# This does not work in combination with BootstrapTemplate
chat_ui.append(pn.Card(active_wip, styles={"background": "WhiteSmoke"}, title="Work in Progress"))
for word in contents.split(" "):
active_wip.append(ChatMessage(word))
chat_ui.append(ChatMessage(contents.capitalize(), user="ai"))
def setup_chat_interface():
text_input = pn.widgets.TextAreaInput(
placeholder="Bitte geben Sie Ihre Nachricht hier ein...",
rows=3,
max_rows=5,
auto_grow=True,
value="Was waren die wichtigsten Trends gestern?",
)
return ChatInterface(
callback=lambda *args: ask_question(*args),
user="User",
callback_exception="raise",
show_clear=False,
show_send=False,
show_undo=False,
show_rerun=False,
widgets=[
text_input,
],
button_properties={
"Submit": {"callback": lambda i, e: ask_question(text_input.value), "icon": "send"}
},
)
chat_ui = setup_chat_interface()
# This always works
# pn.serve(chat_ui)
app_bootstrap = pn.template.BootstrapTemplate(title='Test')
app_bootstrap.main.append(chat_ui)
# This only works if no pn.Card is used (see above)
pn.serve(app_bootstrap)
ERROR:bokeh.server.protocol_handler:error handling message
message: Message 'PATCH-DOC' content: {'events': [{'kind': 'MessageSent', 'msg_type': 'bokeh_event', 'msg_data': {'type': 'event', 'name': 'button_click', 'values': {'type': 'map', 'entries': [['model', {'id': 'p17078'}]]}}}]}
error: KeyError('p17044')
Traceback (most recent call last):
File "/Users/nicokreiling/Library/Caches/pypoetry/virtualenvs/trendllm-byt5rvl_-py3.10/lib/python3.10/site-packages/bokeh/server/protocol_handler.py", line 97, in handle
work = await handler(message, connection)
File "/Users/nicokreiling/Library/Caches/pypoetry/virtualenvs/trendllm-byt5rvl_-py3.10/lib/python3.10/site-packages/bokeh/server/session.py", line 94, in _needs_document_lock_wrapper
result = func(self, *args, **kwargs)
File "/Users/nicokreiling/Library/Caches/pypoetry/virtualenvs/trendllm-byt5rvl_-py3.10/lib/python3.10/site-packages/bokeh/server/session.py", line 286, in _handle_patch
message.apply_to_document(self.document, self)
File "/Users/nicokreiling/Library/Caches/pypoetry/virtualenvs/trendllm-byt5rvl_-py3.10/lib/python3.10/site-packages/bokeh/protocol/messages/patch_doc.py", line 104, in apply_to_document
invoke_with_curdoc(doc, lambda: doc.apply_json_patch(self.payload, setter=setter))
File "/Users/nicokreiling/Library/Caches/pypoetry/virtualenvs/trendllm-byt5rvl_-py3.10/lib/python3.10/site-packages/bokeh/document/callbacks.py", line 443, in invoke_with_curdoc
return f()
File "/Users/nicokreiling/Library/Caches/pypoetry/virtualenvs/trendllm-byt5rvl_-py3.10/lib/python3.10/site-packages/bokeh/protocol/messages/patch_doc.py", line 104, in <lambda>
invoke_with_curdoc(doc, lambda: doc.apply_json_patch(self.payload, setter=setter))
File "/Users/nicokreiling/Library/Caches/pypoetry/virtualenvs/trendllm-byt5rvl_-py3.10/lib/python3.10/site-packages/bokeh/document/document.py", line 391, in apply_json_patch
DocumentPatchedEvent.handle_event(self, event, setter)
File "/Users/nicokreiling/Library/Caches/pypoetry/virtualenvs/trendllm-byt5rvl_-py3.10/lib/python3.10/site-packages/bokeh/document/events.py", line 245, in handle_event
event_cls._handle_event(doc, event)
File "/Users/nicokreiling/Library/Caches/pypoetry/virtualenvs/trendllm-byt5rvl_-py3.10/lib/python3.10/site-packages/bokeh/document/events.py", line 280, in _handle_event
cb(event.msg_data)
File "/Users/nicokreiling/Library/Caches/pypoetry/virtualenvs/trendllm-byt5rvl_-py3.10/lib/python3.10/site-packages/bokeh/document/callbacks.py", line 390, in trigger_event
model._trigger_event(event)
File "/Users/nicokreiling/Library/Caches/pypoetry/virtualenvs/trendllm-byt5rvl_-py3.10/lib/python3.10/site-packages/bokeh/util/callback_manager.py", line 113, in _trigger_event
self.document.callbacks.notify_event(cast(Model, self), event, invoke)
File "/Users/nicokreiling/Library/Caches/pypoetry/virtualenvs/trendllm-byt5rvl_-py3.10/lib/python3.10/site-packages/bokeh/document/callbacks.py", line 260, in notify_event
invoke_with_curdoc(doc, callback_invoker)
File "/Users/nicokreiling/Library/Caches/pypoetry/virtualenvs/trendllm-byt5rvl_-py3.10/lib/python3.10/site-packages/bokeh/document/callbacks.py", line 443, in invoke_with_curdoc
return f()
File "/Users/nicokreiling/Library/Caches/pypoetry/virtualenvs/trendllm-byt5rvl_-py3.10/lib/python3.10/site-packages/bokeh/util/callback_manager.py", line 109, in invoke
cast(EventCallbackWithEvent, callback)(event)
File "/Users/nicokreiling/Library/Caches/pypoetry/virtualenvs/trendllm-byt5rvl_-py3.10/lib/python3.10/site-packages/panel/reactive.py", line 494, in _server_event
self._comm_event(doc, event)
File "/Users/nicokreiling/Library/Caches/pypoetry/virtualenvs/trendllm-byt5rvl_-py3.10/lib/python3.10/site-packages/panel/reactive.py", line 481, in _comm_event
state._handle_exception(e)
File "/Users/nicokreiling/Library/Caches/pypoetry/virtualenvs/trendllm-byt5rvl_-py3.10/lib/python3.10/site-packages/panel/io/state.py", line 442, in _handle_exception
raise exception
File "/Users/nicokreiling/Library/Caches/pypoetry/virtualenvs/trendllm-byt5rvl_-py3.10/lib/python3.10/site-packages/panel/reactive.py", line 479, in _comm_event
self._process_bokeh_event(doc, event)
File "/Users/nicokreiling/Library/Caches/pypoetry/virtualenvs/trendllm-byt5rvl_-py3.10/lib/python3.10/site-packages/panel/reactive.py", line 416, in _process_bokeh_event
self._process_event(event)
File "/Users/nicokreiling/Library/Caches/pypoetry/virtualenvs/trendllm-byt5rvl_-py3.10/lib/python3.10/site-packages/panel/widgets/button.py", line 247, in _process_event
self.clicks += 1
File "/Users/nicokreiling/Library/Caches/pypoetry/virtualenvs/trendllm-byt5rvl_-py3.10/lib/python3.10/site-packages/param/parameterized.py", line 525, in _f
instance_param.__set__(obj, val)
File "/Users/nicokreiling/Library/Caches/pypoetry/virtualenvs/trendllm-byt5rvl_-py3.10/lib/python3.10/site-packages/param/parameterized.py", line 527, in _f
return f(self, obj, val)
File "/Users/nicokreiling/Library/Caches/pypoetry/virtualenvs/trendllm-byt5rvl_-py3.10/lib/python3.10/site-packages/param/parameters.py", line 542, in __set__
super().__set__(obj,val)
File "/Users/nicokreiling/Library/Caches/pypoetry/virtualenvs/trendllm-byt5rvl_-py3.10/lib/python3.10/site-packages/param/parameterized.py", line 527, in _f
return f(self, obj, val)
File "/Users/nicokreiling/Library/Caches/pypoetry/virtualenvs/trendllm-byt5rvl_-py3.10/lib/python3.10/site-packages/param/parameterized.py", line 1545, in __set__
obj.param._call_watcher(watcher, event)
File "/Users/nicokreiling/Library/Caches/pypoetry/virtualenvs/trendllm-byt5rvl_-py3.10/lib/python3.10/site-packages/param/parameterized.py", line 2486, in _call_watcher
self_._execute_watcher(watcher, (event,))
File "/Users/nicokreiling/Library/Caches/pypoetry/virtualenvs/trendllm-byt5rvl_-py3.10/lib/python3.10/site-packages/param/parameterized.py", line 2468, in _execute_watcher
watcher.fn(*args, **kwargs)
File "/var/folders/md/lg_vw48n7db289y9xlnzcbd00000gn/T/ipykernel_91544/1256256118.py", line 51, in <lambda>
"Submit": {"callback": lambda i, e: ask_question(text_input.value), "icon": "send"}
File "/var/folders/md/lg_vw48n7db289y9xlnzcbd00000gn/T/ipykernel_91544/1256256118.py", line 24, in ask_question
chat_ui.append(pn.Card(active_wip, styles={"background": "WhiteSmoke"}, title="Work in Progress"))
File "/Users/nicokreiling/Library/Caches/pypoetry/virtualenvs/trendllm-byt5rvl_-py3.10/lib/python3.10/site-packages/panel/layout/base.py", line 448, in append
self.objects = new_objects
File "/Users/nicokreiling/Library/Caches/pypoetry/virtualenvs/trendllm-byt5rvl_-py3.10/lib/python3.10/site-packages/param/parameterized.py", line 525, in _f
instance_param.__set__(obj, val)
File "/Users/nicokreiling/Library/Caches/pypoetry/virtualenvs/trendllm-byt5rvl_-py3.10/lib/python3.10/site-packages/param/parameterized.py", line 527, in _f
return f(self, obj, val)
File "/Users/nicokreiling/Library/Caches/pypoetry/virtualenvs/trendllm-byt5rvl_-py3.10/lib/python3.10/site-packages/param/parameterized.py", line 1545, in __set__
obj.param._call_watcher(watcher, event)
File "/Users/nicokreiling/Library/Caches/pypoetry/virtualenvs/trendllm-byt5rvl_-py3.10/lib/python3.10/site-packages/param/parameterized.py", line 2486, in _call_watcher
self_._execute_watcher(watcher, (event,))
File "/Users/nicokreiling/Library/Caches/pypoetry/virtualenvs/trendllm-byt5rvl_-py3.10/lib/python3.10/site-packages/param/parameterized.py", line 2468, in _execute_watcher
watcher.fn(*args, **kwargs)
File "/Users/nicokreiling/Library/Caches/pypoetry/virtualenvs/trendllm-byt5rvl_-py3.10/lib/python3.10/site-packages/panel/reactive.py", line 676, in link_cb
setattr(target, links[event.name], event.new)
File "/Users/nicokreiling/Library/Caches/pypoetry/virtualenvs/trendllm-byt5rvl_-py3.10/lib/python3.10/site-packages/param/parameterized.py", line 525, in _f
instance_param.__set__(obj, val)
File "/Users/nicokreiling/Library/Caches/pypoetry/virtualenvs/trendllm-byt5rvl_-py3.10/lib/python3.10/site-packages/param/parameterized.py", line 527, in _f
return f(self, obj, val)
File "/Users/nicokreiling/Library/Caches/pypoetry/virtualenvs/trendllm-byt5rvl_-py3.10/lib/python3.10/site-packages/param/parameterized.py", line 1545, in __set__
obj.param._call_watcher(watcher, event)
File "/Users/nicokreiling/Library/Caches/pypoetry/virtualenvs/trendllm-byt5rvl_-py3.10/lib/python3.10/site-packages/param/parameterized.py", line 2486, in _call_watcher
self_._execute_watcher(watcher, (event,))
File "/Users/nicokreiling/Library/Caches/pypoetry/virtualenvs/trendllm-byt5rvl_-py3.10/lib/python3.10/site-packages/param/parameterized.py", line 2468, in _execute_watcher
watcher.fn(*args, **kwargs)
File "/Users/nicokreiling/Library/Caches/pypoetry/virtualenvs/trendllm-byt5rvl_-py3.10/lib/python3.10/site-packages/panel/reactive.py", line 374, in _param_change
self._apply_update(named_events, properties, model, ref)
File "/Users/nicokreiling/Library/Caches/pypoetry/virtualenvs/trendllm-byt5rvl_-py3.10/lib/python3.10/site-packages/panel/reactive.py", line 302, in _apply_update
self._update_model(events, msg, root, model, doc, comm)
File "/Users/nicokreiling/Library/Caches/pypoetry/virtualenvs/trendllm-byt5rvl_-py3.10/lib/python3.10/site-packages/panel/layout/base.py", line 125, in _update_model
state._views[ref][0]._preprocess(root, self, old_children)
File "/Users/nicokreiling/Library/Caches/pypoetry/virtualenvs/trendllm-byt5rvl_-py3.10/lib/python3.10/site-packages/panel/viewable.py", line 598, in _preprocess
hook(self, root, changed, old_models)
File "/Users/nicokreiling/Library/Caches/pypoetry/virtualenvs/trendllm-byt5rvl_-py3.10/lib/python3.10/site-packages/panel/theme/base.py", line 141, in _apply_hooks
self._reapply(changed, root, old_models, isolated=False, cache=cache, document=root.document)
File "/Users/nicokreiling/Library/Caches/pypoetry/virtualenvs/trendllm-byt5rvl_-py3.10/lib/python3.10/site-packages/panel/theme/base.py", line 132, in _reapply
self._apply_modifiers(o, ref, self.theme, isolated, cache, document)
File "/Users/nicokreiling/Library/Caches/pypoetry/virtualenvs/trendllm-byt5rvl_-py3.10/lib/python3.10/site-packages/panel/theme/base.py", line 236, in _apply_modifiers
cls._apply_params(child, mref, child_modifiers, document)
File "/Users/nicokreiling/Library/Caches/pypoetry/virtualenvs/trendllm-byt5rvl_-py3.10/lib/python3.10/site-packages/panel/theme/base.py", line 249, in _apply_params
model, _ = viewable._models[mref]
KeyError: 'p17044'
Screenshots or screencasts of the bug in action
Working version with pn.Card but without Bootstrap:
Working version with Bootstrap but without pn.Card:
The text was updated successfully, but these errors were encountered:
TLDR:
I think this is a kind of niche issue. I only discovered it in the combination of Bootstrap and a pn.Card element within a ChatFeed. How ever I think it is important to fix it, as it looks to me that something deep in the system does not align.
My Scenario:
I am using AutoGen for a Multi-Agent-Chat setup. In this setup, a user asks a question, many LLM calls will happen under the hood and a final answer is returned. I would like to show those many intermediate LLM calls in a collapsible and somehow differently styled box, which is why I use the pn.Card element. This does work, how ever it breaks as soon as I put it into a Bootstrap template as explained below.
ALL software version info
panel 1.3.6
param 1.13.0
(More info that is probably not relevant: python 3.10, MacOS, usage in Notebook, Firefox)
Description of expected behavior and the observed behavior
Complete, minimal, self-contained example code that reproduces the issue
Stack traceback and/or browser JavaScript console output
Screenshots or screencasts of the bug in action
Working version with pn.Card but without Bootstrap:
Working version with Bootstrap but without pn.Card:
The text was updated successfully, but these errors were encountered: