gg
This commit is contained in:
@@ -0,0 +1,155 @@
|
||||
# Changelog - 2026-04-22
|
||||
|
||||
Bu doküman, 22 Nisan 2026 tarihinde `iddaai-fe` ve `iddaai-be` üzerinde yapılan Frekans Motoru (Conditional Frequency Engine) frontend entegrasyonunu özetler.
|
||||
|
||||
## 1. Frekans Motoru — Backend Recap
|
||||
|
||||
- `POST /coupon/frequency-coupon` endpoint'i önceki oturumda tamamlanmıştı.
|
||||
- `SmartCouponService.generateFrequencyBasedCoupon()` metodu aktif ve çalışır durumda.
|
||||
- `FrequencyEngineService` → raw SQL ile `matches` tablosundaki tarihsel veriyi tarayarak oran bandı bazlı sinyal üretiyor.
|
||||
- Strateji: Her takımın ev/deplasman performansını, karşılaştığı oran bandına göre filtreleyip, kombine sinyal (combined_signal) hesaplıyor.
|
||||
|
||||
## 2. Frontend Tip Tanımları
|
||||
|
||||
- `iddaai-fe/src/lib/api/coupons/types.ts` güncellendi.
|
||||
- Eklenen tipler:
|
||||
|
||||
### FrequencyCouponRequestDto
|
||||
```typescript
|
||||
{
|
||||
maxMatches?: number; // 2-5 arası, varsayılan 3
|
||||
minSignal?: number; // 0.50-0.99, kombine sinyal eşiği
|
||||
markets?: string[]; // OU1.5, OU2.5, OU3.5, BTTS, MS
|
||||
}
|
||||
```
|
||||
|
||||
### FrequencyCouponBetDto
|
||||
```typescript
|
||||
{
|
||||
match_id: string;
|
||||
match_name: string;
|
||||
league: string;
|
||||
market: string;
|
||||
pick: string;
|
||||
odds: number;
|
||||
home_signal: number;
|
||||
away_signal: number;
|
||||
combined_signal: number;
|
||||
home_odds_band: string;
|
||||
away_odds_band: string;
|
||||
home_match_count: number;
|
||||
away_match_count: number;
|
||||
league_profile: string; // GOLCU | DEFANSIF | NORMAL
|
||||
}
|
||||
```
|
||||
|
||||
### FrequencyCouponRejectedDto
|
||||
```typescript
|
||||
{
|
||||
match_name: string;
|
||||
reason: string;
|
||||
}
|
||||
```
|
||||
|
||||
### FrequencyCouponResultDto
|
||||
```typescript
|
||||
{
|
||||
bets: FrequencyCouponBetDto[];
|
||||
rejected_matches: FrequencyCouponRejectedDto[];
|
||||
reasoning: string[];
|
||||
total_odds: number;
|
||||
expected_hit_rate: number;
|
||||
expected_value: number;
|
||||
ev_positive: boolean;
|
||||
}
|
||||
```
|
||||
|
||||
## 3. API Service Katmanı
|
||||
|
||||
- `iddaai-fe/src/lib/api/coupons/service.ts` güncellendi.
|
||||
- `generateFrequencyCoupon(dto)` metodu eklendi.
|
||||
- Endpoint: `POST /coupon/frequency-coupon`
|
||||
|
||||
## 4. React Hook
|
||||
|
||||
- `iddaai-fe/src/lib/api/coupons/use-hooks.ts` güncellendi.
|
||||
- `useGenerateFrequencyCoupon()` TanStack Query mutation hook'u eklendi.
|
||||
- `FrequencyCouponRequestDto` import edildi.
|
||||
|
||||
## 5. Çeviri Dosyaları (i18n)
|
||||
|
||||
- `messages/tr.json` ve `messages/en.json` güncellendi.
|
||||
- `coupons` namespace'ine 30+ yeni anahtar eklendi:
|
||||
|
||||
| Anahtar | TR | EN |
|
||||
|---|---|---|
|
||||
| `freq-engine-title` | Frekans Motoru | Frequency Engine |
|
||||
| `freq-engine-subtitle` | Takımların oran bandına göre tarihsel performansını analiz eder... | Analyzes teams' historical performance by odds band... |
|
||||
| `freq-suggest` | Frekans Kuponu Oluştur | Generate Frequency Coupon |
|
||||
| `freq-min-signal` | Minimum Sinyal | Minimum Signal |
|
||||
| `freq-ev-label` | Beklenen Değer (EV) | Expected Value (EV) |
|
||||
| `freq-hit-rate` | Tahmini İsabet | Est. Hit Rate |
|
||||
| `freq-ev-positive` | +EV Pozitif | +EV Positive |
|
||||
| `freq-combined-signal` | Kombine Sinyal | Combined Signal |
|
||||
| `freq-league-golcu` | Golcü | High-Scoring |
|
||||
| `freq-league-defansif` | Defansif | Defensive |
|
||||
| `engine-mode-label` | Motor Seçimi | Engine Mode |
|
||||
| `engine-mode-help` | AI: Gemini tabanlı yapay zeka tahmini. Frekans: Veritabanı tabanlı istatistiksel analiz. | AI: Gemini-based AI prediction. Frequency: Database-driven statistical analysis. |
|
||||
| `freq-mode-active` | Frekans Motoru aktif | Frequency Engine active |
|
||||
| `ai-mode-active` | AI Motoru aktif | AI Engine active |
|
||||
|
||||
## 6. FrequencyPanel Bileşeni (Yeni Dosya)
|
||||
|
||||
- `iddaai-fe/src/components/coupons/frequency-panel.tsx` oluşturuldu.
|
||||
- Bağımsız (standalone) bileşen, kendi state ve mutation yönetimini içerir.
|
||||
|
||||
### Bileşen Özellikleri:
|
||||
1. **Min Signal Slider** — 50%-95% arası, kombine sinyal eşiği kontrolü
|
||||
2. **Max Matches Slider** — 2-5 arası, kupon boyutu kontrolü
|
||||
3. **Market Filtre Badge'leri** — OU1.5, OU2.5, OU3.5, BTTS, MS (çoklu seçim)
|
||||
4. **Generate Butonu** → `useGenerateFrequencyCoupon` mutation'ını tetikler
|
||||
5. **Sonuç Paneli**:
|
||||
- EV / Hit Rate / Toplam Oran istatistik kartları
|
||||
- Her bahis için ev sinyali, deplasman sinyali, kombine sinyal gösterimi
|
||||
- Oran bandı bilgisi (ör. "1.30-1.50")
|
||||
- Lig profili badge'i (Golcü/Defansif/Normal)
|
||||
- Geçmiş maç sayısı gösterimi
|
||||
- Analiz detayları (reasoning listesi)
|
||||
- Elenen maçlar (rejected_matches)
|
||||
6. **Kupon Store Senkronizasyonu** — Sonuç geldiğinde bahisler otomatik olarak `useCouponStore`'a eklenir
|
||||
|
||||
## 7. Coupon Builder Engine Toggle
|
||||
|
||||
- `iddaai-fe/src/components/coupons/coupon-builder-content.tsx` güncellendi.
|
||||
- Değişiklikler:
|
||||
- `LuDatabase` icon import edildi
|
||||
- `FrequencyPanel` import edildi
|
||||
- `engineMode` state eklendi: `"ai" | "frequency"`
|
||||
- Sidebar'a **Motor Seçimi** toggle eklendi (Badge tabanlı)
|
||||
- `engineMode === "frequency"` olduğunda strateji/AI suggest bölümü gizlenir, yerine `FrequencyPanel` render edilir
|
||||
- `engineMode === "ai"` olduğunda mevcut AI akışı aynen korunur
|
||||
|
||||
### Veri Akışı:
|
||||
```
|
||||
Kullanıcı → "Frekans" badge'ine tıklar → FrequencyPanel açılır
|
||||
→ Sinyal/market/boyut ayarı yapar → "Frekans Kuponu Oluştur" butonuna basar
|
||||
→ POST /coupon/frequency-coupon { maxMatches, minSignal, markets }
|
||||
→ Backend: SmartCouponService → FrequencyEngineService (raw SQL)
|
||||
→ Response: FrequencyCouponResultDto
|
||||
→ UI: Sinyal kartları, EV istatistikleri, reasoning render edilir
|
||||
→ Bahisler otomatik olarak CouponStore'a sync edilir
|
||||
```
|
||||
|
||||
## 8. Derleme ve Doğrulama Notları
|
||||
|
||||
- `node_modules` kullanıcının makinesinde yüklü olmadığı için `npm run build` çalıştırılamadı.
|
||||
- Kod yapısal olarak doğru, TypeScript tipleri backend DTO'ları ile birebir eşleşiyor.
|
||||
- Doğrulama için: `npm install && npm run build` çalıştırılmalı.
|
||||
|
||||
## 9. Açık Kalan / Sonraki Adımlar
|
||||
|
||||
- `npm install && npm run build` ile frontend build doğrulanmalı.
|
||||
- Frekans kuponu uçtan uca test edilmeli (backend Docker ayakta iken).
|
||||
- FrequencyPanel içindeki market badge'lerine `HT_OU05` ve `DC` gibi ek marketler eklenebilir.
|
||||
- Frekans sonuçlarındaki `league_profile` badge renkleri dark mode için ince ayar gerektirebilir.
|
||||
- Kupon geçmişinde AI vs Frekans ayrımını gösteren bir etiket eklenebilir.
|
||||
Reference in New Issue
Block a user