Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -607,9 +607,7 @@ def main():
|
|
| 607 |
|
| 608 |
gr.HTML('<div class="s-section-label">Try it</div>')
|
| 609 |
|
| 610 |
-
chatbot = gr.Chatbot(
|
| 611 |
-
height=440, show_label=False, render_markdown=True, type="messages"
|
| 612 |
-
)
|
| 613 |
|
| 614 |
with gr.Row():
|
| 615 |
textbox = gr.Textbox(
|
|
@@ -650,17 +648,14 @@ def main():
|
|
| 650 |
yield history, ""
|
| 651 |
return
|
| 652 |
|
| 653 |
-
history = list(history) + [
|
| 654 |
-
{"role": "user", "content": message},
|
| 655 |
-
{"role": "assistant", "content": ""},
|
| 656 |
-
]
|
| 657 |
yield history, ""
|
| 658 |
try:
|
| 659 |
for partial in respond(message, history, *cfg):
|
| 660 |
-
history[-1][
|
| 661 |
yield history, ""
|
| 662 |
except Exception as exc: # noqa: BLE001
|
| 663 |
-
history[-1][
|
| 664 |
yield history, ""
|
| 665 |
|
| 666 |
submit.click(_chat, [textbox, chatbot, *settings], [chatbot, textbox])
|
|
|
|
| 607 |
|
| 608 |
gr.HTML('<div class="s-section-label">Try it</div>')
|
| 609 |
|
| 610 |
+
chatbot = gr.Chatbot(height=440, show_label=False, render_markdown=True)
|
|
|
|
|
|
|
| 611 |
|
| 612 |
with gr.Row():
|
| 613 |
textbox = gr.Textbox(
|
|
|
|
| 648 |
yield history, ""
|
| 649 |
return
|
| 650 |
|
| 651 |
+
history = list(history) + [[message, ""]]
|
|
|
|
|
|
|
|
|
|
| 652 |
yield history, ""
|
| 653 |
try:
|
| 654 |
for partial in respond(message, history, *cfg):
|
| 655 |
+
history[-1][1] = partial
|
| 656 |
yield history, ""
|
| 657 |
except Exception as exc: # noqa: BLE001
|
| 658 |
+
history[-1][1] = f"[generation error: {type(exc).__name__}: {exc}]"
|
| 659 |
yield history, ""
|
| 660 |
|
| 661 |
submit.click(_chat, [textbox, chatbot, *settings], [chatbot, textbox])
|