gradio-app / gradio

Build and share delightful machine learning apps, all in Python. 🌟 Star to support our work!
http://www.gradio.app
Apache License 2.0
33.98k stars 2.58k forks source link

Problems about Chatbot component #3460

Closed wlike closed 1 year ago

wlike commented 1 year ago

Using version 3.18.0, the result of Chatbot is as follows:

企业微信截图_16787956948437

Using the latest version 3.21.0, the result of Chatbot is as follows:

企业微信截图_16787955851029

The result of the latest version is worse than that of version 3.18.0. Besides, the latest version doesn't support the color_map parameter any longer, what's the reason?

abidlabs commented 1 year ago

Hi @wlike can you elaborate a little more on why the latest version is worse?

I'll share a temporary workaround for the color_map.

abidlabs commented 1 year ago

You can use custom css to get the same effect as the color_map. Here's an example:

import gradio as gr

css = """
#chatbot1 .user {
    background-color:cyan;
    border-color:blue;
}
#chatbot1 .bot {
    background-color:gray;
    border-color:black;
}
"""

with gr.Blocks(css=css) as demo:
    with gr.Row():
        gr.Chatbot(elem_id="chatbot1", value=[("abc", "def")])

demo.launch()
RobotSe7en commented 1 year ago

How to get chatbox style(ver: 3.18.0)

abidlabs commented 1 year ago

Hi @RobotSe7en short of downgrading the Gradio version, it is not possible to get the original style of the chatbot. But it is possible to apply custom colors using the code sniper I provided above

abidlabs commented 1 year ago

I'll go ahead and close this issue as there doesn't seem to be any other actionable items.

wlike commented 1 year ago

Hi @wlike can you elaborate a little more on why the latest version is worse?

I'll share a temporary workaround for the color_map.

Hi @abidlabs With version 3.18.0, the request/question is right-aligned, and the response/answer is left-aligned. But with version 3.21.0, they are all left-aligned, which I think is not quite common and beautiful.

MikeDean2367 commented 1 year ago

For the new version, how can I adjust the parameters so that the length of the chatbot's dialog box can change with the length of the content ?