Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Triggers interrupting Chat Value #2368

Open
mtanco opened this issue Jul 16, 2024 · 0 comments
Open

Triggers interrupting Chat Value #2368

mtanco opened this issue Jul 16, 2024 · 0 comments
Labels
bug Bug in code ui Related to UI

Comments

@mtanco
Copy link
Contributor

mtanco commented Jul 16, 2024

Wave SDK Version, OS

Wave 1.1.1
Apple M3 Max Sonoma 14.1 (also seen on a Windows machine)
Safari (also tested in Chrome)

Actual behavior

When users type into a chatbot but do not click enter, and then interact with another element, the Submitted element is incorrect.

Expected behavior

Users can type into a chatbot, do other stuff, and then submit later and the chatbot knows it was submitted.

Steps To Reproduce

While running the following app:

  1. type into the chatbot but do not submit
  2. Click the filter button to open the side panel which has a trigger element.
  3. Click away from the side panel to close it - do not click on the trigger element.
  4. Click submit on the chatbot.

The value of __wave_submission_name__ will be the trigger element instead of the chatbot.

from h2o_wave import main, app, Q, ui, data, on, run_on


@app('/')
async def serve(q: Q):

    if not q.client.initialize:

        q.page["meta"] = ui.meta_card("")
        q.page["filter"] = ui.form_card(
            box="6 1 1 1",
            items=[ui.button(name="filter_button", label="Click Me!", primary=True)]
        )
        q.page['chatbot_card'] = ui.chatbot_card(
            box='1 1 5 5',
            name='chatbot',
            data=data(fields='content from_user', t='list', rows=[q.client.chat_history]),
        )

        q.client.agency_list = ["test1", "test2"]
        q.client.selected_agency = None

        q.client.initialize = True

    if q.args.filter_button:
        # The user wants to do some filtering
        q.page["meta"].side_panel = ui.side_panel(
            title="Filter",
            items=[
                ui.choice_group(
                    name="agency_filter", label="Agency Filter",
                    choices=[ui.choice(a, a) for a in q.client.agency_list],
                    value=q.client.selected_agency, trigger=True
                ),
            ]
        )

    if q.args.agency_filter:
        # This is on a trigger and calls when someone has clicked any agency option
        q.client.selected_agency = q.args.agency_filter
        q.page["meta"].notification_bar = ui.notification_bar(
            text="Your option was saved!"
        )

    if q.args.__wave_submission_name__ == "chatbot":
        q.page['chatbot_card'].data += ["👤" + q.args.chatbot, True]
        q.page['chatbot_card'].data += ["🤖 I am just a demo", False]

    await q.page.save()
@mtanco mtanco added the bug Bug in code label Jul 16, 2024
@mturoci mturoci added the ui Related to UI label Aug 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Bug in code ui Related to UI
Projects
None yet
Development

No branches or pull requests

2 participants