llmasaservice-client 0.2.1 → 0.2.2

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/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # llmasaservice-client
2
2
 
3
+ ## 0.2.2
4
+
5
+ ### Patch Changes
6
+
7
+ - Build fix
8
+
3
9
  ## 0.2.1
4
10
 
5
11
  ### Patch Changes
package/dist/index.js CHANGED
@@ -91,7 +91,7 @@ var useLLM = (options) => {
91
91
  setIdle(true);
92
92
  };
93
93
  function send(_0) {
94
- return __async(this, arguments, function* (prompt, messages = [], stream = true, abortController = new AbortController(), service = null) {
94
+ return __async(this, arguments, function* (prompt, messages = [], stream = true, abortController = new AbortController(), service = null, onCompleteCallback) {
95
95
  var _a, _b, _c, _d, _e;
96
96
  setResponse("");
97
97
  setIdle(false);
@@ -126,11 +126,11 @@ var useLLM = (options) => {
126
126
  if (!stream) {
127
127
  return yield readStream(reader, decoder, stream, {
128
128
  signal: options2.signal
129
- });
129
+ }, onCompleteCallback);
130
130
  } else {
131
131
  readStream(reader, decoder, stream, {
132
132
  signal: options2.signal
133
- });
133
+ }, onCompleteCallback);
134
134
  return reader;
135
135
  }
136
136
  }
@@ -144,7 +144,7 @@ var useLLM = (options) => {
144
144
  });
145
145
  }
146
146
  function readStream(_0, _1) {
147
- return __async(this, arguments, function* (reader, decoder, stream = true, { signal }) {
147
+ return __async(this, arguments, function* (reader, decoder, stream = true, { signal }, onCompleteCallback) {
148
148
  let errorInRead = "";
149
149
  let result = "";
150
150
  while (true) {
@@ -161,6 +161,9 @@ var useLLM = (options) => {
161
161
  }
162
162
  if (done) {
163
163
  setIdle(true);
164
+ if (onCompleteCallback) {
165
+ onCompleteCallback(result);
166
+ }
164
167
  break;
165
168
  }
166
169
  result += decoder.decode(value);
package/dist/index.mjs CHANGED
@@ -54,7 +54,7 @@ var useLLM = (options) => {
54
54
  setIdle(true);
55
55
  };
56
56
  function send(_0) {
57
- return __async(this, arguments, function* (prompt, messages = [], stream = true, abortController = new AbortController(), service = null) {
57
+ return __async(this, arguments, function* (prompt, messages = [], stream = true, abortController = new AbortController(), service = null, onCompleteCallback) {
58
58
  var _a, _b, _c, _d, _e;
59
59
  setResponse("");
60
60
  setIdle(false);
@@ -89,11 +89,11 @@ var useLLM = (options) => {
89
89
  if (!stream) {
90
90
  return yield readStream(reader, decoder, stream, {
91
91
  signal: options2.signal
92
- });
92
+ }, onCompleteCallback);
93
93
  } else {
94
94
  readStream(reader, decoder, stream, {
95
95
  signal: options2.signal
96
- });
96
+ }, onCompleteCallback);
97
97
  return reader;
98
98
  }
99
99
  }
@@ -107,7 +107,7 @@ var useLLM = (options) => {
107
107
  });
108
108
  }
109
109
  function readStream(_0, _1) {
110
- return __async(this, arguments, function* (reader, decoder, stream = true, { signal }) {
110
+ return __async(this, arguments, function* (reader, decoder, stream = true, { signal }, onCompleteCallback) {
111
111
  let errorInRead = "";
112
112
  let result = "";
113
113
  while (true) {
@@ -124,6 +124,9 @@ var useLLM = (options) => {
124
124
  }
125
125
  if (done) {
126
126
  setIdle(true);
127
+ if (onCompleteCallback) {
128
+ onCompleteCallback(result);
129
+ }
127
130
  break;
128
131
  }
129
132
  result += decoder.decode(value);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "llmasaservice-client",
3
3
  "license": "MIT",
4
- "version": "0.2.1",
4
+ "version": "0.2.2",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
7
7
  "types": "dist/index.d.ts",