wtt-connect 0.2.59 → 0.2.60
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 +1 -1
- package/src/runner.js +11 -3
package/package.json
CHANGED
package/src/runner.js
CHANGED
|
@@ -198,7 +198,7 @@ export class Runner {
|
|
|
198
198
|
if (localSlash !== null) {
|
|
199
199
|
const reply = stripHiddenContextLeak(localSlash || '(empty response)') || '(empty response)';
|
|
200
200
|
await chatStream.finish(reply);
|
|
201
|
-
await this.wtt.publish(topicId, reply, 'CHAT_REPLY',
|
|
201
|
+
await this.wtt.publish(topicId, reply, 'CHAT_REPLY', chatStream.finalMetadata());
|
|
202
202
|
log('info', 'slash command replied', { topicId, adapter: adapter.name, chars: reply.length });
|
|
203
203
|
return;
|
|
204
204
|
}
|
|
@@ -241,12 +241,12 @@ export class Runner {
|
|
|
241
241
|
const reply = prepared.text || '(empty response)';
|
|
242
242
|
await chatStream.finish(reply);
|
|
243
243
|
await this.maybeAttachSpeech(topicId, reply, `chat-${topicId}`);
|
|
244
|
-
await this.wtt.publish(topicId, reply, 'CHAT_REPLY',
|
|
244
|
+
await this.wtt.publish(topicId, reply, 'CHAT_REPLY', chatStream.finalMetadata());
|
|
245
245
|
await this.publishGeneratedFileArtifacts(topicId, prepared.refs, { source: 'chat', sourceId: topicId, adapter: adapter.name });
|
|
246
246
|
log('info', 'chat replied', { topicId, chars: reply.length });
|
|
247
247
|
} catch (err) {
|
|
248
248
|
await chatStream?.fail(err?.message || String(err));
|
|
249
|
-
await this.wtt.publish(topicId, `执行失败:${err.message}`, 'CHAT_REPLY', chatStream?.
|
|
249
|
+
await this.wtt.publish(topicId, `执行失败:${err.message}`, 'CHAT_REPLY', chatStream?.finalMetadata?.() || null);
|
|
250
250
|
log('error', 'chat failed', { topicId, error: err.message });
|
|
251
251
|
} finally {
|
|
252
252
|
if (runtimeSelection) this.recordRuntimeSelection(runtimeSelection.adapter, runtimeSelection.modelConfig, 'idle');
|
|
@@ -610,6 +610,14 @@ export class Runner {
|
|
|
610
610
|
|
|
611
611
|
return {
|
|
612
612
|
id: streamId,
|
|
613
|
+
finalMetadata() {
|
|
614
|
+
return {
|
|
615
|
+
stream_id: streamId,
|
|
616
|
+
streamId,
|
|
617
|
+
adapter: adapterName,
|
|
618
|
+
model: modelConfig.model || modelConfig.model_id || modelConfig.modelId || '',
|
|
619
|
+
};
|
|
620
|
+
},
|
|
613
621
|
async start() {
|
|
614
622
|
await send('start');
|
|
615
623
|
},
|