From 84b01a07a2a905e3f8565b131a05dadbeefff6f5 Mon Sep 17 00:00:00 2001 From: xyz <123456@gmail.com> Date: Wed, 7 Jan 2026 13:56:37 +0800 Subject: [PATCH] feat: implement council v3 round-table mode --- app.py | 40 +++++++++++++++++++++++++++++----------- 1 file changed, 29 insertions(+), 11 deletions(-) diff --git a/app.py b/app.py index 56a6a56..e000949 100644 --- a/app.py +++ b/app.py @@ -107,17 +107,35 @@ if "research_steps_output" not in st.session_state: with st.sidebar: st.header("⚙️ 设置") - # 全局 API Key 设置 - with st.expander("🔑 API Key 设置", expanded=True): - use_custom_key = st.checkbox("使用自定义 API Key") - if use_custom_key: - api_key = st.text_input( - "API Key", - type="password", - help="留空则使用环境变量中的 Key" - ) - else: - api_key = DEFAULT_API_KEY + # 全局 API Key & Provider 设置 + with st.expander("🔑 API / Provider 设置", expanded=True): + # Provider Selection + selected_provider_label = st.selectbox( + "选择 API 提供商", + options=list(config.LLM_PROVIDERS.keys()), + index=0 + ) + + provider_config = config.LLM_PROVIDERS[selected_provider_label] + provider_id = selected_provider_label.lower() + + # API Key Input + default_key = os.getenv(provider_config["api_key_var"], "") + api_key = st.text_input( + f"{selected_provider_label} API Key", + type="password", + value=default_key, + help=f"环境变量: {provider_config['api_key_var']}" + ) + + # Base URL + base_url = st.text_input( + "API Base URL", + value=provider_config["base_url"] + ) + + if not api_key: + st.warning("请配置 API Key 以继续") st.divider()