Commit
·
01a4939
1
Parent(s):
d0f0456
fix: fixed submit bug in talk to drias
Browse files- front/tabs/tab_drias.py +8 -35
front/tabs/tab_drias.py
CHANGED
@@ -180,6 +180,13 @@ def setup_drias_events(ui_elements: DriasUIElements, share_client=None, user_id=
|
|
180 |
table_names_list = gr.State([])
|
181 |
user_id = gr.State(user_id)
|
182 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
183 |
# Handle example selection
|
184 |
ui_elements["examples_hidden"].change(
|
185 |
lambda x: (gr.Accordion(open=False), gr.Textbox(value=x)),
|
@@ -217,41 +224,7 @@ def setup_drias_events(ui_elements: DriasUIElements, share_client=None, user_id=
|
|
217 |
],
|
218 |
)
|
219 |
|
220 |
-
|
221 |
-
ui_elements["drias_direct_question"].submit(
|
222 |
-
lambda: gr.Accordion(open=False),
|
223 |
-
inputs=None,
|
224 |
-
outputs=[ui_elements["details_accordion"]]
|
225 |
-
).then(
|
226 |
-
lambda : gr.update(visible=False),
|
227 |
-
inputs=None,
|
228 |
-
outputs=ui_elements["image_examples"]
|
229 |
-
).then(
|
230 |
-
ask_drias_query,
|
231 |
-
inputs=[ui_elements["drias_direct_question"], index_state, user_id],
|
232 |
-
outputs=[
|
233 |
-
ui_elements["drias_sql_query"],
|
234 |
-
ui_elements["drias_table"],
|
235 |
-
ui_elements["drias_display"],
|
236 |
-
sql_queries_state,
|
237 |
-
dataframes_state,
|
238 |
-
plots_state,
|
239 |
-
plot_informations_state,
|
240 |
-
index_state,
|
241 |
-
table_names_list,
|
242 |
-
ui_elements["result_text"],
|
243 |
-
],
|
244 |
-
).then(
|
245 |
-
show_results,
|
246 |
-
inputs=[sql_queries_state, dataframes_state, plots_state, table_names_list],
|
247 |
-
outputs=[
|
248 |
-
ui_elements["result_text"],
|
249 |
-
ui_elements["query_accordion"],
|
250 |
-
ui_elements["table_accordion"],
|
251 |
-
ui_elements["chart_accordion"],
|
252 |
-
ui_elements["table_names_display"],
|
253 |
-
],
|
254 |
-
)
|
255 |
# Handle model selection change
|
256 |
ui_elements["model_selection"].change(
|
257 |
filter_by_model,
|
|
|
180 |
table_names_list = gr.State([])
|
181 |
user_id = gr.State(user_id)
|
182 |
|
183 |
+
# Handle direct question submission - trigger the same workflow by setting examples_hidden
|
184 |
+
ui_elements["drias_direct_question"].submit(
|
185 |
+
lambda x: gr.update(value=x),
|
186 |
+
inputs=[ui_elements["drias_direct_question"]],
|
187 |
+
outputs=[ui_elements["examples_hidden"]],
|
188 |
+
)
|
189 |
+
|
190 |
# Handle example selection
|
191 |
ui_elements["examples_hidden"].change(
|
192 |
lambda x: (gr.Accordion(open=False), gr.Textbox(value=x)),
|
|
|
224 |
],
|
225 |
)
|
226 |
|
227 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
228 |
# Handle model selection change
|
229 |
ui_elements["model_selection"].change(
|
230 |
filter_by_model,
|