Spaces:
Runtime error
Runtime error
Update app.js
Browse files
app.js
CHANGED
|
@@ -45,6 +45,7 @@ async function hfTextInference(model, prompt, token) {
|
|
| 45 |
|
| 46 |
if (!res.ok) {
|
| 47 |
const text = await res.text();
|
|
|
|
| 48 |
throw new Error(`模型调用失败: ${res.status} ${text}`);
|
| 49 |
}
|
| 50 |
|
|
@@ -64,7 +65,8 @@ async function hfGenericTask(model, prompt, token) {
|
|
| 64 |
body: JSON.stringify({ inputs: prompt })
|
| 65 |
});
|
| 66 |
const text = await res.text();
|
| 67 |
-
|
|
|
|
| 68 |
return text;
|
| 69 |
}
|
| 70 |
|
|
|
|
| 45 |
|
| 46 |
if (!res.ok) {
|
| 47 |
const text = await res.text();
|
| 48 |
+
// 修复点 1: 全角冒号改为半角
|
| 49 |
throw new Error(`模型调用失败: ${res.status} ${text}`);
|
| 50 |
}
|
| 51 |
|
|
|
|
| 65 |
body: JSON.stringify({ inputs: prompt })
|
| 66 |
});
|
| 67 |
const text = await res.text();
|
| 68 |
+
// 修复点 2: 全角冒号改为半角,并将单引号改为反引号以支持变量
|
| 69 |
+
if (!res.ok) throw new Error(`任务失败: ${res.status} ${text}`);
|
| 70 |
return text;
|
| 71 |
}
|
| 72 |
|