@yushaw/sanqian-chat 0.2.30 → 0.2.32

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.
@@ -5991,7 +5991,7 @@ function createIpcAdapter() {
5991
5991
  onEvent({ ...event, stream_id: streamId });
5992
5992
  });
5993
5993
  try {
5994
- await api.stream({
5994
+ const streamPromise = api.stream({
5995
5995
  streamId,
5996
5996
  messages,
5997
5997
  conversationId,
@@ -5999,6 +5999,11 @@ function createIpcAdapter() {
5999
5999
  attachedResources: options?.attachedResources,
6000
6000
  sessionResources: options?.sessionResources
6001
6001
  });
6002
+ void streamPromise.catch((e) => {
6003
+ streamCallbacks.delete(streamId);
6004
+ const errorMessage = e instanceof Error ? e.message : "Stream error";
6005
+ onEvent({ type: "error", error: errorMessage, stream_id: streamId });
6006
+ });
6002
6007
  return {
6003
6008
  cancel: async () => {
6004
6009
  await api.cancelStream({ streamId });
@@ -5903,7 +5903,7 @@ function createIpcAdapter() {
5903
5903
  onEvent({ ...event, stream_id: streamId });
5904
5904
  });
5905
5905
  try {
5906
- await api.stream({
5906
+ const streamPromise = api.stream({
5907
5907
  streamId,
5908
5908
  messages,
5909
5909
  conversationId,
@@ -5911,6 +5911,11 @@ function createIpcAdapter() {
5911
5911
  attachedResources: options?.attachedResources,
5912
5912
  sessionResources: options?.sessionResources
5913
5913
  });
5914
+ void streamPromise.catch((e) => {
5915
+ streamCallbacks.delete(streamId);
5916
+ const errorMessage = e instanceof Error ? e.message : "Stream error";
5917
+ onEvent({ type: "error", error: errorMessage, stream_id: streamId });
5918
+ });
5914
5919
  return {
5915
5920
  cancel: async () => {
5916
5921
  await api.cancelStream({ streamId });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yushaw/sanqian-chat",
3
- "version": "0.2.30",
3
+ "version": "0.2.32",
4
4
  "description": "Floating chat window SDK for Sanqian AI Assistant",
5
5
  "main": "./dist/main/index.js",
6
6
  "types": "./dist/main/index.d.ts",