fix(translate): Kilo API response_format, reasoning_effort skip, structured_outputs fallback, refusal handling

- Enable response_format (json_object) for all providers including Kilo/OpenRouter
- Skip reasoning_effort for Kilo/OpenRouter (returns 400 — mandatory reasoning)
- Add structured_outputs fallback: retry once without response_format if upstream
  provider (e.g. StepFun) rejects it with 'structured_outputs is not supported'
- Handle model refusal field (refusal) instead of treating as empty content
- Fix None-handling guards for message/finish_reason/content fields
- Apply same fixes to both preview.py and executor.py _call_openai_compatible
- Connect orphaned TermCorrectionPopup, BulkReplaceModal, BulkCorrectionSidebar
This commit is contained in:
2026-05-15 18:09:00 +03:00
parent 0fbf8f65bf
commit fdf48491a1
18 changed files with 1888 additions and 336 deletions

View File

@@ -646,7 +646,16 @@ export async function bulkReplacePreview(runId, data) {
// @PURPOSE: Download skipped records CSV for a run.
export async function downloadSkippedCsv(runId) {
try {
return await api.fetchApi(`/translate/runs/${runId}/skipped.csv`);
const blob = await api.fetchApiBlob(`/translate/runs/${runId}/skipped.csv`);
// Trigger browser download
const url = URL.createObjectURL(blob);
const a = document.createElement('a');
a.href = url;
a.download = `skipped-${runId.substring(0, 8)}.csv`;
document.body.appendChild(a);
a.click();
document.body.removeChild(a);
URL.revokeObjectURL(url);
} catch (error) {
throw normalizeTranslateError(error, 'Failed to download skipped CSV');
}