Commit Graph
39 Commits
Author SHA1 Message Date
Mustafa YildizandClaude Sonnet 5 7c76913cf9 feat: ceza/hukuk mahkeme referanslarını kalan analiz ve taslak promptlarına yay
Kapsam genişletildi: ilk yükleme analizi, iddianame ön-analizi (sadece ceza),
Çelişki Avcısı'na hukuk referansı, Uzlaşma/Arabuluculuk analizi ve Dilekçe
Taslağı promptlarına da ceza muhakemesi ve/veya hukuk mahkemeleri referansı
eklendi. Angarya (Süre Tutum/Mazeret/Vekaletname) kasıtlı olarak dışarıda
bırakıldı — o araç tanımı gereği hiçbir hukuki tartışmaya girmiyor.

CEZA_MUHAKEMESI_REFERANSI ve HUKUK_MAHKEMELERI_REFERANSI export edildi ki
drafting.controller.ts document.controller.ts'den import edebilsin.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-08-18 23:00:46 +03:00
Mustafa YildizandClaude Sonnet 5 63eba80dac feat: hukuk mahkemeleri sistem referansını dava analiz promptlarına ekle
Dava Özeti, Dava İlerlemesi ve Strateji Analizi promptlarına mahkeme türü
(Asliye Hukuk, Sulh Hukuk, Aile, Asliye Ticaret, İş, Tüketici, İcra Hukuk,
Fikri ve Sınai Haklar, Kadastro), yargılama usulü ve zorunlu arabuluculuk
şartlarını özetleyen bir referans bloğu eklendi. Çelişki Avcısı'na
eklenmedi — o araç ceza usulüne özgü kolluk/savcılık/mahkeme aşamaları
arası ifade çelişkilerine odaklı, hukuk davalarında karşılığı yok.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-08-18 22:54:56 +03:00
Mustafa YildizandClaude Sonnet 5 6202aadc8f feat: ceza muhakemesi usul/evrak/hüküm türü referansını dava analiz promptlarına ekle
Dava Özeti, Dava İlerlemesi, Çelişki Avcısı ve Strateji Analizi promptlarına
soruşturma/kovuşturma sırası, evrak türleri ve CMK m.223 hüküm türlerini
özetleyen ortak bir referans bloğu eklendi; AI dosyanın ceza davası olup
olmadığına kendi karar veriyor, rijit bir dava-türü sınıflandırması yok.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-08-18 22:38:33 +03:00
Mustafa Yildiz 66a3960d90 fix: Ollama KEEP_ALIVE=-1 ve AbortError mesaj netliği, callAiModelRaw'a opsiyonel timeoutMs
KEEP_ALIVE '30m' -> -1: GPU'da bolca boş VRAM var, modeli sürekli bellekte
tutmanın maliyeti yok, 30dk sınırı gereksiz soğuk-başlangıç gecikmelerine
sebep oluyordu (bkz. 2026-08-14 log: 44GB boş / 17.5GB kullanılan).
2026-08-17 00:46:10 +03:00
Mustafa Yildiz 6155a72830 fix: resolve false positive deficiency claims (görevsizlik kararı, doktor raporu, tanık beyanı) in case deficiency analysis 2026-08-15 16:58:58 +03:00
Mustafa Yildiz d86d843c61 feat: add CDATA section parser for UDF 1.8 template XML format 2026-08-15 11:08:20 +03:00
Mustafa Yildiz cab55c4fae fix: resolve UDF extraction false positive rejection on real UDF content.xml files 2026-08-15 11:06:41 +03:00
Mustafa Yildiz 389bbe33ef fix: filter out ZIP header metadata strings like content.xml and content.xmlPK from UDF text extractor 2026-08-15 11:03:26 +03:00
Mustafa Yildiz 9229c82806 fix: resolve 400 Bad Request on UDF attachment extraction with iconv-lite Turkish encoding support and fallback guarantee 2026-08-15 10:46:51 +03:00
Mustafa Yildiz 8962a63cf5 fix: upgrade UDF text extraction with multi-offset PK search and binary noise filter 2026-08-15 10:43:54 +03:00
Mustafa Yildiz 977239b0ca fix: improve UDF xml text extraction buffer reading 2026-08-15 10:31:16 +03:00
Mustafa Yildiz ad1f3107de fix: add robust fallback insert strategy for template upload to guarantee 100% upload success for UDF/binary files 2026-08-15 10:25:31 +03:00
Mustafa Yildiz 49841241be fix: add sanitizePostgresText to filter null bytes and malformed Unicode escape sequences before inserting template text into Supabase 2026-08-15 10:20:54 +03:00
mstfyldz 95478c09e8 fix: PK signature offset searching for UDF files in backend 2026-08-14 13:23:48 +03:00
mstfyldz 6dd34fe703 feat: enhance UDF file extraction pipeline to unzip container and handle content.xml or embedded PDF files 2026-08-14 13:13:37 +03:00
mstfyldz d2ea58942c fix: add stream routes and guarantee finalJson answer property 2026-08-14 11:53:04 +03:00
mstfyldz c4947422dc feat: add digital-intern live-qa endpoints for pinpoint hearing assistance 2026-08-14 11:48:49 +03:00
mstfyldz d7a99a9db0 fix: add role-based strategic goals and winSteps to runStrategyAnalysis 2026-08-14 11:39:37 +03:00
mstfyldz 11c26d6029 fix: re-orient STATEMENT_ANALYSIS_SYSTEM_PROMPT to focus on stage and cross-witness contradictions 2026-08-14 11:34:49 +03:00
mstfyldz 9f1ffedb88 fix: enforce K.H. Kamu Hukuku exclusion rule in STATEMENT_ANALYSIS_SYSTEM_PROMPT and filter output 2026-08-14 11:31:51 +03:00
mstfyldz fab80e05a0 feat: upgrade AI prompts to v2 specification with grounding and injection shield 2026-08-14 00:52:41 +03:00
mstfyldz e25bab8146 fix: Supabase storage upload hatasını çözmek için dosya adlarındaki Türkçe karakterler ve boşluklar temizlendi 2026-08-12 11:22:05 +03:00
mstfyldz 571e1f63d1 feat: Arabuluculuk & Müzakere Asistanı analiz endpoint'leri eklendi 2026-08-12 10:58:44 +03:00
mstfyldz 05341e1171 feat(calendar): extract dates into case_events 2026-08-11 23:19:53 +03:00
mstfyldz 6299a269a1 feat: dava stratejisi olusturucu - analyzeStrategy endpoint 2026-08-11 17:02:18 +03:00
mstfyldz 5c8c676d45 feat: add deficiency analysis route 2026-08-11 16:30:22 +03:00
mstfyldz 05fcc00de9 revision 2026-08-11 16:27:02 +03:00
mstfyldz 6bd6da3776 fix: prevent duplicate document rows on OCR retry
registerLocalDocument always did a plain insert, so retrying a
document whose first OCR attempt failed created a new duplicate
row each time instead of updating the existing one. Now looks up
an existing (case_id, filename) match and updates it in place.
2026-08-11 11:09:05 +03:00
mstfyldz 97ec7cd7f8 feat: DeepSeek-OCR endpoint + GPU request queue for AI calls
Mizan ve DeepSeek-OCR aynı self-hosted GPU'yu paylaşıyor; backend'de hiçbir
eşzamanlılık sınırı yoktu, yoğun anlarda istekler Ollama kuyruğunda 90sn'yi
aşıp sessizce "başarısız" görünüyordu. aiQueue.ts, GPU'ya giden istek sayısını
sınırlayıp fazlasını backend'de bekletiyor.

