refactor(frontend): 重构数据集生成页面的变量命名逻辑

- 将 prompt_choices 变量重命名为 prompt_list,以更准确地反映其内容
- 更新相关代码中对这两个变量的引用,以保持一致性
This commit is contained in:
carry 2025-04-15 15:40:24 +08:00
parent d0aebd17fa
commit 6b87dcb58f

View File

@ -23,11 +23,11 @@ def dataset_generate_page():
with gr.Column(): with gr.Column():
# 获取模板列表并设置初始值 # 获取模板列表并设置初始值
prompts = get_prompt_store().all() prompts = get_prompt_store().all()
prompt_choices = [f"{p['id']} {p['name']}" for p in prompts] prompt_list = [f"{p['id']} {p['name']}" for p in prompts]
initial_prompt = prompt_choices[0] if prompt_choices else None initial_prompt = prompt_list[0] if prompt_list else None
prompt_dropdown = gr.Dropdown( prompt_dropdown = gr.Dropdown(
choices=prompt_choices, choices=prompt_list,
value=initial_prompt, # 设置初始选中项 value=initial_prompt, # 设置初始选中项
label="选择模板", label="选择模板",
allow_custom_value=True, allow_custom_value=True,