Skip to content

Commit 31046f3

Browse files
authored
Merge pull request #6 from panel-extensions/fix_refresh
Add edit callback
2 parents bb0ffe3 + 12b940f commit 31046f3

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/panel_web_llm/main.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ class WebLLM(JSComponent):
5353
)
5454

5555
system = param.String(
56-
default="Be the best helper!",
56+
default="Be a world-class helper. Try to keep your answers concise.",
5757
doc="The system prompt for the model completion.",
5858
)
5959

@@ -480,9 +480,14 @@ def __init__(self, **params):
480480
**self.web_llm_kwargs,
481481
)
482482
self.callback = self.web_llm.callback
483+
self.edit_callback = self._edit_callback
483484
self.header = pn.Column(self.web_llm.menu, self.web_llm)
484485
pn.state.onload(self._onload)
485486

487+
def _edit_callback(self, contents, index, instance):
488+
instance.objects = instance.objects[: index + 1]
489+
self.respond()
490+
486491
def _onload(self):
487492
if self.load_on_init:
488493
self.web_llm.load_model = True

0 commit comments

Comments
 (0)