iflow-feishu 1.1.1 → 1.1.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/package.json
CHANGED
|
@@ -59,14 +59,19 @@ class StreamHandler {
|
|
|
59
59
|
if (execInfoMatch) {
|
|
60
60
|
try {
|
|
61
61
|
const execInfo = JSON.parse(execInfoMatch[1]);
|
|
62
|
+
logger.info(`📊 解析到 Execution Info: ${JSON.stringify(execInfo.tokenUsage)}`);
|
|
62
63
|
if (execInfo.tokenUsage && execInfo.tokenUsage.total > 0) {
|
|
63
64
|
const used = execInfo.tokenUsage.total;
|
|
64
65
|
const remaining = Math.max(0, maxTokens - used);
|
|
65
|
-
|
|
66
|
+
const percent = Math.round((remaining / maxTokens) * 100);
|
|
67
|
+
logger.info(`📊 Token 计算: 已用=${used}, 剩余=${remaining}, 百分比=${percent}%`);
|
|
68
|
+
return percent;
|
|
66
69
|
}
|
|
67
70
|
} catch (e) {
|
|
68
|
-
|
|
71
|
+
logger.warn(`📊 解析 Execution Info 失败: ${e.message}`);
|
|
69
72
|
}
|
|
73
|
+
} else {
|
|
74
|
+
logger.info(`📊 未找到 Execution Info 标签`);
|
|
70
75
|
}
|
|
71
76
|
return null;
|
|
72
77
|
}
|