xiaozhou-chat 1.0.18 → 1.0.19
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/lib/chat.js +11 -1
- package/package.json +1 -1
package/lib/chat.js
CHANGED
|
@@ -37,7 +37,17 @@ export async function requestWithRetry(url, options, maxRetries = 3) {
|
|
|
37
37
|
if (res.status === 400) {
|
|
38
38
|
console.log(`\n❌ API请求参数错误 (400)。调试信息:`);
|
|
39
39
|
console.log(`- Endpoint: ${url}`);
|
|
40
|
-
|
|
40
|
+
|
|
41
|
+
try {
|
|
42
|
+
const bodyObj = options.body ? JSON.parse(options.body) : {};
|
|
43
|
+
console.log(`- Model: ${bodyObj.model}`);
|
|
44
|
+
console.log(`- Max Tokens: ${bodyObj.max_tokens}`);
|
|
45
|
+
console.log(`- Stream: ${bodyObj.stream}`);
|
|
46
|
+
console.log(`- Messages Count: ${bodyObj.messages?.length}`);
|
|
47
|
+
} catch (e) {
|
|
48
|
+
console.log(`- Body Parsing Failed: ${e.message}`);
|
|
49
|
+
}
|
|
50
|
+
|
|
41
51
|
// 尝试解析并打印更友好的错误
|
|
42
52
|
try {
|
|
43
53
|
const errJson = JSON.parse(text);
|