@nqminds/mcp-client 1.0.20 → 1.0.24
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/MCPChat.d.ts.map +1 -1
- package/dist/MCPChat.js +9 -1
- package/dist/api-helpers.d.ts.map +1 -1
- package/dist/api-helpers.js +5 -4
- package/package.json +1 -1
package/dist/MCPChat.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MCPChat.d.ts","sourceRoot":"","sources":["../src/MCPChat.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAmD,MAAM,OAAO,CAAC;AAGxE,OAAO,KAAK,EAAyB,YAAY,EAAe,MAAM,SAAS,CAAC;AA+ChF,wBAAgB,OAAO,CAAC,EACtB,aAAa,EACb,WAA6B,EAC7B,YAAiB,EACjB,SAAc,GACf,EAAE,YAAY,
|
|
1
|
+
{"version":3,"file":"MCPChat.d.ts","sourceRoot":"","sources":["../src/MCPChat.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAmD,MAAM,OAAO,CAAC;AAGxE,OAAO,KAAK,EAAyB,YAAY,EAAe,MAAM,SAAS,CAAC;AA+ChF,wBAAgB,OAAO,CAAC,EACtB,aAAa,EACb,WAA6B,EAC7B,YAAiB,EACjB,SAAc,GACf,EAAE,YAAY,qBAogBd"}
|
package/dist/MCPChat.js
CHANGED
|
@@ -182,7 +182,15 @@ export function MCPChat({ companyNumber, apiEndpoint = "/api/mcp/chat", customSt
|
|
|
182
182
|
}
|
|
183
183
|
}
|
|
184
184
|
catch (e) {
|
|
185
|
-
|
|
185
|
+
// Only swallow actual JSON parse failures.
|
|
186
|
+
// Re-throw anything else (e.g. the stream error we threw above)
|
|
187
|
+
// so it reaches the outer catch and surfaces to the user.
|
|
188
|
+
if (e instanceof SyntaxError) {
|
|
189
|
+
console.error("Error parsing SSE data:", e);
|
|
190
|
+
}
|
|
191
|
+
else {
|
|
192
|
+
throw e;
|
|
193
|
+
}
|
|
186
194
|
}
|
|
187
195
|
}
|
|
188
196
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api-helpers.d.ts","sourceRoot":"","sources":["../src/api-helpers.ts"],"names":[],"mappings":"AAAA;;GAEG;AAOH,MAAM,WAAW,sBAAsB;IACrC,YAAY,EAAE,MAAM,CAAC;IACrB,gBAAgB,EAAE,MAAM,CAAC;IACzB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,iEAAiE;IACjE,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,sBAAsB,IACnD,SAAS,OAAO,
|
|
1
|
+
{"version":3,"file":"api-helpers.d.ts","sourceRoot":"","sources":["../src/api-helpers.ts"],"names":[],"mappings":"AAAA;;GAEG;AAOH,MAAM,WAAW,sBAAsB;IACrC,YAAY,EAAE,MAAM,CAAC;IACrB,gBAAgB,EAAE,MAAM,CAAC;IACzB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,iEAAiE;IACjE,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,sBAAsB,IACnD,SAAS,OAAO,uBAqH/B;AAED;;GAEG;AACH,wBAAgB,qBAAqB,KACrB,SAAS,OAAO,uBAU/B;AAED;;GAEG;AACH,wBAAsB,iBAAiB,kBAKtC"}
|
package/dist/api-helpers.js
CHANGED
|
@@ -69,8 +69,10 @@ export function createMCPChatHandler(config) {
|
|
|
69
69
|
if (abortController.signal.aborted) {
|
|
70
70
|
return;
|
|
71
71
|
}
|
|
72
|
-
// Stream the response in chunks
|
|
73
|
-
|
|
72
|
+
// Stream the response in chunks.
|
|
73
|
+
// Use large chunks + short delay so long responses don't hit proxy send_timeout.
|
|
74
|
+
// 200 chars @ 15ms = ~13,000 chars/sec — a 100k response streams in ~8s.
|
|
75
|
+
const chunkSize = 200;
|
|
74
76
|
for (let i = 0; i < response.length; i += chunkSize) {
|
|
75
77
|
// Check for cancellation between chunks
|
|
76
78
|
if (abortController.signal.aborted) {
|
|
@@ -78,8 +80,7 @@ export function createMCPChatHandler(config) {
|
|
|
78
80
|
}
|
|
79
81
|
const chunk = response.slice(i, i + chunkSize);
|
|
80
82
|
sendEvent("content", { chunk });
|
|
81
|
-
|
|
82
|
-
await new Promise((resolve) => setTimeout(resolve, 20));
|
|
83
|
+
await new Promise((resolve) => setTimeout(resolve, 15));
|
|
83
84
|
}
|
|
84
85
|
sendEvent("done", {});
|
|
85
86
|
}
|