Spaces:
Running
Running
DeL-TaiseiOzaki
commited on
Commit
•
01d6d0e
1
Parent(s):
90efa48
ss
Browse files- app.py +7 -0
- config/llm_settings.py +11 -16
app.py
CHANGED
@@ -165,6 +165,13 @@ if st.session_state.temp_dir and Path(st.session_state.temp_dir).exists():
|
|
165 |
|
166 |
# サイドバー情報
|
167 |
with st.sidebar:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
168 |
st.subheader("📌 使い方")
|
169 |
st.markdown("""
|
170 |
1. GitHubリポジトリのURLを入力
|
|
|
165 |
|
166 |
# サイドバー情報
|
167 |
with st.sidebar:
|
168 |
+
model = st.radio(
|
169 |
+
"使用するモデル",
|
170 |
+
["Claude", "OpenAI"],
|
171 |
+
key="model_selection"
|
172 |
+
)
|
173 |
+
st.session_state.llm_service.switch_model(model.lower())
|
174 |
+
st.divider()
|
175 |
st.subheader("📌 使い方")
|
176 |
st.markdown("""
|
177 |
1. GitHubリポジトリのURLを入力
|
config/llm_settings.py
CHANGED
@@ -1,24 +1,19 @@
|
|
1 |
import os
|
2 |
from dotenv import load_dotenv
|
3 |
-
from typing import Literal
|
4 |
|
5 |
class LLMSettings:
|
6 |
def __init__(self):
|
7 |
load_dotenv()
|
8 |
-
|
9 |
-
self.openai_api_key = os.getenv(
|
10 |
-
self.
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
if not self.openai_api_key and not self.anthropic_api_key:
|
15 |
-
raise ValueError("少なくとも1つのAPIキーが必要です。")
|
16 |
-
|
17 |
-
def get_available_models(self) -> list[Literal['claude', 'gpt']]:
|
18 |
-
"""利用可能なモデルのリストを返す"""
|
19 |
-
models = []
|
20 |
if self.anthropic_api_key:
|
21 |
-
|
22 |
if self.openai_api_key:
|
23 |
-
|
24 |
-
|
|
|
|
|
|
1 |
import os
|
2 |
from dotenv import load_dotenv
|
|
|
3 |
|
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
|