Metadata ve çeviri ile ilgili düzeltmeler. UI değişiklikleri.

This commit is contained in:
2025-11-17 11:03:39 +03:00
parent daf39e35c0
commit b6c9fb795b
14 changed files with 859 additions and 226 deletions

View File

@@ -112,6 +112,12 @@ export const translateWithGlm = async (text) => {
};
}
console.log('[GLM] İstek hazırlanıyor', {
endpoint: GLM_API_URL,
model: GLM_MODEL,
snippet: text.slice(0, 80),
});
const response = await fetch(GLM_API_URL, {
method: 'POST',
headers: {
@@ -125,7 +131,20 @@ export const translateWithGlm = async (text) => {
body: JSON.stringify(body),
});
const payload = await response.json().catch(() => ({}));
let payload = {};
try {
payload = await response.json();
} catch (error) {
console.error('[GLM] JSON parse başarısız', error);
}
console.log('[GLM] Yanıt alındı', {
status: response.status,
ok: response.ok,
hasOutput: Boolean(payload?.output || payload?.choices || payload?.content),
error: payload?.error,
});
if (!response.ok) {
const message =
payload?.error?.message ||
@@ -136,7 +155,9 @@ export const translateWithGlm = async (text) => {
const translated = extractContent(payload);
if (!translated) {
console.error('[GLM] Boş içerik döndü', payload);
throw new Error('GLM çıktısı boş döndü.');
}
console.log('[GLM] Çeviri tamamlandı');
return translated;
};