Align Gradio interface dropdowns with logical default values for models and strategies (#59)
This commit was merged in pull request #59.
This commit is contained in:
@@ -75,19 +75,30 @@ class ChatManager:
|
|||||||
with gr.Blocks() as interface:
|
with gr.Blocks() as interface:
|
||||||
gr.Markdown("# 🤖 Agente di Analisi e Consulenza Crypto (Chat)")
|
gr.Markdown("# 🤖 Agente di Analisi e Consulenza Crypto (Chat)")
|
||||||
|
|
||||||
|
# --- Prepara le etichette di default per i dropdown
|
||||||
|
model_labels = self.inputs.list_models_names()
|
||||||
|
default_model_label = self.inputs.team_leader_model.label
|
||||||
|
if default_model_label not in model_labels:
|
||||||
|
default_model_label = model_labels[0] if model_labels else None
|
||||||
|
|
||||||
|
strategy_labels = self.inputs.list_strategies_names()
|
||||||
|
default_strategy_label = self.inputs.strategy.label
|
||||||
|
if default_strategy_label not in strategy_labels:
|
||||||
|
default_strategy_label = strategy_labels[0] if strategy_labels else None
|
||||||
|
|
||||||
# Dropdown provider e stile
|
# Dropdown provider e stile
|
||||||
with gr.Row():
|
with gr.Row():
|
||||||
provider = gr.Dropdown(
|
provider = gr.Dropdown(
|
||||||
choices=self.inputs.list_models_names(),
|
choices=model_labels,
|
||||||
value=self.inputs.team_leader_model.label,
|
value=default_model_label,
|
||||||
type="index",
|
type="index",
|
||||||
label="Modello da usare"
|
label="Modello da usare"
|
||||||
)
|
)
|
||||||
provider.change(fn=self.inputs.choose_team_leader, inputs=provider, outputs=None)
|
provider.change(fn=self.inputs.choose_team_leader, inputs=provider, outputs=None)
|
||||||
|
|
||||||
style = gr.Dropdown(
|
style = gr.Dropdown(
|
||||||
choices=self.inputs.list_strategies_names(),
|
choices=strategy_labels,
|
||||||
value=self.inputs.strategy.label,
|
value=default_strategy_label,
|
||||||
type="index",
|
type="index",
|
||||||
label="Stile di investimento"
|
label="Stile di investimento"
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user