From efd358a54a0f3ec0b201f17f3d61a2b28a733bc1 Mon Sep 17 00:00:00 2001 From: "David H." <22520563+NewJerseyStyle@users.noreply.github.com> Date: Thu, 23 Jan 2025 17:01:18 -0500 Subject: [PATCH] Update chatbot.svx for issue#10413 (#10419) * Update chatbot.svx for issue#10413 Fix multiple example code syntax errors in line 115-137 Update the example code to ensure compatibility with latest Gradio API * add changeset --------- Co-authored-by: gradio-pr-bot --- .changeset/better-rats-kiss.md | 5 +++++ .../lib/templates/gradio/03_components/chatbot.svx | 12 ++++++------ 2 files changed, 11 insertions(+), 6 deletions(-) create mode 100644 .changeset/better-rats-kiss.md diff --git a/.changeset/better-rats-kiss.md b/.changeset/better-rats-kiss.md new file mode 100644 index 0000000000000..b3dcc9ef9c408 --- /dev/null +++ b/.changeset/better-rats-kiss.md @@ -0,0 +1,5 @@ +--- +"website": patch +--- + +fix:Update chatbot.svx for issue#10413 diff --git a/js/_website/src/lib/templates/gradio/03_components/chatbot.svx b/js/_website/src/lib/templates/gradio/03_components/chatbot.svx index 296bfff9c5ffe..3bb9f16b1f707 100644 --- a/js/_website/src/lib/templates/gradio/03_components/chatbot.svx +++ b/js/_website/src/lib/templates/gradio/03_components/chatbot.svx @@ -112,12 +112,12 @@ As an example: import gradio as gr history = [ - {"role": "assistant", content="I am happy to provide you that report and plot."} - {"role": "assistant", content=gr.Plot(value=make_plot_from_file('quaterly_sales.txt'))} + {"role": "assistant", "content": "I am happy to provide you that report and plot."}, + {"role": "assistant", "content": gr.Plot(value=make_plot_from_file('quaterly_sales.txt'))} ] with gr.Blocks() as demo: - gr.Chatbot(history) + gr.Chatbot(history, type="messages") demo.launch() ``` @@ -129,12 +129,12 @@ import gradio as gr history = [ gr.ChatMessage(role="assistant", content="How can I help you?"), - gr.ChatMessage(role="user", content="Can you make me a plot of quarterly sales?"}, - gr.ChatMessage(role="assistant", content="I am happy to provide you that report and plot."} + gr.ChatMessage(role="user", content="Can you make me a plot of quarterly sales?"), + gr.ChatMessage(role="assistant", content="I am happy to provide you that report and plot.") ] with gr.Blocks() as demo: - gr.Chatbot(history) + gr.Chatbot(history, type="messages") demo.launch() ```