@flutchai/flutch-sdk 0.2.5 → 0.2.6
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/dist/index.cjs +15 -30
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +15 -31
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -4943,6 +4943,14 @@ exports.EventProcessor = class EventProcessor {
|
|
|
4943
4943
|
const blocks = this.normalizeContentBlocks(event.data.content);
|
|
4944
4944
|
this.processContentStream(acc, channel, blocks, onPartial);
|
|
4945
4945
|
}
|
|
4946
|
+
if (event.name === "send_attachments" && event.data.attachments) {
|
|
4947
|
+
const attachments = event.data.attachments || [];
|
|
4948
|
+
acc.attachments = [...acc.attachments, ...attachments];
|
|
4949
|
+
this.logger.debug("[ATTACHMENTS] Extracted from send_attachments event", {
|
|
4950
|
+
extractedCount: attachments.length,
|
|
4951
|
+
totalAccCount: acc.attachments.length
|
|
4952
|
+
});
|
|
4953
|
+
}
|
|
4946
4954
|
return;
|
|
4947
4955
|
}
|
|
4948
4956
|
if (event.event === "on_chat_model_stream" && event.data?.chunk?.content) {
|
|
@@ -5040,35 +5048,6 @@ exports.EventProcessor = class EventProcessor {
|
|
|
5040
5048
|
});
|
|
5041
5049
|
return;
|
|
5042
5050
|
}
|
|
5043
|
-
if (event.event === "on_chain_end") {
|
|
5044
|
-
const channel = event.metadata?.stream_channel ?? "text" /* TEXT */;
|
|
5045
|
-
if (channel === "text" /* TEXT */) {
|
|
5046
|
-
const output = event.data.output;
|
|
5047
|
-
if (output?.answer) {
|
|
5048
|
-
acc.attachments = [
|
|
5049
|
-
...acc.attachments,
|
|
5050
|
-
...this.extractAttachments(output.answer.attachments)
|
|
5051
|
-
];
|
|
5052
|
-
acc.metadata = { ...acc.metadata, ...output.answer.metadata || {} };
|
|
5053
|
-
} else if (output?.generation) {
|
|
5054
|
-
acc.attachments = [
|
|
5055
|
-
...acc.attachments,
|
|
5056
|
-
...this.extractAttachments(output.generation.attachments)
|
|
5057
|
-
];
|
|
5058
|
-
acc.metadata = {
|
|
5059
|
-
...acc.metadata,
|
|
5060
|
-
...output.generation.metadata || {}
|
|
5061
|
-
};
|
|
5062
|
-
} else if (output?.attachments || output?.metadata) {
|
|
5063
|
-
acc.attachments = [
|
|
5064
|
-
...acc.attachments,
|
|
5065
|
-
...this.extractAttachments(output.attachments)
|
|
5066
|
-
];
|
|
5067
|
-
acc.metadata = { ...acc.metadata, ...output.metadata || {} };
|
|
5068
|
-
}
|
|
5069
|
-
}
|
|
5070
|
-
return;
|
|
5071
|
-
}
|
|
5072
5051
|
}
|
|
5073
5052
|
/**
|
|
5074
5053
|
* Build final result from accumulator
|
|
@@ -5112,7 +5091,9 @@ exports.EventProcessor = class EventProcessor {
|
|
|
5112
5091
|
textChains: allChains.filter((c) => c.channel === "text").length,
|
|
5113
5092
|
processingChains: allChains.filter((c) => c.channel === "processing").length,
|
|
5114
5093
|
totalSteps: allChains.reduce((sum, c) => sum + c.steps.length, 0),
|
|
5115
|
-
textLength: text.length
|
|
5094
|
+
textLength: text.length,
|
|
5095
|
+
attachmentsCount: acc.attachments?.length || 0,
|
|
5096
|
+
attachments: acc.attachments
|
|
5116
5097
|
});
|
|
5117
5098
|
return {
|
|
5118
5099
|
content: {
|
|
@@ -5524,6 +5505,9 @@ async function createStaticMessage(content, config) {
|
|
|
5524
5505
|
await dispatch.dispatchCustomEvent("send_static_message", { content }, config);
|
|
5525
5506
|
return message;
|
|
5526
5507
|
}
|
|
5508
|
+
async function dispatchAttachments(attachments, config) {
|
|
5509
|
+
await dispatch.dispatchCustomEvent("send_attachments", { attachments }, config);
|
|
5510
|
+
}
|
|
5527
5511
|
|
|
5528
5512
|
// src/core/universal-graph.module.ts
|
|
5529
5513
|
init_builder_registry_service();
|
|
@@ -7666,6 +7650,7 @@ exports.createEndpointDescriptors = createEndpointDescriptors;
|
|
|
7666
7650
|
exports.createGraphAttachment = createGraphAttachment;
|
|
7667
7651
|
exports.createMongoClientAdapter = createMongoClientAdapter;
|
|
7668
7652
|
exports.createStaticMessage = createStaticMessage;
|
|
7653
|
+
exports.dispatchAttachments = dispatchAttachments;
|
|
7669
7654
|
exports.executeToolWithAttachments = executeToolWithAttachments;
|
|
7670
7655
|
exports.findCallbackMethod = findCallbackMethod;
|
|
7671
7656
|
exports.findEndpointMethod = findEndpointMethod;
|