Skip to content

Commit

Permalink
Update chatbot.svx for issue#10413 (#10419)
Browse files Browse the repository at this point in the history
* 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 <[email protected]>
  • Loading branch information
NewJerseyStyle and gradio-pr-bot authored Jan 23, 2025
1 parent b7a7e59 commit efd358a
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
5 changes: 5 additions & 0 deletions .changeset/better-rats-kiss.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"website": patch
---

fix:Update chatbot.svx for issue#10413
12 changes: 6 additions & 6 deletions js/_website/src/lib/templates/gradio/03_components/chatbot.svx
Original file line number Diff line number Diff line change
Expand Up @@ -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()
```
Expand All @@ -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()
```
Expand Down

0 comments on commit efd358a

Please sign in to comment.