import json import gradio as gr import modelscope_gradio_components as mgr # label 为对用户展示值,value 为实际选择值 options = [{"label": "A", "value": "a"}, "b", "c"] conversation = [[ None, f""" Single Select: Multiple Select: Vertical Direction: Card Shape: """ ]] # 必须使用 gr.EventData 显示标注 def fn(data: gr.EventData): print(data._data) with gr.Blocks() as demo: chatbot = mgr.Chatbot( value=conversation, flushing=False, height=600, ) # 所有自定义标签都会触发 custom 事件 chatbot.custom(fn=fn) if __name__ == "__main__": demo.queue().launch()