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:
@@ -10,7 +10,13 @@ async function iste(url, opts = {}) {
|
||||
const res = await fetch(url, { ...opts, headers: { ...auth(), ...(opts.headers || {}) } });
|
||||
const d = await res.json().catch(() => ({}));
|
||||
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;
|
||||
throw e;
|
||||
}
|
||||
|
||||
+7
-1
@@ -20,6 +20,12 @@ export async function analyzeSpecText({ text, fileName, tender, chain, mode }) {
|
||||
body: JSON.stringify({ text, fileName, tender, chain, mode }),
|
||||
});
|
||||
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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user