Spaces:
Sleeping
Sleeping
| import gradio as gr | |
| def create_chatbot() -> gr.Chatbot: | |
| """Create the main chatbot component.""" | |
| return gr.Chatbot( | |
| type="messages", | |
| container=True, | |
| scale=8, | |
| autoscroll=True | |
| ) | |
| def create_textbox() -> gr.Textbox: | |
| """Create the text editing component.""" | |
| return gr.Textbox( | |
| label="教案編輯", | |
| lines=30, | |
| render=False, | |
| interactive=True, | |
| scale=1 | |
| ) | |
| def create_prompt_input() -> gr.Textbox: | |
| """Create the user prompt input component.""" | |
| return gr.Textbox( | |
| label="用戶輸入區", | |
| submit_btn=True, | |
| render=False, | |
| scale=1, | |
| placeholder="請輸入您的問題" | |
| ) | |
| def create_quick_response(samples) -> gr.Dataset: | |
| """Create the quick response suggestions component.""" | |
| return gr.Dataset( | |
| samples=samples, | |
| components=[create_prompt_input()], | |
| render=False, | |
| scale=1 | |
| ) | |
| def create_chat_selector() -> gr.Dropdown: | |
| """Create the chat selection dropdown.""" | |
| return gr.Dropdown( | |
| label="Select Chat", | |
| choices=[], | |
| interactive=True, | |
| container=True, | |
| scale=0 | |
| ) | |
| def create_new_chat_button() -> gr.Button: | |
| """Create the new chat button.""" | |
| return gr.Button( | |
| "New Chat", | |
| size="sm", | |
| ) | |
| def create_hidden_list() -> gr.JSON: | |
| """Create the hidden list component.""" | |
| return gr.JSON( | |
| value=[[]], | |
| render=False, | |
| visible=False | |
| ) | |