Spaces:
Running
Running
feat: Update the Quick Start Examples
Browse files- ui/components/input_form.py +20 -5
ui/components/input_form.py
CHANGED
|
@@ -27,13 +27,27 @@ def create_input_form(agent_stream_html):
|
|
| 27 |
gr.Markdown("##### ⚡ Quick Start Examples")
|
| 28 |
|
| 29 |
# 定義範例文字
|
| 30 |
-
ex_text_1 = "
|
| 31 |
-
|
| 32 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 33 |
with gr.Column(elem_classes="example-container"):
|
| 34 |
-
# 這是真的按鈕,絕對會垂直排列,絕對不會被壓縮
|
| 35 |
btn_ex1 = gr.Button(ex_text_1, size="sm", variant="secondary", elem_classes="example-btn")
|
| 36 |
-
btn_ex2 = gr.Button(ex_text_2, size="sm", variant="secondary", elem_classes="example-btn")
|
|
|
|
| 37 |
|
| 38 |
# 4. 主按鈕
|
| 39 |
analyze_btn = gr.Button("🚀 Analyze & Plan Trip", variant="primary", size="lg")
|
|
@@ -108,6 +122,7 @@ def create_input_form(agent_stream_html):
|
|
| 108 |
# 點擊按鈕 -> 把按鈕文字填入 user_input
|
| 109 |
btn_ex1.click(lambda: ex_text_1, outputs=user_input)
|
| 110 |
btn_ex2.click(lambda: ex_text_2, outputs=user_input)
|
|
|
|
| 111 |
|
| 112 |
return (input_area, agent_stream_output, user_input, auto_location,
|
| 113 |
location_inputs, lat_input, lon_input, analyze_btn)
|
|
|
|
| 27 |
gr.Markdown("##### ⚡ Quick Start Examples")
|
| 28 |
|
| 29 |
# 定義範例文字
|
| 30 |
+
ex_text_1 = "Errands run: Post office, bank, and supermarket. Start at tomorrow 10 AM, finish by 1 PM."
|
| 31 |
+
|
| 32 |
+
ex_text_2 = """
|
| 33 |
+
I need to run some errands tomorrow morning starting at 9:30 AM.
|
| 34 |
+
1. Go to a Bank.
|
| 35 |
+
2. Drop off a package at the Post Office.
|
| 36 |
+
3. Buy groceries.
|
| 37 |
+
I need to be back home by 1:00 PM for a meeting.
|
| 38 |
+
"""
|
| 39 |
+
|
| 40 |
+
ex_text_3 = """
|
| 41 |
+
I am arriving at Cordoba Train Station next Sunday at 11:00 AM.
|
| 42 |
+
1. I want to visit the magnificent 'Mezquita-Catedral'.
|
| 43 |
+
2. Walk across the 'Roman Bridge' for photos.
|
| 44 |
+
3. Find a place to eat the famous 'Salmorejo' for lunch.
|
| 45 |
+
I need to be back at the station to catch my return train by 4:30 PM.
|
| 46 |
+
"""
|
| 47 |
with gr.Column(elem_classes="example-container"):
|
|
|
|
| 48 |
btn_ex1 = gr.Button(ex_text_1, size="sm", variant="secondary", elem_classes="example-btn")
|
| 49 |
+
btn_ex2 = gr.Button(ex_text_2[:100]+'...' if len(ex_text_2)>100 else ex_text_2, size="sm", variant="secondary", elem_classes="example-btn")
|
| 50 |
+
btn_ex3 = gr.Button(ex_text_3[:100]+'...' if len(ex_text_3)>100 else ex_text_3, size="sm", variant="secondary", elem_classes="example-btn")
|
| 51 |
|
| 52 |
# 4. 主按鈕
|
| 53 |
analyze_btn = gr.Button("🚀 Analyze & Plan Trip", variant="primary", size="lg")
|
|
|
|
| 122 |
# 點擊按鈕 -> 把按鈕文字填入 user_input
|
| 123 |
btn_ex1.click(lambda: ex_text_1, outputs=user_input)
|
| 124 |
btn_ex2.click(lambda: ex_text_2, outputs=user_input)
|
| 125 |
+
btn_ex3.click(lambda: ex_text_3, outputs=user_input)
|
| 126 |
|
| 127 |
return (input_area, agent_stream_output, user_input, auto_location,
|
| 128 |
location_inputs, lat_input, lon_input, analyze_btn)
|