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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
Streamlit UI için modül.
|
| 3 |
+
Bu modül, Streamlit kullanarak web arayüzünü oluşturur.
|
| 4 |
+
"""
|
| 5 |
+
|
| 6 |
+
import streamlit as st
|
| 7 |
+
import os
|
| 8 |
+
from typing import Dict, Any, Optional
|
| 9 |
+
|
| 10 |
+
# Kendi modüllerimizi içe aktar
|
| 11 |
+
from prompt_templates import PROMPT_CATEGORIES
|
| 12 |
+
from chatbot_backend import chatbot, ai_interface
|
| 13 |
+
from api_integrations import (
|
| 14 |
+
api_manager,
|
| 15 |
+
openai_handler,
|
| 16 |
+
gemini_handler,
|
| 17 |
+
openrouter_handler
|
| 18 |
+
)
|
| 19 |
+
|
| 20 |
+
def main():
|
| 21 |
+
"""
|
| 22 |
+
Ana Streamlit uygulaması.
|
| 23 |
+
"""
|
| 24 |
+
# Sayfa yapılandırması
|
| 25 |
+
st.set_page_config(
|
| 26 |
+
page_title="AI Prompt Generator",
|
| 27 |
+
page_icon="🤖",
|
| 28 |
+
layout="wide",
|
| 29 |
+
initial_sidebar_state="expanded"
|
| 30 |
+
)
|
| 31 |
+
|
| 32 |
+
# Session state başlatma
|
| 33 |
+
if "api_keys" not in st.session_state:
|
| 34 |
+
st.session_state.api_keys = {
|
| 35 |
+
"openai": os.getenv("OPENAI_API_KEY", ""),
|
| 36 |
+
"gemini": os.getenv("GEMINI_API_KEY", ""),
|
| 37 |
+
"openrouter": os.getenv("OPENROUTER_API_KEY", "")
|
| 38 |
+
}
|
| 39 |
+
|
| 40 |
+
# Başlık ve açıklama
|
| 41 |
+
st.title("AI Prompt Generator")
|
| 42 |
+
st.markdown("Bu uygulama, AI modellerine verilecek detaylı promptlar oluşturmanıza yardımcı olur.")
|
| 43 |
+
|
| 44 |
+
# Sidebar - API anahtarları
|
| 45 |
+
with st.sidebar:
|
| 46 |
+
st.header("API Anahtarları")
|
| 47 |
+
|
| 48 |
+
st.info("API anahtarlarınızı girin. Bu anahtarlar oturum süresince saklanır ve sayfayı yenilediğinizde silinir.")
|
| 49 |
+
|
| 50 |
+
# OpenAI API anahtarı
|
| 51 |
+
openai_api_key = st.text_input(
|
| 52 |
+
"OpenAI API Anahtarı",
|
| 53 |
+
type="password",
|
| 54 |
+
value=st.session_state.api_keys.get("openai", "")
|
| 55 |
+
)
|
| 56 |
+
|
| 57 |
+
# Google Gemini API anahtarı
|
| 58 |
+
gemini_api_key = st.text_input(
|
| 59 |
+
"Google Gemini API Anahtarı",
|
| 60 |
+
type="password",
|
| 61 |
+
value=st.session_state.api_keys.get("gemini", "")
|
| 62 |
+
)
|
| 63 |
+
|
| 64 |
+
# OpenRouter API anahtarı
|
| 65 |
+
openrouter_api_key = st.text_input(
|
| 66 |
+
"OpenRouter API Anahtarı",
|
| 67 |
+
type="password",
|
| 68 |
+
value=st.session_state.api_keys.get("openrouter", "")
|
| 69 |
+
)
|
| 70 |
+
|
| 71 |
+
# API anahtarlarını kaydet
|
| 72 |
+
if st.button("API Anahtarlarını Kaydet"):
|
| 73 |
+
# Session state'e API anahtarlarını kaydet
|
| 74 |
+
st.session_state.api_keys = {
|
| 75 |
+
"openai": openai_api_key,
|
| 76 |
+
"gemini": gemini_api_key,
|
| 77 |
+
"openrouter": openrouter_api_key
|
| 78 |
+
}
|
| 79 |
+
|
| 80 |
+
# API anahtarlarını ayarla
|
| 81 |
+
api_manager.set_api_key("openai", openai_api_key)
|
| 82 |
+
api_manager.set_api_key("gemini", gemini_api_key)
|
| 83 |
+
api_manager.set_api_key("openrouter", openrouter_api_key)
|
| 84 |
+
|
| 85 |
+
# API işleyicilerine de anahtarları ayarla
|
| 86 |
+
openai_handler.set_api_key(openai_api_key)
|
| 87 |
+
gemini_handler.set_api_key(gemini_api_key)
|
| 88 |
+
openrouter_handler.set_api_key(openrouter_api_key)
|
| 89 |
+
|
| 90 |
+
# Chatbot'un AI prompt generator'ına da anahtarları ayarla
|
| 91 |
+
chatbot.ai_generator.set_api_key("openai", openai_api_key)
|
| 92 |
+
chatbot.ai_generator.set_api_key("gemini", gemini_api_key)
|
| 93 |
+
chatbot.ai_generator.set_api_key("openrouter", openrouter_api_key)
|
| 94 |
+
|
| 95 |
+
st.success("API anahtarları başarıyla kaydedildi!")
|
| 96 |
+
|
| 97 |
+
# API anahtarlarının durumunu göster
|
| 98 |
+
with st.expander("API Anahtarı Durumu", expanded=False):
|
| 99 |
+
openai_status = "✅ Ayarlandı" if st.session_state.api_keys.get("openai") else "❌ Ayarlanmadı"
|
| 100 |
+
gemini_status = "✅ Ayarlandı" if st.session_state.api_keys.get("gemini") else "❌ Ayarlanmadı"
|
| 101 |
+
openrouter_status = "✅ Ayarlandı" if st.session_state.api_keys.get("openrouter") else "❌ Ayarlanmadı"
|
| 102 |
+
|
| 103 |
+
st.write(f"OpenAI API: {openai_status}")
|
| 104 |
+
st.write(f"Gemini API: {gemini_status}")
|
| 105 |
+
st.write(f"OpenRouter API: {openrouter_status}")
|
| 106 |
+
|
| 107 |
+
# AI modeli seçimi
|
| 108 |
+
st.header("AI Modeli Seçimi")
|
| 109 |
+
|
| 110 |
+
# API sağlayıcısı seçimi
|
| 111 |
+
provider = st.selectbox(
|
| 112 |
+
"API Sağlayıcısı",
|
| 113 |
+
["OpenAI", "Google Gemini", "OpenRouter"],
|
| 114 |
+
index=0
|
| 115 |
+
)
|
| 116 |
+
|
| 117 |
+
# Seçilen sağlayıcıya göre model listesini al
|
| 118 |
+
provider_key = provider.lower().replace(" ", "_")
|
| 119 |
+
if provider_key == "google_gemini":
|
| 120 |
+
provider_key = "gemini"
|
| 121 |
+
|
| 122 |
+
# Modelleri al
|
| 123 |
+
models = []
|
| 124 |
+
if provider_key == "openai":
|
| 125 |
+
models = openai_handler.get_available_models()
|
| 126 |
+
elif provider_key == "gemini":
|
| 127 |
+
models = gemini_handler.get_available_models()
|
| 128 |
+
elif provider_key == "openrouter":
|
| 129 |
+
models = openrouter_handler.get_available_models()
|
| 130 |
+
|
| 131 |
+
# Model seçimi
|
| 132 |
+
selected_model = None
|
| 133 |
+
if models:
|
| 134 |
+
selected_model = st.selectbox("Model", models)
|
| 135 |
+
|
| 136 |
+
# Ana içerik
|
| 137 |
+
col1, col2 = st.columns([1, 1])
|
| 138 |
+
|
| 139 |
+
with col1:
|
| 140 |
+
st.header("Prompt Oluştur")
|
| 141 |
+
|
| 142 |
+
# Kullanıcı girdisi
|
| 143 |
+
user_input = st.text_area(
|
| 144 |
+
"Ne yapmak istediğinizi açıklayın:",
|
| 145 |
+
height=150,
|
| 146 |
+
placeholder="Örnek: Bir e-ticaret web sitesi yapmak istiyorum. Ürünleri listeleyebilmeli, sepete ekleyebilmeli ve ödeme alabilmeliyim."
|
| 147 |
+
)
|
| 148 |
+
|
| 149 |
+
# AI destekli prompt oluşturma seçeneği
|
| 150 |
+
if "use_ai_generation" not in st.session_state:
|
| 151 |
+
st.session_state.use_ai_generation = True
|
| 152 |
+
|
| 153 |
+
use_ai_generation = st.checkbox(
|
| 154 |
+
"AI destekli prompt oluşturma kullan",
|
| 155 |
+
value=st.session_state.use_ai_generation,
|
| 156 |
+
key="use_ai_generation_checkbox"
|
| 157 |
+
)
|
| 158 |
+
|
| 159 |
+
# Checkbox değiştiğinde session state'i güncelle
|
| 160 |
+
st.session_state.use_ai_generation = use_ai_generation
|
| 161 |
+
|
| 162 |
+
# API anahtarı kontrolü ve uyarı
|
| 163 |
+
selected_provider_key = provider.lower().replace(" ", "_")
|
| 164 |
+
if selected_provider_key == "google_gemini":
|
| 165 |
+
selected_provider_key = "gemini"
|
| 166 |
+
|
| 167 |
+
if use_ai_generation and not st.session_state.api_keys.get(selected_provider_key):
|
| 168 |
+
st.warning(f"AI destekli prompt oluşturma için {provider} API anahtarı gereklidir. Lütfen API anahtarınızı girin ve 'API Anahtarlarını Kaydet' butonuna tıklayın.")
|
| 169 |
+
|
| 170 |
+
# Prompt oluştur butonu
|
| 171 |
+
if st.button("Prompt Oluştur"):
|
| 172 |
+
if user_input:
|
| 173 |
+
with st.spinner("Prompt oluşturuluyor..."):
|
| 174 |
+
# Prompt oluştur
|
| 175 |
+
provider_key = provider.lower().replace(" ", "_")
|
| 176 |
+
if provider_key == "google_gemini":
|
| 177 |
+
provider_key = "gemini"
|
| 178 |
+
|
| 179 |
+
# API anahtarı kontrolü
|
| 180 |
+
if use_ai_generation and not st.session_state.api_keys.get(provider_key):
|
| 181 |
+
st.error(f"AI destekli prompt oluşturma için {provider} API anahtarı gereklidir. Lütfen API anahtarınızı girin ve 'API Anahtarlarını Kaydet' butonuna tıklayın.")
|
| 182 |
+
else:
|
| 183 |
+
# Debug bilgisi
|
| 184 |
+
st.session_state.debug_info = {
|
| 185 |
+
"use_ai_generation": use_ai_generation,
|
| 186 |
+
"provider": provider_key,
|
| 187 |
+
"model": selected_model,
|
| 188 |
+
"api_key_set": bool(st.session_state.api_keys.get(provider_key))
|
| 189 |
+
}
|
| 190 |
+
|
| 191 |
+
prompt, category, params = chatbot.process_input(
|
| 192 |
+
user_input,
|
| 193 |
+
use_ai_generation=use_ai_generation,
|
| 194 |
+
provider=provider_key,
|
| 195 |
+
model=selected_model
|
| 196 |
+
)
|
| 197 |
+
|
| 198 |
+
# Sonuçları session state'e kaydet
|
| 199 |
+
st.session_state.prompt = prompt
|
| 200 |
+
st.session_state.category = category
|
| 201 |
+
st.session_state.params = params
|
| 202 |
+
|
| 203 |
+
# Sonuçları göster
|
| 204 |
+
st.success("Prompt başarıyla oluşturuldu!")
|
| 205 |
+
else:
|
| 206 |
+
st.error("Lütfen ne yapmak istediğinizi açıklayın.")
|
| 207 |
+
|
| 208 |
+
with col2:
|
| 209 |
+
st.header("Oluşturulan Prompt")
|
| 210 |
+
|
| 211 |
+
# Debug bilgisi (geliştirme aşamasında)
|
| 212 |
+
if "debug_info" in st.session_state:
|
| 213 |
+
with st.expander("Debug Bilgisi", expanded=False):
|
| 214 |
+
st.write(st.session_state.debug_info)
|
| 215 |
+
|
| 216 |
+
# Oluşturulan promptu göster
|
| 217 |
+
if "prompt" in st.session_state:
|
| 218 |
+
st.subheader(f"Kategori: {st.session_state.category}")
|
| 219 |
+
|
| 220 |
+
# Parametreleri göster
|
| 221 |
+
if st.session_state.params:
|
| 222 |
+
with st.expander("Parametreler", expanded=False):
|
| 223 |
+
for key, value in st.session_state.params.items():
|
| 224 |
+
st.write(f"**{key}:** {value}")
|
| 225 |
+
|
| 226 |
+
# Promptu göster
|
| 227 |
+
st.text_area(
|
| 228 |
+
"Prompt:",
|
| 229 |
+
value=st.session_state.prompt,
|
| 230 |
+
height=400,
|
| 231 |
+
disabled=True
|
| 232 |
+
)
|
| 233 |
+
|
| 234 |
+
# Promptu kopyala butonu
|
| 235 |
+
if st.button("Promptu Kopyala"):
|
| 236 |
+
st.code(st.session_state.prompt)
|
| 237 |
+
st.info("Yukarıdaki kodu seçip kopyalayabilirsiniz.")
|
| 238 |
+
|
| 239 |
+
# AI ile Test Et bölümü
|
| 240 |
+
st.subheader("AI ile Test Et")
|
| 241 |
+
|
| 242 |
+
# Test için API sağlayıcısı seçimi
|
| 243 |
+
test_provider = st.selectbox(
|
| 244 |
+
"Test için API Sağlayıcısı",
|
| 245 |
+
["OpenAI", "Google Gemini", "OpenRouter"],
|
| 246 |
+
index=0,
|
| 247 |
+
key="test_provider"
|
| 248 |
+
)
|
| 249 |
+
|
| 250 |
+
# Test için model seçimi
|
| 251 |
+
test_provider_key = test_provider.lower().replace(" ", "_")
|
| 252 |
+
if test_provider_key == "google_gemini":
|
| 253 |
+
test_provider_key = "gemini"
|
| 254 |
+
|
| 255 |
+
# Test için modelleri al
|
| 256 |
+
test_models = []
|
| 257 |
+
if test_provider_key == "openai":
|
| 258 |
+
test_models = openai_handler.get_available_models()
|
| 259 |
+
elif test_provider_key == "gemini":
|
| 260 |
+
test_models = gemini_handler.get_available_models()
|
| 261 |
+
elif test_provider_key == "openrouter":
|
| 262 |
+
test_models = openrouter_handler.get_available_models()
|
| 263 |
+
|
| 264 |
+
# Test için model seçimi
|
| 265 |
+
test_selected_model = None
|
| 266 |
+
if test_models:
|
| 267 |
+
test_selected_model = st.selectbox("Test için Model", test_models, key="test_model")
|
| 268 |
+
|
| 269 |
+
# Test için API anahtarı giriş alanı
|
| 270 |
+
st.markdown("### Test için API Anahtarı")
|
| 271 |
+
st.info("Test için API anahtarını doğrudan buraya girebilirsiniz.")
|
| 272 |
+
|
| 273 |
+
test_api_key = st.text_input(
|
| 274 |
+
f"{test_provider} API Anahtarı (Test için)",
|
| 275 |
+
type="password",
|
| 276 |
+
key="test_api_key"
|
| 277 |
+
)
|
| 278 |
+
|
| 279 |
+
# Kod şablonları oluşturma seçeneği
|
| 280 |
+
generate_code_templates = st.checkbox("Kod şablonları ve dizin yapısı oluştur", value=True, key="generate_code_templates")
|
| 281 |
+
|
| 282 |
+
# AI ile Test Et butonu
|
| 283 |
+
if st.button("AI ile Test Et"):
|
| 284 |
+
if "prompt" in st.session_state:
|
| 285 |
+
if not test_api_key:
|
| 286 |
+
st.error(f"Lütfen test için {test_provider} API anahtarını girin.")
|
| 287 |
+
else:
|
| 288 |
+
with st.spinner("AI yanıtı alınıyor..."):
|
| 289 |
+
if generate_code_templates:
|
| 290 |
+
# Kod şablonları ile yanıt al
|
| 291 |
+
result = ai_interface.generate_response_with_code_templates(
|
| 292 |
+
test_provider_key,
|
| 293 |
+
st.session_state.prompt,
|
| 294 |
+
test_selected_model,
|
| 295 |
+
test_api_key
|
| 296 |
+
)
|
| 297 |
+
|
| 298 |
+
# Yanıtı ve şablonları session state'e kaydet
|
| 299 |
+
st.session_state.ai_response = result["response"]
|
| 300 |
+
st.session_state.code_templates = result["templates"]
|
| 301 |
+
else:
|
| 302 |
+
# Sadece yanıt al
|
| 303 |
+
response = ai_interface.generate_response(
|
| 304 |
+
test_provider_key,
|
| 305 |
+
st.session_state.prompt,
|
| 306 |
+
test_selected_model,
|
| 307 |
+
test_api_key
|
| 308 |
+
)
|
| 309 |
+
|
| 310 |
+
# Yanıtı session state'e kaydet
|
| 311 |
+
st.session_state.ai_response = response
|
| 312 |
+
if "code_templates" in st.session_state:
|
| 313 |
+
del st.session_state.code_templates
|
| 314 |
+
|
| 315 |
+
# Yanıtı göster
|
| 316 |
+
st.success("AI yanıtı başarıyla alındı!")
|
| 317 |
+
else:
|
| 318 |
+
st.error("Lütfen önce bir prompt oluşturun.")
|
| 319 |
+
|
| 320 |
+
# AI yanıtını göster
|
| 321 |
+
if "ai_response" in st.session_state:
|
| 322 |
+
st.subheader("AI Yanıtı")
|
| 323 |
+
st.text_area(
|
| 324 |
+
"Yanıt:",
|
| 325 |
+
value=st.session_state.ai_response,
|
| 326 |
+
height=400,
|
| 327 |
+
disabled=True
|
| 328 |
+
)
|
| 329 |
+
|
| 330 |
+
# Kod şablonları ve dizin yapısı varsa göster
|
| 331 |
+
if "code_templates" in st.session_state:
|
| 332 |
+
templates = st.session_state.code_templates
|
| 333 |
+
|
| 334 |
+
# Dizin yapısı
|
| 335 |
+
if templates["directory_structure"]:
|
| 336 |
+
with st.expander("📁 Dizin Yapısı", expanded=True):
|
| 337 |
+
for structure in templates["directory_structure"]:
|
| 338 |
+
st.code(structure, language="bash")
|
| 339 |
+
|
| 340 |
+
# Kod şablonları
|
| 341 |
+
if templates["code_templates"]:
|
| 342 |
+
with st.expander("💻 Kod Şablonları", expanded=True):
|
| 343 |
+
for template in templates["code_templates"]:
|
| 344 |
+
st.subheader(f"{template['language'].capitalize()} Dosyası")
|
| 345 |
+
st.code(template["code"], language=template["language"])
|
| 346 |
+
|
| 347 |
+
# Uygulama adımları
|
| 348 |
+
if templates["implementation_steps"]:
|
| 349 |
+
with st.expander("📝 Uygulama Adımları", expanded=True):
|
| 350 |
+
for i, step in enumerate(templates["implementation_steps"]):
|
| 351 |
+
if not step.startswith(f"{i+1}.") and not step.startswith("##"):
|
| 352 |
+
st.markdown(f"**Adım {i+1}:** {step}")
|
| 353 |
+
else:
|
| 354 |
+
st.markdown(step)
|
| 355 |
+
else:
|
| 356 |
+
st.info("Henüz bir prompt oluşturulmadı. Sol taraftaki formu doldurup 'Prompt Oluştur' butonuna tıklayın.")
|
| 357 |
+
|
| 358 |
+
# Kategori bilgileri
|
| 359 |
+
st.header("Desteklenen Kategoriler")
|
| 360 |
+
|
| 361 |
+
# Kategorileri göster
|
| 362 |
+
categories_per_row = 3
|
| 363 |
+
categories = list(PROMPT_CATEGORIES.keys())
|
| 364 |
+
|
| 365 |
+
for i in range(0, len(categories), categories_per_row):
|
| 366 |
+
cols = st.columns(categories_per_row)
|
| 367 |
+
for j in range(categories_per_row):
|
| 368 |
+
if i + j < len(categories):
|
| 369 |
+
with cols[j]:
|
| 370 |
+
category = categories[i + j]
|
| 371 |
+
st.subheader(category)
|
| 372 |
+
if isinstance(PROMPT_CATEGORIES[category], dict) and "description" in PROMPT_CATEGORIES[category]:
|
| 373 |
+
st.write(PROMPT_CATEGORIES[category]["description"])
|
| 374 |
+
else:
|
| 375 |
+
st.write("Bu kategori için açıklama bulunmuyor.")
|
| 376 |
+
|
| 377 |
+
# Footer
|
| 378 |
+
st.markdown("---")
|
| 379 |
+
st.markdown("© 2025 AI Prompt Generator | Tüm hakları saklıdır.")
|
| 380 |
+
|
| 381 |
+
if __name__ == "__main__":
|
| 382 |
+
main()
|