feat: improve ai writing imitation flow
This commit is contained in:
1 parent
0547fb1715
commit
025e43f4c5
14 files changed
+927
-117
No files matched your search
@@ -17,6 +17,12 @@ export async function extractAIWritingSample(file: File): Promise<AIWritingSampl
|
||||
});
|
||||
if (!resp.ok) {
|
||||
const text = await resp.text().catch(() => '');
|
||||
let detail = '';
|
||||
try {
|
||||
const parsed = text ? JSON.parse(text) as { detail?: unknown } : null;
|
||||
detail = parsed?.detail ? String(parsed.detail) : '';
|
||||
} catch {}
|
||||
if (detail) throw new Error(detail);
|
||||
throw new Error(text || `样文解析失败:${resp.status}`);
|
||||
}
|
||||
return resp.json();
|
||||
|
||||
Reference in new issue
Block a user