iflow-feishu 1.1.0 → 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
package/src/core/card-builder.js
CHANGED
|
@@ -55,9 +55,9 @@ class CardBuilder {
|
|
|
55
55
|
|
|
56
56
|
let titleContent = '';
|
|
57
57
|
if (modelName) titleContent += `<font color='blue'>${modelName}</font>`;
|
|
58
|
-
//
|
|
59
|
-
|
|
60
|
-
|
|
58
|
+
// 显示剩余上下文
|
|
59
|
+
const displayPercent = contentLeftPercent !== null ? contentLeftPercent : 100;
|
|
60
|
+
titleContent += (titleContent ? ' | ' : '') + `<font color='grey'>${displayPercent}% left</font>`;
|
|
61
61
|
if (thinkingStatus) titleContent += (titleContent ? ' <font color=\'grey\'>|</font> ' : '') + thinkingStatus;
|
|
62
62
|
|
|
63
63
|
if (titleContent) {
|
|
@@ -84,9 +84,9 @@ class CardBuilder {
|
|
|
84
84
|
|
|
85
85
|
let titleContent = '';
|
|
86
86
|
if (modelName) titleContent += `<font color='blue'>${modelName}</font>`;
|
|
87
|
-
//
|
|
88
|
-
|
|
89
|
-
|
|
87
|
+
// 显示剩余上下文
|
|
88
|
+
const displayPercent = contentLeftPercent !== null ? contentLeftPercent : 100;
|
|
89
|
+
titleContent += (titleContent ? ' | ' : '') + `<font color='grey'>${displayPercent}% left</font>`;
|
|
90
90
|
const statusColor = isGenerating ? 'orange' : 'green';
|
|
91
91
|
titleContent += (titleContent ? ' <font color=\'grey\'>|</font> ' : '') + `<font color='${statusColor}'>${responseTitle}</font>`;
|
|
92
92
|
|
|
@@ -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
|
}
|