Verify provider failure preserves drafts and improve user feedback

This commit is contained in:
2026-09-06 10:14:29 +03:00
parent a1d70b9dcf
commit 0fd46c4867
7 changed files with 32 additions and 3 deletions
+2 -2
View File
@@ -1306,7 +1306,7 @@ const server = http.createServer(async (req, res) => {
if (!aiConfigured()) {
return json(res, 503, {
success: false,
error: 'AI yapılandırılmamış — sunucuya en az bir sağlayıcı anahtarı ekleyin (ZAI_API_KEY / DEEPSEEK_API_KEY / GEMINI_API_KEY …)',
error: 'AI hizmeti şu anda kullanılamıyor. Daha sonra yeniden deneyin; sorun sürerse uygulama yöneticinize bildirin.',
});
}
try {
@@ -1456,7 +1456,7 @@ const server = http.createServer(async (req, res) => {
if ((url.pathname === '/api/ai/belge-sor' || url.pathname === '/api/ai/teklif-denetim' || url.pathname === '/api/ai/teklif-taslak') && req.method === 'POST') {
const user = userFromAuthHeader(req.headers['authorization']);
if (!user) return json(res, 401, { success: false, error: 'oturum yok' });
if (!aiConfigured()) return json(res, 503, { success: false, error: 'AI yapılandırılmamış — sunucuya bir sağlayıcı anahtarı ekleyin.' });
if (!aiConfigured()) return json(res, 503, { success: false, error: 'AI hizmeti şu anda kullanılamıyor. Daha sonra yeniden deneyin; sorun sürerse uygulama yöneticinize bildirin.' });
try {
const body = await readBody(req, 2 * 1024 * 1024);
const ortak = { ikn: body.ikn, tender: body.tender, chain: body.chain, text: body.text };