@yeaft/webchat-agent 0.1.310 → 0.1.312
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/crew/ui-messages.js +14 -1
- package/package.json +1 -1
package/crew/ui-messages.js
CHANGED
|
@@ -208,6 +208,19 @@ export function sendCrewOutput(session, roleName, outputType, rawMessage, extra
|
|
|
208
208
|
// tool 只保存精简信息(toolName + 摘要),不存完整 toolInput/toolResult
|
|
209
209
|
}
|
|
210
210
|
|
|
211
|
+
/**
|
|
212
|
+
* 从当前活跃 messages(不含历史 shard)中提取有消息的 features。
|
|
213
|
+
* 避免发送全量 features 到前端导致 feature panel 渲染卡顿。
|
|
214
|
+
*/
|
|
215
|
+
function getActiveFeatures(session) {
|
|
216
|
+
const activeTaskIds = new Set();
|
|
217
|
+
for (const m of session.uiMessages) {
|
|
218
|
+
if (m.taskId) activeTaskIds.add(m.taskId);
|
|
219
|
+
}
|
|
220
|
+
return Array.from(session.features.values())
|
|
221
|
+
.filter(f => activeTaskIds.has(f.taskId));
|
|
222
|
+
}
|
|
223
|
+
|
|
211
224
|
/**
|
|
212
225
|
* 发送 session 状态更新
|
|
213
226
|
*/
|
|
@@ -241,7 +254,7 @@ export function sendStatusUpdate(session) {
|
|
|
241
254
|
.filter(([, s]) => s.turnActive && s.currentTool)
|
|
242
255
|
.map(([name, s]) => [name, s.currentTool])
|
|
243
256
|
),
|
|
244
|
-
features:
|
|
257
|
+
features: getActiveFeatures(session),
|
|
245
258
|
initProgress: session.initProgress || null
|
|
246
259
|
});
|
|
247
260
|
|