Yeni POST /documents/ocr-image, tek bir görseli DeepSeek-OCR ile metne
çeviriyor (Electron tarafındaki çok sayfalı TIFF/taranmış PDF işleme
adımının kullanacağı uç, ayrı bir PR'da bağlanacak).
2026-08-11 10:12:33 +03:00
mstfyldzandClaude Sonnet 5 9618ff4513 feat: file attachments in chat + document-select for case chat
- Yeni POST /api/documents/extract-text: dosyayı hiçbir yere
  kaydetmeden sadece metnini çıkarıp döner (chat ataç özelliği için)
- chatMessage ve sendThreadMessage artık body'de attachments
  ({filename,text}[]) kabul ediyor; AI bağlamına ekleniyor, kayıtlı
  mesaja da "[Ek dosya(lar): ...]" notu düşülüyor
- chatMessage ayrıca document_ids kabul ediyor — dosya sohbetinde
  kullanıcının bu mesajda özellikle işaret ettiği mevcut belge(ler)
  AI'ye vurgulanıyor

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-08-10 01:03:13 +03:00
mstfyldzandClaude Sonnet 5 bcc78ce304 perf: switch all AI calls to native Ollama endpoint, add streaming + keep_alive
Tüm AI çağrıları artık ortak lib/aiClient.ts üzerinden gidiyor:
- /v1/chat/completions yerine native /api/chat (think:false burada
  güvenilir çalışıyor)
- keep_alive:30m ile model her istekte bellekten atılıp soğuk
  başlamıyor
- num_predict ile öngörülemez uzunlukta üretime üst sınır
- İnteraktif sohbet uç noktaları (chatMessage, sendThreadMessage)
  artık SSE ile token token akıtıyor
- Dosya sohbetinde varsayılan olarak belgenin tam metni değil analiz
  özeti gönderiliyor; tam metin sadece kullanıcı açıkça isterse
  eklenir

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-08-10 00:21:49 +03:00
mstfyldzandClaude Sonnet 5 fa01432ffe feat: use firm's own templates as style guide for AI-drafted petitions
Belge Şablonları uploads now also get extracted_text (same OCR/office
pipeline as documents), and a new POST /api/drafting/generate builds
a real AI draft from the case's actual data (title, UYAP parties,
latest Dosya Özeti) — if the lawyer picks one of their own templates,
its extracted text is passed as a style/format reference only (the
prompt explicitly forbids copying the template's old case facts).
Dilekçe Hazırlama no longer fakes a draft with setTimeout.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-08-09 20:20:47 +03:00
mstfyldzandClaude Sonnet 5 50f6cbb1b2 feat: narrative "Dosya Özeti" report instead of field-by-field JSON
summarizeCase now produces a full Markdown narrative report (Olayın
Özeti, Yargılama Süreci ve Kararlar, Taraf İddia/Savunmaları, Önemli
Bulgular ve Belgeler, Sonuç) instead of short structured fields - the
iddianame pre-analysis (when found) still runs first and is fed in as
context. The raw AI text is stored as {ozet: string} rather than
JSON-parsed, since asking the model to escape a multi-paragraph report
inside JSON was fragile.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-08-09 20:09:31 +03:00
mstfyldzandClaude Sonnet 5 c939dcf564 feat: iddianame-first case summary + remove hardcoded AI endpoint
- summarizeCase: if an iddianame is among the case's documents, run a
  narrow first-pass analysis on it alone (isnatEdilenSuc, iddiaOzeti,
  onemliTarihler), then feed that as context into the general
  case-wide evaluation instead of treating every document equally.
- ANALYSIS_SYSTEM_PROMPT no longer asks the AI to guess "taraflar" -
  that now comes from real UYAP data (cases.parties) instead.
- Removed the hardcoded RunPod proxy URL fallback from every call
  site (document/chat/precedent controllers + lib/openai.ts) - it was
  a real infra endpoint checked into source. New lib/aiConfig.ts
  throws if RUNPOD_API_BASE_URL isn't set rather than silently
  falling back to it.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-08-09 20:00:06 +03:00
mstfyldzandClaude Sonnet 5 99d4d770d5 feat: add POST /api/cases/parties to store UYAP taraf bilgileri
The UYAP extension now captures the davaci/davali/sanik + vekil data
from the "Taraf Bilgileri" tab and sends it once per case. This
endpoint finds/creates the matching case by title (same lookup used
by registerLocalDocument, now shared via lib/caseLookup.ts) and stores
it in a new cases.parties column - a much more reliable source for
the case detail screen's "Taraflar" info than the AI's own guess from
OCR'd document text.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-08-09 19:29:53 +03:00
mstfyldzandClaude Sonnet 5 9f5c5c1e45 feat: add case-level AI summary endpoint
POST /api/cases/:caseId/summarize combines extracted text from all of
a case's documents and runs the existing AI analysis prompt, storing
the result as a case-level analysis (document_id: null). Powers the
"Özet Hazırla" button on the case detail screen.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-08-09 16:14:41 +03:00
mstfyldz 67b0398b8c feat: add POST /api/documents/register-local for extension import
Accepts pre-extracted text (no raw file) from the AyrisLegal Electron
app's local OCR pipeline, matches/creates a case by title, and runs
the existing AI analysis flow. Also fixes a bug in uploadDocument:
officeparser@7.x's parseOffice() now returns a result object with
.toText() instead of a plain string, which was breaking PDF/DOCX
manual uploads.
2026-08-09 11:26:36 +03:00
mstfyldz 633f66b09b Fix TypeScript error for officeparser 2026-08-08 17:22:39 +03:00
mstfyldz df70520ede Initial commit 2026-08-08 17:19:28 +03:00