h2oai / wave

Realtime Web Apps and Dashboards for Python and R
https://wave.h2o.ai
Apache License 2.0
3.9k stars 323 forks source link

Code in Chatbot is overwritten in edge case #2275

Closed pascal-pfeiffer closed 4 months ago

pascal-pfeiffer commented 4 months ago

Wave SDK Version, OS

h2o-wave 1.0.2

Actual behavior

In my use-case, the initial message has a code block

"""Hi. I am your assistant. How can I help you?
```python
import numpy as np
import pandas as pd
```"""

If the next answer also has a code block in there, it will overwrite the original cell from the first line. See video below.

https://github.com/h2oai/wave/assets/1069138/d71f74b7-6fff-4969-b6a3-b16eb8542ed4

Expected behavior

Do not overwrite code blocks. Also: make both cells copyable

Steps To Reproduce

MESSAGE1 = """Hi. I am your assistant. How can I help you?
```python
import numpy as np
import pandas as pd
```"""

MESSAGE2 = """Hi. I am your assistant. How can I help you?
```python
import pandas as pd
```"""

q.page["main"] = ui.chatbot_card(
    box="body_right",
    name="chatbot",
    data=data(
        fields="content from_user",
        t="list",
        rows=[[MESSAGE1, False], ["testtest", True], [MESSAGE2, False]],
    ),
)

image

marek-mihok commented 4 months ago

This was fixed last year by #2189. Should be part of the upcoming release.

mturoci commented 4 months ago

Perfect. @pascal-pfeiffer feel free to use nightly then. Will try to cut a release this week.

pascal-pfeiffer commented 4 months ago

This was fixed last year by https://github.com/h2oai/wave/pull/2189. Should be part of the upcoming release.

Oh, thanks a lot!