DeL-TaiseiOzaki commited on
Commit
1e951c6
1 Parent(s): 0520d98
Files changed (2) hide show
  1. app.py +7 -1
  2. config/llm_settings.py +15 -6
app.py CHANGED
@@ -78,18 +78,24 @@ st.title("🔍 リポジトリ解析・質問システム")
78
  # サイドバーでモデル選択
79
  with st.sidebar:
80
  available_models = []
 
 
 
 
81
  if st.session_state.llm_service.settings.anthropic_api_key:
82
  available_models.append("Claude")
83
  if st.session_state.llm_service.settings.openai_api_key:
84
  available_models.append("OpenAI")
85
 
 
 
86
  if available_models:
87
  model = st.radio(
88
  "使用するモデル",
89
  available_models,
90
  key="model_selection"
91
  )
92
- st.session_state.llm_service.switch_model(model.lower())
93
 
94
  st.divider()
95
  st.subheader("📌 使い方")
 
78
  # サイドバーでモデル選択
79
  with st.sidebar:
80
  available_models = []
81
+ # デバッグ表示
82
+ st.write("Checking API keys...")
83
+ st.write(f"Anthropic API key present: {bool(st.session_state.llm_service.settings.anthropic_api_key)}")
84
+
85
  if st.session_state.llm_service.settings.anthropic_api_key:
86
  available_models.append("Claude")
87
  if st.session_state.llm_service.settings.openai_api_key:
88
  available_models.append("OpenAI")
89
 
90
+ st.write(f"Available models: {available_models}")
91
+
92
  if available_models:
93
  model = st.radio(
94
  "使用するモデル",
95
  available_models,
96
  key="model_selection"
97
  )
98
+ st.session_state.llm_service.switch_model(model.lower())
99
 
100
  st.divider()
101
  st.subheader("📌 使い方")
config/llm_settings.py CHANGED
@@ -4,16 +4,25 @@ from dotenv import load_dotenv
4
  class LLMSettings:
5
  def __init__(self):
6
  load_dotenv()
 
 
 
7
  self.anthropic_api_key = os.getenv("ANTHROPIC_API_KEY")
8
  self.openai_api_key = os.getenv("OPENAI_API_KEY")
9
  self.default_llm = "claude"
 
 
 
 
 
 
 
 
10
 
11
  def get_available_models(self):
12
- available_models = []
13
  if self.anthropic_api_key:
14
- available_models.append("claude")
15
  if self.openai_api_key:
16
- available_models.append("openai")
17
- if not available_models:
18
- raise ValueError("APIキーが設定されていません")
19
- return available_models
 
4
  class LLMSettings:
5
  def __init__(self):
6
  load_dotenv()
7
+ # デバッグ用に表示
8
+ print("ANTHROPIC_API_KEY:", bool(os.getenv("ANTHROPIC_API_KEY")))
9
+
10
  self.anthropic_api_key = os.getenv("ANTHROPIC_API_KEY")
11
  self.openai_api_key = os.getenv("OPENAI_API_KEY")
12
  self.default_llm = "claude"
13
+
14
+ # 利用可能なモデルを確認
15
+ available = []
16
+ if self.anthropic_api_key:
17
+ available.append("claude")
18
+ if self.openai_api_key:
19
+ available.append("openai")
20
+ print("Available models:", available)
21
 
22
  def get_available_models(self):
23
+ models = []
24
  if self.anthropic_api_key:
25
+ models.append("claude")
26
  if self.openai_api_key:
27
+ models.append("openai")
28
+ return models