Spaces:
Running
Running
DeL-TaiseiOzaki
commited on
Commit
•
0520d98
1
Parent(s):
396927c
- app.py +29 -22
- services/llm_service.py +12 -3
app.py
CHANGED
@@ -77,29 +77,36 @@ st.title("🔍 リポジトリ解析・質問システム")
|
|
77 |
|
78 |
# サイドバーでモデル選択
|
79 |
with st.sidebar:
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
st.session_state.llm_service.switch_model(model.lower())
|
86 |
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
103 |
|
104 |
# URLの入力
|
105 |
repo_url = st.text_input(
|
|
|
77 |
|
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("📌 使い方")
|
96 |
+
st.markdown("""
|
97 |
+
1. GitHubリポジトリのURLを入力
|
98 |
+
2. スキャンを実行
|
99 |
+
3. コードについて質問(最大5ターンの会話が可能)
|
100 |
+
""")
|
101 |
+
|
102 |
+
st.subheader("🔍 スキャン対象")
|
103 |
+
st.markdown("""
|
104 |
+
- Python (.py)
|
105 |
+
- JavaScript (.js)
|
106 |
+
- Java (.java)
|
107 |
+
- C/C++ (.c, .h, .cpp, .hpp)
|
108 |
+
- その他の主要なプログラミング言語
|
109 |
+
""")
|
110 |
|
111 |
# URLの入力
|
112 |
repo_url = st.text_input(
|
services/llm_service.py
CHANGED
@@ -28,9 +28,18 @@ class LLMService:
|
|
28 |
|
29 |
def switch_model(self, model: str):
|
30 |
"""使用するモデルを切り替え"""
|
31 |
-
|
32 |
-
|
33 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
34 |
|
35 |
def create_prompt(self, content: str, query: str) -> str:
|
36 |
"""プロンプトを生成"""
|
|
|
28 |
|
29 |
def switch_model(self, model: str):
|
30 |
"""使用するモデルを切り替え"""
|
31 |
+
model_name = model.lower()
|
32 |
+
if model_name == "claude" and self.settings.anthropic_api_key:
|
33 |
+
self.current_model = "claude"
|
34 |
+
elif model_name == "openai" and self.settings.openai_api_key:
|
35 |
+
self.current_model = "openai"
|
36 |
+
else:
|
37 |
+
available = []
|
38 |
+
if self.settings.anthropic_api_key:
|
39 |
+
available.append("claude")
|
40 |
+
if self.settings.openai_api_key:
|
41 |
+
available.append("openai")
|
42 |
+
raise ValueError(f"利用可能なモデル: {', '.join(available)}")
|
43 |
|
44 |
def create_prompt(self, content: str, query: str) -> str:
|
45 |
"""プロンプトを生成"""
|