cui-llama.rn 1.7.1 → 1.7.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.
@@ -107,13 +107,18 @@ public class LlamaContext {
107
107
  }
108
108
 
109
109
  String modelName = params.getString("model");
110
-
111
- if(!isGGUF(modelName, reactContext)) {
112
- throw new IllegalArgumentException("File is not in GGUF format");
110
+
111
+ if (modelName.startsWith("content://")) {
112
+ Uri uri = Uri.parse(modelName);
113
+ try {
114
+ ParcelFileDescriptor pfd = reactContext.getApplicationContext().getContentResolver().openFileDescriptor(uri, "r");
115
+ modelName = "" + pfd.getFd();
116
+ } catch (Exception e) {
117
+ Log.e(NAME, "Failed to convert to FD!");
118
+ }
113
119
  }
114
-
115
- modelName = getContentFileDescriptor(modelName);
116
120
 
121
+
117
122
  // Check if file has GGUF magic numbers
118
123
  this.id = id;
119
124
  eventEmitter = reactContext.getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter.class);
@@ -463,18 +468,6 @@ public class LlamaContext {
463
468
  freeContext(context);
464
469
  }
465
470
 
466
- private String getContentFileDescriptor(String modelName) {
467
- if (!modelName.startsWith("content://")) return modelName;
468
- Uri uri = Uri.parse(modelName);
469
- try {
470
- ParcelFileDescriptor pfd = reactContext.getApplicationContext().getContentResolver().openFileDescriptor(uri, "r");
471
- return "" + pfd.getFd();
472
- } catch (Exception e) {
473
- Log.e(NAME, "Failed to convert to FD!");
474
- }
475
- return modelName;
476
- }
477
-
478
471
  static {
479
472
  Log.d(NAME, "Primary ABI: " + Build.SUPPORTED_ABIS[0]);
480
473
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cui-llama.rn",
3
- "version": "1.7.1",
3
+ "version": "1.7.2",
4
4
  "description": "Fork of llama.rn for ChatterUI",
5
5
  "main": "lib/commonjs/index",
6
6
  "module": "lib/module/index",