fix: analiz icin dosya yuklenemiyordu — nginx varsayilan 1 MB govde siniri 413 veriyordu (arayuz 10 MB vaat ediyor); 20 MB + 300 sn zaman asimi, 413/504 icin anlasilir hata mesaji, 10 MB on kontrol

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
2026-09-02 13:48:22 +03:00
co-authored by Claude Fable 5.1
parent 920a147126
commit b41bc338af
5 changed files with 25 additions and 4 deletions
+6 -1
View File
@@ -13,7 +13,12 @@ server {
proxy_http_version 1.1; proxy_http_version 1.1;
proxy_set_header Host $host; proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Real-IP $remote_addr;
proxy_read_timeout 60s; # Belge yükleme: arayüz 10 MB'a izin veriyor, base64 ile ~13,4 MB gövde.
# nginx varsayılanı 1 MB → 1 MB üstü her dosya 413 ile "yüklenemedi" oluyordu.
client_max_body_size 20m;
# Derin şartname analizi 1-2 dk sürebiliyor; 60 sn'de 504 kesiyordu.
proxy_read_timeout 300s;
proxy_send_timeout 300s;
proxy_connect_timeout 10s; proxy_connect_timeout 10s;
} }
+1 -1
View File
@@ -772,7 +772,7 @@ const server = http.createServer(async (req, res) => {
if (req.method === 'POST') { if (req.method === 'POST') {
try { try {
const body = await readBody(req, 12 * 1024 * 1024); // base64 şişmesi payı const body = await readBody(req, 16 * 1024 * 1024); // 10 MB dosya × 1,34 base64 + JSON payı
if (!body.ad || !body.icerikBase64) { if (!body.ad || !body.icerikBase64) {
return json(res, 400, { success: false, error: 'ad ve icerikBase64 gerekli' }); return json(res, 400, { success: false, error: 'ad ve icerikBase64 gerekli' });
} }
+4
View File
@@ -34,6 +34,10 @@ export const TenderDocuments = ({ tender }) => {
const f = e.target.files?.[0]; const f = e.target.files?.[0];
e.target.value = ''; e.target.value = '';
if (!f) return; if (!f) return;
if (f.size > 10 * 1024 * 1024) {
setError(`Yüklenemedi: ${f.name} ${(f.size / 1048576).toFixed(1)} MB — sınır 10 MB.`);
return;
}
setYukleniyor(true); setError(null); setYukleniyor(true); setError(null);
try { try {
await uploadDocument(f, 'İhale Dokümanı', ikn); await uploadDocument(f, 'İhale Dokümanı', ikn);
+7 -1
View File
@@ -10,7 +10,13 @@ async function iste(url, opts = {}) {
const res = await fetch(url, { ...opts, headers: { ...auth(), ...(opts.headers || {}) } }); const res = await fetch(url, { ...opts, headers: { ...auth(), ...(opts.headers || {}) } });
const d = await res.json().catch(() => ({})); const d = await res.json().catch(() => ({}));
if (!d.success) { if (!d.success) {
const e = new Error(d.error || `İstek başarısız (HTTP ${res.status})`); // nginx/proxy hataları JSON değil HTML döner; kullanıcıya anlamlı mesaj ver.
const proxyMesaj = {
413: 'Dosya sunucunun kabul ettiği boyutu aşıyor (en fazla 10 MB).',
502: 'Sunucuya ulaşılamadı, biraz sonra tekrar deneyin.',
504: 'Sunucu zamanında yanıt vermedi; büyük dosyada tekrar deneyin.',
}[res.status];
const e = new Error(d.error || proxyMesaj || `İstek başarısız (HTTP ${res.status})`);
e.kod = d.kod; e.kod = d.kod;
throw e; throw e;
} }
+7 -1
View File
@@ -20,6 +20,12 @@ export async function analyzeSpecText({ text, fileName, tender, chain, mode }) {
body: JSON.stringify({ text, fileName, tender, chain, mode }), body: JSON.stringify({ text, fileName, tender, chain, mode }),
}); });
const data = await res.json().catch(() => ({})); const data = await res.json().catch(() => ({}));
if (!data.success) throw new Error(data.error || `Analiz başarısız (HTTP ${res.status})`); if (!data.success) {
const proxyMesaj = {
413: 'Doküman metni sunucu sınırını aşıyor; daha küçük bir dosya veya yalnızca ilgili sayfaları deneyin.',
504: 'Analiz zaman aşımına uğradı; tekrar deneyin (derin analiz 1-2 dk sürebilir).',
}[res.status];
throw new Error(data.error || proxyMesaj || `Analiz başarısız (HTTP ${res.status})`);
}
return data; return data;
} }