@usecrow/ui 0.1.37 → 0.1.39
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 +13 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +13 -5
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.d.cts
CHANGED
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -138,11 +138,13 @@ function useChat({
|
|
|
138
138
|
const reader = response.body?.getReader();
|
|
139
139
|
const decoder = new TextDecoder();
|
|
140
140
|
if (reader) {
|
|
141
|
+
let buffer = "";
|
|
141
142
|
while (true) {
|
|
142
143
|
const { done, value } = await reader.read();
|
|
143
144
|
if (done) break;
|
|
144
|
-
|
|
145
|
-
const lines =
|
|
145
|
+
buffer += decoder.decode(value, { stream: true });
|
|
146
|
+
const lines = buffer.split("\n");
|
|
147
|
+
buffer = lines.pop() || "";
|
|
146
148
|
for (const line of lines) {
|
|
147
149
|
if (line.startsWith("data: ")) {
|
|
148
150
|
const data = line.slice(6).trim();
|
|
@@ -249,6 +251,7 @@ function useChat({
|
|
|
249
251
|
const newToolCall = {
|
|
250
252
|
id: `tool-${Date.now()}`,
|
|
251
253
|
name: parsed.tool_name,
|
|
254
|
+
displayName: parsed.display_name || void 0,
|
|
252
255
|
arguments: parsed.arguments || {},
|
|
253
256
|
status: "executing",
|
|
254
257
|
timestamp: /* @__PURE__ */ new Date()
|
|
@@ -323,6 +326,7 @@ function useChat({
|
|
|
323
326
|
const clientToolCall = {
|
|
324
327
|
id: `tool-${Date.now()}`,
|
|
325
328
|
name: parsed.tool_name,
|
|
329
|
+
displayName: parsed.display_name || void 0,
|
|
326
330
|
arguments: parsed.arguments || {},
|
|
327
331
|
status: "executing",
|
|
328
332
|
timestamp: /* @__PURE__ */ new Date()
|
|
@@ -491,11 +495,13 @@ function useChat({
|
|
|
491
495
|
const decoder = new TextDecoder();
|
|
492
496
|
let accumulatedText = "";
|
|
493
497
|
if (reader) {
|
|
498
|
+
let buffer = "";
|
|
494
499
|
while (true) {
|
|
495
500
|
const { done, value } = await reader.read();
|
|
496
501
|
if (done) break;
|
|
497
|
-
|
|
498
|
-
const lines =
|
|
502
|
+
buffer += decoder.decode(value, { stream: true });
|
|
503
|
+
const lines = buffer.split("\n");
|
|
504
|
+
buffer = lines.pop() || "";
|
|
499
505
|
for (const line of lines) {
|
|
500
506
|
if (line.startsWith("data: ")) {
|
|
501
507
|
const data = line.slice(6).trim();
|
|
@@ -636,6 +642,7 @@ function useConversations({ productId, apiUrl = "" }) {
|
|
|
636
642
|
toolCalls: msg.tool_calls?.map((tc, i) => ({
|
|
637
643
|
id: `history-tool-${idx}-${i}`,
|
|
638
644
|
name: tc.name,
|
|
645
|
+
displayName: tc.display_name || void 0,
|
|
639
646
|
arguments: tc.arguments || {},
|
|
640
647
|
status: tc.status,
|
|
641
648
|
timestamp: /* @__PURE__ */ new Date()
|
|
@@ -673,6 +680,7 @@ function useConversations({ productId, apiUrl = "" }) {
|
|
|
673
680
|
toolCalls: msg.tool_calls?.map((tc, i) => ({
|
|
674
681
|
id: `history-tool-${idx}-${i}`,
|
|
675
682
|
name: tc.name,
|
|
683
|
+
displayName: tc.display_name || void 0,
|
|
676
684
|
arguments: tc.arguments || {},
|
|
677
685
|
status: tc.status,
|
|
678
686
|
timestamp: /* @__PURE__ */ new Date()
|
|
@@ -1924,7 +1932,7 @@ function ToolCallBlock({
|
|
|
1924
1932
|
isExecuting && /* @__PURE__ */ jsx(Loader2, { className: "crow-w-3 crow-h-3 crow-animate-spin crow-text-blue-500" }),
|
|
1925
1933
|
isComplete && /* @__PURE__ */ jsx(Check, { className: "crow-w-3 crow-h-3 crow-text-green-500" }),
|
|
1926
1934
|
isError && /* @__PURE__ */ jsx("span", { className: "crow-w-3 crow-h-3 crow-text-red-500", children: "\u2715" }),
|
|
1927
|
-
/* @__PURE__ */ jsx("span", { className: "crow-font-medium", children: toolCall.name }),
|
|
1935
|
+
/* @__PURE__ */ jsx("span", { className: "crow-font-medium", children: toolCall.displayName || toolCall.name }),
|
|
1928
1936
|
/* @__PURE__ */ jsxs("span", { className: "crow-text-gray-400", children: [
|
|
1929
1937
|
isExecuting && "running...",
|
|
1930
1938
|
isComplete && "done",
|