@ggboy123/dsh-paper-reader 0.6.1 → 0.6.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/translate-config.js +3 -1
- package/package.json +1 -1
package/dist/translate-config.js
CHANGED
|
@@ -93,7 +93,9 @@ export async function testTranslateEndpoint(ep) {
|
|
|
93
93
|
if (r.ok) {
|
|
94
94
|
// 智谱系网关切错路径时(如 /api/v1)会回 HTTP 200 + {"code":1001,"success":false},
|
|
95
95
|
// 只看状态码会误判成功,babeldoc 跑起来才炸。真成功必须有 choices。
|
|
96
|
-
|
|
96
|
+
// 上限放宽到 4000:GLM 等响应字段多,max_tokens:1 也有几百字节;
|
|
97
|
+
// 历史上 slice(0,300) 把合法 JSON 截断导致 parse 失败、误报「不是补全结果」(0.6.2 修复)
|
|
98
|
+
const text = (await r.text().catch(() => '')).slice(0, 4000);
|
|
97
99
|
try {
|
|
98
100
|
const data = JSON.parse(text);
|
|
99
101
|
if (Array.isArray(data.choices))
|