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

Fixes options in the streaming chatbot case #10123

Merged
merged 5 commits into from
Dec 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .changeset/beige-bees-dress.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"@gradio/chatbot": patch
"gradio": patch
---

fix:Fixes options in the streaming chatbot case
34 changes: 16 additions & 18 deletions js/chatbot/shared/ChatBot.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,7 @@
}
}
$: groupedMessages = value && group_messages(value, msg_format);
$: options = value && get_last_bot_options();

function handle_example_select(i: number, example: ExampleMessage): void {
dispatch("example_select", {
Expand Down Expand Up @@ -356,24 +357,21 @@
{/each}
{#if pending_message}
<Pending {layout} {avatar_images} />
{:else}
{@const options = get_last_bot_options()}
{#if options}
<div class="options">
{#each options as option, index}
<button
class="option"
on:click={() =>
dispatch("option_select", {
index: index,
value: option.value
})}
>
{option.label || option.value}
</button>
{/each}
</div>
{/if}
{:else if options}
<div class="options">
{#each options as option, index}
<button
class="option"
on:click={() =>
dispatch("option_select", {
index: index,
value: option.value
})}
>
{option.label || option.value}
</button>
{/each}
</div>
{/if}
</div>
{:else}
Expand Down
Loading