@apteva/apteva-kit 0.1.72 → 0.1.76
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.js +14 -15
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +14 -15
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1520,19 +1520,14 @@ function MarkdownContent({ content, className = "" }) {
|
|
|
1520
1520
|
|
|
1521
1521
|
function ToolCall({ name, status, isReceiving = false, inputLength = 0 }) {
|
|
1522
1522
|
if (status === "preparing") {
|
|
1523
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className:
|
|
1523
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "apteva-tool-card apteva-tool-card-preparing", children: [
|
|
1524
1524
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "svg", { className: "apteva-tool-icon apteva-tool-icon-spin", fill: "none", viewBox: "0 0 24 24", children: [
|
|
1525
1525
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "circle", { className: "apteva-tool-spinner-track", cx: "12", cy: "12", r: "10", stroke: "currentColor", strokeWidth: "4" }),
|
|
1526
1526
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "path", { className: "apteva-tool-spinner-fill", fill: "currentColor", d: "M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z" })
|
|
1527
1527
|
] }),
|
|
1528
1528
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "apteva-tool-label", children: [
|
|
1529
1529
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "strong", { children: name }),
|
|
1530
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "apteva-tool-status-text", children: " preparing" })
|
|
1531
|
-
inputLength > 0 && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "apteva-tool-char-count", children: [
|
|
1532
|
-
" (",
|
|
1533
|
-
inputLength,
|
|
1534
|
-
" chars)"
|
|
1535
|
-
] })
|
|
1530
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "apteva-tool-status-text", children: " preparing..." })
|
|
1536
1531
|
] })
|
|
1537
1532
|
] });
|
|
1538
1533
|
}
|
|
@@ -2871,8 +2866,8 @@ ${widgetContext}` : widgetContext;
|
|
|
2871
2866
|
let currentTextBuffer = "";
|
|
2872
2867
|
let accumulatedWidgets = [];
|
|
2873
2868
|
let responseThreadId = currentThreadId;
|
|
2874
|
-
|
|
2875
|
-
|
|
2869
|
+
const toolInputBuffers = {};
|
|
2870
|
+
const receivingTimeouts = {};
|
|
2876
2871
|
const streamingMessageId = `msg-${Date.now()}`;
|
|
2877
2872
|
const updateMessage = () => {
|
|
2878
2873
|
const segments = [...contentSegments];
|
|
@@ -2950,7 +2945,7 @@ ${widgetContext}` : widgetContext;
|
|
|
2950
2945
|
currentTextBuffer = "";
|
|
2951
2946
|
}
|
|
2952
2947
|
contentSegments.push({ type: "tool", id: chunk.tool_id, name: displayName, status: "preparing" });
|
|
2953
|
-
|
|
2948
|
+
toolInputBuffers[chunk.tool_id] = "";
|
|
2954
2949
|
setChatToolName(displayName);
|
|
2955
2950
|
_optionalChain([onToolCall, 'optionalCall', _72 => _72(chunk.tool_name, chunk.tool_id)]);
|
|
2956
2951
|
updateMessage();
|
|
@@ -2958,14 +2953,18 @@ ${widgetContext}` : widgetContext;
|
|
|
2958
2953
|
break;
|
|
2959
2954
|
case "tool_input_delta":
|
|
2960
2955
|
if (chunk.tool_id && chunk.content) {
|
|
2961
|
-
|
|
2962
|
-
|
|
2956
|
+
const toolId = chunk.tool_id;
|
|
2957
|
+
if (toolInputBuffers[toolId] === void 0) {
|
|
2958
|
+
toolInputBuffers[toolId] = "";
|
|
2959
|
+
}
|
|
2960
|
+
toolInputBuffers[toolId] += chunk.content;
|
|
2961
|
+
const toolSegment = contentSegments.find((s) => s.type === "tool" && s.id === toolId);
|
|
2963
2962
|
if (toolSegment) {
|
|
2964
2963
|
toolSegment.isReceiving = true;
|
|
2965
|
-
toolSegment.inputLength =
|
|
2964
|
+
toolSegment.inputLength = toolInputBuffers[toolId].length;
|
|
2966
2965
|
updateMessage();
|
|
2967
|
-
if (
|
|
2968
|
-
|
|
2966
|
+
if (receivingTimeouts[toolId]) clearTimeout(receivingTimeouts[toolId]);
|
|
2967
|
+
receivingTimeouts[toolId] = setTimeout(() => {
|
|
2969
2968
|
if (toolSegment.status === "preparing") {
|
|
2970
2969
|
toolSegment.isReceiving = false;
|
|
2971
2970
|
updateMessage();
|