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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix message text overflow onto copy button in gr.Chatbot #5242

Merged
merged 2 commits into from Aug 16, 2023
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 6 additions & 0 deletions .changeset/bumpy-toes-relate.md
@@ -0,0 +1,6 @@
---
"@gradio/chatbot": patch
"gradio": patch
---

fix:Fix message text overflow onto copy button in `gr.Chatbot`
23 changes: 16 additions & 7 deletions js/chatbot/Chatbot.stories.svelte
Expand Up @@ -10,20 +10,20 @@
label: {
control: "text",
description: "The textbox label",
name: "label"
name: "label",
},
show_label: {
options: [true, false],
description: "Whether to show the label",
control: { type: "boolean" },
defaultValue: true
defaultValue: true,
},
rtl: {
options: [true, false],
description: "Whether to render right-to-left",
control: { type: "boolean" },
defaultValue: false
}
defaultValue: false,
},
}}
/>

Expand All @@ -33,9 +33,9 @@
value={[
[
"Can you write a function in Python?",
"```py\ndef test():\n\tprint(x)\n```"
"```py\ndef test():\n\tprint(x)\n```",
],
["Can you do math?", "$$1+1=2$$"]
["Can you do math?", "$$1+1=2$$"],
]}
/>
</Template>
Expand All @@ -54,6 +54,15 @@
name="Chatbot with text rendered right-to-left"
args={{
rtl: true,
latex_delimiters: [{ left: "$$", right: "$$", display: true }]
latex_delimiters: [{ left: "$$", right: "$$", display: true }],
}}
/>

<Story
name="Chatbot with copy button"
args={{
rtl: true,
latex_delimiters: [{ left: "$$", right: "$$", display: true }],
show_copy_button: true,
}}
/>
5 changes: 3 additions & 2 deletions js/chatbot/static/ChatBot.svelte
Expand Up @@ -13,7 +13,7 @@
light: (): Promise<typeof import("prismjs/themes/prism.css")> =>
import("prismjs/themes/prism.css"),
dark: (): Promise<typeof import("prismjs/themes/prism.css")> =>
import("prismjs/themes/prism-dark.css")
import("prismjs/themes/prism-dark.css"),
};

export let value:
Expand Down Expand Up @@ -83,7 +83,7 @@
): void {
dispatch("select", {
index: [i, j],
value: message
value: message,
});
}
</script>
Expand Down Expand Up @@ -222,6 +222,7 @@
border-radius: var(--radius-xxl);
background: var(--background-fill-secondary);
padding: var(--spacing-xxl);
padding-right: calc(var(--spacing-xxl) + var(--spacing-md));
width: calc(100% - var(--spacing-xxl));
color: var(--body-text-color);
font-size: var(--text-lg);
Expand Down