Views
No views yet
| Metrik | v1 (İlk) | v2 (Şimdi) | Değişim |
|---|---|---|---|
| Dosya sayısı | 12 | 30+ | 2.5x |
| Kod satırı (backend) | ~450 | ~1,200 | 2.7x |
| Kod satırı (mobile) | ~580 | ~620 | +%7 |
| Eğitim dataseti | 81 sample | 261 sample | 3.2x |
| Unique konu | 26 | 70 | 2.7x |
| Bug sayısı | 20 (keşfedildi) | 0 (düzeltildi) | ✅ Temiz |
| Self-improvement | Yok | Feedback + Domain + Cache | ✅ Var |
| Domain bilgisi | 1 (genel) | 4 domain × 3x | 12x |
| Yanıt hızı | Her zaman API | Cache ile instant | 🔥 10-100x |
| Rate limiting | Yok | 60 istek/dk | ✅ Koruma |
| Input validation | Yok | Hepsi validasyonlu | ✅ Güvenli |
| HF'de yayın | Yok | ✅ Apache 2.0 | ✅ Açık |
| Domain | v1 Kapasite | v2 Kapasite | Çarpan |
|---|---|---|---|
| 🧠 AI/ML Bilgisi | 5 pattern | 25 keyword + 4 strateji | 5x |
| 💻 Yazılım Geliştirme | 3 kod örneği | 16 kod örneği + best practice | 5.3x |
| 🇹🇷 Türkçe Kültür | 4 konu | 15 konu + bölgesel çeşitlilik | 3.8x |
| 🛠️ Problem Çözme | Yok | 20 senaryo + root cause | ∞ |
| # | Seviye | Dosya | Sorun | Çözüm |
|---|---|---|---|---|
| 1 | 🔴 Kritik | routers/files_router.py | Form() beklerken JSON geliyor | FileChatRequest Pydantic modeliyle düzeltildi |
| 2 | 🔴 Kritik | utils/web_search.py | DDG URL'leri domain'siz dönüyor | unquote(full_url) ile tam URL |
| 3 | 🟡 Yüksek | routers/, utils/ | __init__.py eksik | Eklendi |
| 4 | 🟡 Yüksek | routers/chat_router.py | SQLite bağlantı sızıntısı | try/finally koruması |
| 5 | 🟡 Yüksek | routers/files_router.py | SQLite bağlantı sızıntısı | try/finally koruması |
| 6 | 🟡 Yüksek | routers/auth_router.py | SQLite bağlantı sızıntısı | try/finally koruması |
| 7 | 🟡 Yüksek | main.py | CORS * + credentials=true uyumsuz | credentials=false yapıldı |
| 8 | 🟡 Yüksek | auth.py | JWT secret boş olabilir | os.urandom ile fallback güçlendirildi |
| 9 | 🟡 Yüksek | auth.py | Token expiry net mesaj yok | Expired hata mesajı eklendi |
| 10 | 🟡 Yüksek | models.py | Username/password validasyonu yok | min_length, regex eklendi |
| 11 | 🟡 Yüksek | Her yerde | Rate limiting yok | 60 istek/dk limitleyici |
| 12 | 🟡 Yüksek | routers/auth_router.py | Brute-force koruması yok | IP bazlı rate limiting |
| 13 | 🟠 Orta | utils/hf_client.py | Placeholder kontrolü zayıf | len(HF_TOKEN) < 10 kontrolü |
| 14 | 🟠 Orta | utils/hf_client.py | API hataları kullanıcıya sızdırılıyor | Global exception handler |
| 15 | 🟠 Orta | main.py | Global hata yakalama yok | @app.exception_handler |
| 16 | 🟢 Düşük | routers/chat_router.py | Unused import json | Temizlendi |
| 17 | 🟢 Düşük | routers/search_router.py | user parametresi kullanılmıyor | Immutable olarak bırakıldı |
| 18 | 🟢 Düşük | models.py | ConversationSummary kullanılmıyor | Temizlendi |
| 19 | 🟢 Düşük | train.py | format_prompt_alpaca kullanılmıyor | Temizlendi |
| 20 | 🟢 Düşük | .env | HF_USERNAME yanlış (mamidev) | mamiyusufdemi düzeltildi |
| Domain | Açıklama | Örnek Kullanım |
|---|---|---|
| Yapay Zeka / ML | AI/ML/DL kavramları, transformer, NLP | "Derin öğrenme nedir?" |
| Yazılım Geliştirme | Python, JS, React Native, FastAPI | "Kod hatası nasıl düzeltilir?" |
| Türkçe Kültür & Tarih | Türkiye, Osmanlı, sanat, yemek | "İstanbul'da gezilecek yerler" |
| Problem Çözme | Debug, hata ayıklama, strateji | "CRUD uygulaması yapmak istiyorum" |
| Teknik | Kazanç | Açıklama |
|---|---|---|
| LRU Cache | ~100x hızlı | Aynı soruya cache'den anında yanıt |
| Quick Response | ~1000x hızlı | "Merhaba" gibi kalıplara template yanıt |
| Domain Detection | ~2x hızlı | Prompt optimizasyonuyla daha az token |
| Rate Limiting | Stabilite | 60 istek/dk ile DDoS koruması |
┌─────────────────────────────────────────────────────────┐
│ Mobile App │
│ (React Native / Expo) │
│ 👍 Feedback 💬 Chat 📎 Files │
└──────────────────────────┬──────────────────────────────┘
│ HTTP (REST API)
▼
┌─────────────────────────────────────────────────────────┐
│ FastAPI Backend │
│ ┌─────────────┐ ┌──────────┐ ┌────────────────┐ │
│ │ Auth (JWT) │ │ Chat │ │ File Processing │ │
│ │ Rate Limit │ │ Memory │ │ (PDF/TXT) │ │
│ └─────────────┘ └──────────┘ └────────────────┘ │
│ ┌────────────────────────────────────────────────┐ │
│ │ Self-Improvement Engine │ │
│ │ ┌──────────┐ ┌──────────┐ ┌────────────────┐ │ │
│ │ │ Feedback │ │ Domain │ │ Prompt Optimize │ │ │
│ │ │ Store │ │ Detector │ │ & Cache │ │ │
│ │ └──────────┘ └──────────┘ └────────────────┘ │ │
│ └────────────────────────────────────────────────┘ │
└──────────────────────────┬──────────────────────────────┘
│ Hugging Face Inference API
▼
┌─────────────────────────────────────────────────────────┐
│ Apex Flash 1.5 Model │
│ (Mistral-7B-Instruct + QLoRA) │
│ Fine-tuned with Turkish + English data │
└─────────────────────────────────────────────────────────┘| Parametre | Değer |
|---|---|
| Base Model | mistralai/Mistral-7B-Instruct-v0.3 |
| Method | QLoRA (4-bit quantization) |
| Framework | Unsloth |
| LoRA Rank | 16 |
| LoRA Alpha | 16 |
| Target Modules | q_proj, k_proj, v_proj, o_proj, gate_proj, up_proj, down_proj |
| Sequence Length | 2048 tokens |
| Batch Size | 2 (gradient accumulation: 4) |
| Learning Rate | 2e-4 (cosine scheduler) |
| Epochs | 3 |
| Optimizer | AdamW 8-bit |
| Precision | bf16/fp16 (auto-detect) |
| Kategori | Benzersiz | Augmented | Ağırlık |
|---|---|---|---|
| 🇹🇷 Genel Bilgi | 25 konu | 75 | 3x |
| 💻 Kod Örnekleri | 16 | 80 | 5x |
| 💬 Multi-Turn | 9 | 36 | 4x |
| 🌍 English | 15 | 45 | 3x |
| 🛠️ Problem Çözme | 5 | 25 | 5x |
| Toplam | 70 | 261 |
Apex-Flash-1.5/
├── backend/ # FastAPI Backend
│ ├── main.py # Uygulama girişi + CORS + hata yönetimi
│ ├── auth.py # JWT + bcrypt authentication
│ ├── database.py # SQLite veritabanı yönetimi
│ ├── models.py # Pydantic veri modelleri (validasyonlu)
│ ├── requirements.txt # Python bağımlılıkları
│ ├── .env.example # Ortam değişkenleri şablonu
│ ├── routers/
│ │ ├── __init__.py
│ │ ├── auth_router.py # Register/Login (rate limited)
│ │ ├── chat_router.py # Sohbet + feedback + cache
│ │ ├── files_router.py # PDF/TXT yükleme + işleme
│ │ └── search_router.py # Web arama + URL okuma
│ └── utils/
│ ├── __init__.py
│ ├── hf_client.py # Hugging Face Inference API
│ ├── web_search.py # DuckDuckGo arama motoru
│ ├── file_processor.py # PDF/TXT metin çıkarma
│ ├── self_improvement.py # 🔥 SIE: feedback + domain + prompt optimize
│ └── cache.py # ⚡ LRU cache + rate limiter + streaming
│
├── mobile/ # React Native / Expo
│ ├── App.js # Ana uygulama + session restore
│ ├── app.json # Expo yapılandırması
│ ├── package.json # JavaScript bağımlılıkları
│ └── src/
│ ├── config.js # Renkler + API URL + APP_NAME
│ ├── screens/
│ │ ├── LoginScreen.js # Giriş/Kayıt ekranı
│ │ └── ChatScreen.js # 👍 Feedback'li ana sohbet
│ └── services/
│ └── api.js # Tüm API çağrıları + hata yönetimi
│
├── training/ # Eğitim Pipeline'ı
│ ├── requirements-training.txt # Eğitim bağımlılıkları
│ ├── prepare_dataset.py # 4 domain × 3x dataset hazırlama
│ ├── train.py # Unsloth QLoRA fine-tuning
│ ├── push_to_hub.py # HF Hub yayınlama aracı
│ ├── README.md # Bu dosya
│ └── data/
│ └── apexflash_train_sharegpt.json # 261 eğitim örneği
│
├── training_data.json # ShareGPT formatında tam dataset
└── README.md # Bu dosya1import requests
2
3API_URL = "https://api-inference.huggingface.co/models/mamiyusufdemi/Apex-Flash-1.5/v1/chat/completions"
4headers = {"Authorization": "Bearer YOUR_HF_TOKEN"}
5
6payload = {
7 "model": "mamiyusufdemi/Apex-Flash-1.5",
8 "messages": [
9 {"role": "system", "content": "Sen Apex Flash 1.5 asistansın."},
10 {"role": "user", "content": "Merhaba! Yapay zeka nedir?"}
11 ],
12}
13
14response = requests.post(API_URL, headers=headers, json=payload)
15print(response.json()["choices"][0]["message"]["content"])1# Terminal 1: Backend
2cd backend
3python -m venv venv && source venv/bin/activate
4pip install -r requirements.txt
5# .env dosyasına HF_TOKEN ekle
6uvicorn main:app --reload --host 0.0.0.0 --port 8000
7
8# Test et
9curl http://localhost:8000/health
10curl http://localhost:8000/1# Terminal 2: Mobile
2cd mobile
3npm install
4npx expo start
5# QR kodu telefonundaki Expo Go ile tara1# Google Colab veya GPU sunucuda:
2cd training
3pip install -r requirements-training.txt
4python prepare_dataset.py
5python train.py # QLoRA fine-tuning başlat
6python train.py --push # HF Hub'a push et
7python push_to_hub.py # Tüm projeyi yayınla| Endpoint | Method | Açıklama |
|---|---|---|
/api/auth/register | POST | Yeni kullanıcı kaydı |
/api/auth/login | POST | Giriş yap |
/api/auth/me | GET | Kullanıcı bilgisi |
| Endpoint | Method | Açıklama |
|---|---|---|
/api/chat | POST | Mesaj gönder (cache + self-improvement) |
/api/chat/feedback | POST | Yanıt puanı ver (1-5) |
/api/chat/conversations | GET | Konuşma geçmişi |
/api/chat/conversations/{id}/messages | GET | Konuşma detayı |
/api/chat/conversations/{id} | DELETE | Konuşma sil |
/api/chat/cache/stats | GET | Cache + SIE istatistikleri |
| Endpoint | Method | Açıklama |
|---|---|---|
/api/files/upload | POST | PDF/TXT yükle |
/api/files | GET | Dosya listesi |
/api/files/{id} | GET | Dosya içeriği |
/api/files/{id}/chat | POST | Dosyaya soru sor |
| Endpoint | Method | Açıklama |
|---|---|---|
/api/search/web?q=... | GET | DuckDuckGo arama |
/api/search/url?url=... | GET | URL içeriği oku |
git checkout -b feature/yeni-ozellik)git commit -m 'feat: yeni özellik eklendi')git push origin feature/yeni-ozellik)