Wen1201 commited on
Commit
b11c56c
·
verified ·
1 Parent(s): e60dddf

Upload app_bayesian.py

Browse files
Files changed (1) hide show
  1. app_bayesian.py +24 -10
app_bayesian.py CHANGED
@@ -113,20 +113,34 @@ st.title("🎲 Bayesian Hierarchical Model Analysis")
113
  st.markdown("### 寶可夢速度對勝率影響的貝氏階層分析")
114
  st.markdown("---")
115
 
116
- # Sidebar
117
- with st.sidebar:
118
- st.header("⚙️ 配置設定")
119
-
120
- # Google Gemini API Key
 
 
 
 
 
121
  api_key = st.text_input(
122
  "Google Gemini API Key",
123
  type="password",
124
- help="輸入您的 Google Gemini API Key 以使用 AI 助手"
125
  )
126
-
127
- if api_key:
128
- st.session_state.api_key = api_key
129
- st.success(" API Key 已載入")
 
 
 
 
 
 
 
 
 
130
 
131
  st.markdown("---")
132
 
 
113
  st.markdown("### 寶可夢速度對勝率影響的貝氏階層分析")
114
  st.markdown("---")
115
 
116
+ # LLM API 選擇
117
+ st.subheader("🤖 AI 助手配置")
118
+
119
+ llm_provider = st.radio(
120
+ "選擇 LLM 服務:",
121
+ ["Google Gemini", "Anthropic Claude"],
122
+ help="選擇要使用的 AI 服務"
123
+ )
124
+
125
+ if llm_provider == "Google Gemini":
126
  api_key = st.text_input(
127
  "Google Gemini API Key",
128
  type="password",
129
+ help="輸入您的 Google Gemini API Key"
130
  )
131
+ api_url = "https://generativelanguage.googleapis.com/v1beta/models/gemini-2.0-flash-exp"
132
+ else: # Anthropic Claude
133
+ api_key = st.text_input(
134
+ "Anthropic Claude API Key",
135
+ type="password",
136
+ help="輸入您的 Anthropic API Key(從 https://console.anthropic.com/ 獲取)"
137
+ )
138
+ api_url = "https://api.anthropic.com/v1/messages"
139
+
140
+ if api_key:
141
+ st.session_state.api_key = api_key
142
+ st.session_state.llm_provider = llm_provider
143
+ st.success(f"✅ {llm_provider} API Key 已載入")
144
 
145
  st.markdown("---")
146