@inferrlm/react-native-mlx 0.4.2-alpha.4 → 0.4.2-alpha.6

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.
@@ -262,6 +262,12 @@ class HybridLLM: HybridLLMSpec {
262
262
  throw LLMError.notLoaded
263
263
  }
264
264
 
265
+ if let prev = currentTask {
266
+ log("stream_cancelling_previous")
267
+ prev.cancel()
268
+ currentTask = nil
269
+ }
270
+
265
271
  return Promise.async { [self] in
266
272
  let task = Task<String, Error> {
267
273
  let startTime = Date()
@@ -327,6 +333,12 @@ class HybridLLM: HybridLLMSpec {
327
333
  throw LLMError.notLoaded
328
334
  }
329
335
 
336
+ if let prev = currentTask {
337
+ log("streamWithEvents_cancelling_previous")
338
+ prev.cancel()
339
+ currentTask = nil
340
+ }
341
+
330
342
  return Promise.async { [self] in
331
343
  let task = Task<String, Error> {
332
344
  let startTime = Date()
@@ -540,7 +552,6 @@ class HybridLLM: HybridLLMSpec {
540
552
  emitter.emitThinkingEnd(content)
541
553
  }
542
554
  }
543
- }
544
555
 
545
556
  case .toolCall(let toolCall):
546
557
  log("Tool call detected: \(toolCall.function.name)")
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@inferrlm/react-native-mlx",
3
3
  "description": "MLX Swift integration for React Native - InferrLM fork with enhanced features",
4
- "version": "0.4.2-alpha.4",
4
+ "version": "0.4.2-alpha.6",
5
5
  "main": "./lib/module/index.js",
6
6
  "module": "./lib/module/index.js",
7
7
  "types": "./lib/typescript/src/index.d.ts",