cactus-react-native 0.2.10 → 1.0.1
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/Cactus.podspec +34 -0
- package/LICENSE +38 -0
- package/README.md +283 -722
- package/android/CMakeLists.txt +40 -0
- package/android/build.gradle +68 -44
- package/android/gradle.properties +5 -5
- package/android/src/main/AndroidManifest.xml +1 -3
- package/android/src/main/cpp/cpp-adapter.cpp +6 -0
- package/android/src/main/java/com/margelo/nitro/cactus/CactusPackage.kt +22 -0
- package/android/src/main/java/com/margelo/nitro/cactus/HybridCactusCrypto.kt +38 -0
- package/android/src/main/java/com/margelo/nitro/cactus/HybridCactusDeviceInfo.kt +24 -0
- package/android/src/main/java/com/margelo/nitro/cactus/HybridCactusFileSystem.kt +227 -0
- package/android/src/main/jniLibs/arm64-v8a/{libcactus.so → libcactus.a} +0 -0
- package/android/src/main/jniLibs/arm64-v8a/libcactus_util.so +0 -0
- package/cpp/HybridCactus.cpp +123 -0
- package/cpp/HybridCactus.hpp +35 -0
- package/cpp/HybridCactusUtil.cpp +45 -0
- package/cpp/HybridCactusUtil.hpp +26 -0
- package/cpp/cactus_ffi.h +55 -0
- package/cpp/cactus_util.h +25 -0
- package/ios/HybridCactusCrypto.swift +37 -0
- package/ios/HybridCactusDeviceInfo.swift +32 -0
- package/ios/HybridCactusFileSystem.swift +234 -0
- package/ios/cactus.xcframework/{info.plist → Info.plist} +2 -37
- package/ios/cactus.xcframework/ios-arm64/cactus.framework/Headers/cactus.h +8 -229
- package/ios/cactus.xcframework/ios-arm64/cactus.framework/Headers/cactus_ffi.h +28 -229
- package/ios/cactus.xcframework/ios-arm64/cactus.framework/Headers/engine.h +347 -0
- package/ios/cactus.xcframework/ios-arm64/cactus.framework/Headers/ffi_utils.h +286 -0
- package/ios/cactus.xcframework/ios-arm64/cactus.framework/Headers/graph.h +319 -0
- package/ios/cactus.xcframework/ios-arm64/cactus.framework/Headers/kernel.h +254 -0
- package/ios/cactus.xcframework/ios-arm64/cactus.framework/Headers/kernel_utils.h +343 -0
- package/ios/cactus.xcframework/ios-arm64/cactus.framework/Info.plist +0 -0
- package/ios/cactus.xcframework/ios-arm64/cactus.framework/cactus +0 -0
- package/ios/cactus.xcframework/ios-arm64-simulator/cactus.framework/Headers/cactus.h +11 -0
- package/ios/cactus.xcframework/ios-arm64-simulator/cactus.framework/Headers/cactus_ffi.h +55 -0
- package/ios/cactus.xcframework/ios-arm64-simulator/cactus.framework/Headers/engine.h +347 -0
- package/ios/cactus.xcframework/ios-arm64-simulator/cactus.framework/Headers/ffi_utils.h +286 -0
- package/ios/cactus.xcframework/ios-arm64-simulator/cactus.framework/Headers/graph.h +319 -0
- package/ios/cactus.xcframework/ios-arm64-simulator/cactus.framework/Headers/kernel.h +254 -0
- package/ios/cactus.xcframework/ios-arm64-simulator/cactus.framework/Headers/kernel_utils.h +343 -0
- package/ios/cactus.xcframework/ios-arm64-simulator/cactus.framework/Info.plist +0 -0
- package/ios/cactus.xcframework/{tvos-arm64_x86_64-simulator → ios-arm64-simulator}/cactus.framework/_CodeSignature/CodeResources +1 -1
- package/ios/cactus.xcframework/ios-arm64-simulator/cactus.framework/cactus +0 -0
- package/ios/cactus_util.xcframework/Info.plist +39 -0
- package/ios/cactus_util.xcframework/ios-arm64/cactus_util.framework/Headers/cactus_util.h +25 -0
- package/ios/cactus_util.xcframework/ios-arm64/cactus_util.framework/Headers/ios_utils.h +10 -0
- package/ios/cactus_util.xcframework/ios-arm64/cactus_util.framework/Headers/logging.h +25 -0
- package/ios/cactus_util.xcframework/ios-arm64/cactus_util.framework/Info.plist +0 -0
- package/ios/cactus_util.xcframework/ios-arm64/cactus_util.framework/cactus_util +0 -0
- package/ios/cactus_util.xcframework/ios-arm64-simulator/cactus_util.framework/Headers/cactus_util.h +25 -0
- package/ios/cactus_util.xcframework/ios-arm64-simulator/cactus_util.framework/Headers/ios_utils.h +10 -0
- package/ios/cactus_util.xcframework/ios-arm64-simulator/cactus_util.framework/Headers/logging.h +25 -0
- package/ios/{cactus.xcframework/ios-arm64_x86_64-simulator/cactus.framework → cactus_util.xcframework/ios-arm64-simulator/cactus_util.framework}/Info.plist +0 -0
- package/ios/{cactus.xcframework/ios-arm64_x86_64-simulator/cactus.framework → cactus_util.xcframework/ios-arm64-simulator/cactus_util.framework}/_CodeSignature/CodeResources +36 -2
- package/ios/cactus_util.xcframework/ios-arm64-simulator/cactus_util.framework/cactus_util +0 -0
- package/lib/module/api/Database.js +60 -0
- package/lib/module/api/Database.js.map +1 -0
- package/lib/module/classes/CactusLM.js +149 -0
- package/lib/module/classes/CactusLM.js.map +1 -0
- package/lib/module/config/CactusConfig.js +6 -0
- package/lib/module/config/CactusConfig.js.map +1 -0
- package/lib/module/constants/packageVersion.js +4 -0
- package/lib/module/constants/packageVersion.js.map +1 -0
- package/lib/module/hooks/useCactusLM.js +233 -0
- package/lib/module/hooks/useCactusLM.js.map +1 -0
- package/lib/module/index.js +9 -409
- package/lib/module/index.js.map +1 -1
- package/lib/module/native/Cactus.js +50 -0
- package/lib/module/native/Cactus.js.map +1 -0
- package/lib/module/native/CactusCrypto.js +10 -0
- package/lib/module/native/CactusCrypto.js.map +1 -0
- package/lib/module/native/CactusDeviceInfo.js +13 -0
- package/lib/module/native/CactusDeviceInfo.js.map +1 -0
- package/lib/module/native/CactusFileSystem.js +35 -0
- package/lib/module/native/CactusFileSystem.js.map +1 -0
- package/lib/module/native/CactusUtil.js +23 -0
- package/lib/module/native/CactusUtil.js.map +1 -0
- package/lib/module/native/index.js +8 -0
- package/lib/module/native/index.js.map +1 -0
- package/lib/module/specs/Cactus.nitro.js +4 -0
- package/lib/module/specs/Cactus.nitro.js.map +1 -0
- package/lib/module/specs/CactusCrypto.nitro.js +4 -0
- package/lib/module/specs/CactusCrypto.nitro.js.map +1 -0
- package/lib/module/specs/CactusDeviceInfo.nitro.js +4 -0
- package/lib/module/specs/CactusDeviceInfo.nitro.js.map +1 -0
- package/lib/module/specs/CactusFileSystem.nitro.js +4 -0
- package/lib/module/specs/CactusFileSystem.nitro.js.map +1 -0
- package/lib/module/specs/CactusUtil.nitro.js +4 -0
- package/lib/module/specs/CactusUtil.nitro.js.map +1 -0
- package/lib/module/telemetry/Telemetry.js +100 -0
- package/lib/module/telemetry/Telemetry.js.map +1 -0
- package/lib/module/types/CactusLM.js +2 -0
- package/lib/module/types/CactusLM.js.map +1 -0
- package/lib/module/types/CactusModel.js +2 -0
- package/lib/module/types/CactusModel.js.map +1 -0
- package/lib/module/utils/error.js +4 -0
- package/lib/module/utils/error.js.map +1 -0
- package/lib/typescript/package.json +1 -0
- package/lib/typescript/src/api/Database.d.ts +11 -0
- package/lib/typescript/src/api/Database.d.ts.map +1 -0
- package/lib/typescript/src/classes/CactusLM.d.ts +25 -0
- package/lib/typescript/src/classes/CactusLM.d.ts.map +1 -0
- package/lib/typescript/src/config/CactusConfig.d.ts +5 -0
- package/lib/typescript/src/config/CactusConfig.d.ts.map +1 -0
- package/lib/typescript/src/constants/packageVersion.d.ts +2 -0
- package/lib/typescript/src/constants/packageVersion.d.ts.map +1 -0
- package/lib/typescript/src/hooks/useCactusLM.d.ts +20 -0
- package/lib/typescript/src/hooks/useCactusLM.d.ts.map +1 -0
- package/lib/typescript/src/index.d.ts +6 -0
- package/lib/typescript/src/index.d.ts.map +1 -0
- package/lib/typescript/src/native/Cactus.d.ts +11 -0
- package/lib/typescript/src/native/Cactus.d.ts.map +1 -0
- package/lib/typescript/src/native/CactusCrypto.d.ts +5 -0
- package/lib/typescript/src/native/CactusCrypto.d.ts.map +1 -0
- package/lib/typescript/src/native/CactusDeviceInfo.d.ts +7 -0
- package/lib/typescript/src/native/CactusDeviceInfo.d.ts.map +1 -0
- package/lib/typescript/src/native/CactusFileSystem.d.ts +13 -0
- package/lib/typescript/src/native/CactusFileSystem.d.ts.map +1 -0
- package/lib/typescript/src/native/CactusUtil.d.ts +6 -0
- package/lib/typescript/src/native/CactusUtil.d.ts.map +1 -0
- package/lib/typescript/src/native/index.d.ts +6 -0
- package/lib/typescript/src/native/index.d.ts.map +1 -0
- package/lib/typescript/src/specs/Cactus.nitro.d.ts +13 -0
- package/lib/typescript/src/specs/Cactus.nitro.d.ts.map +1 -0
- package/lib/typescript/src/specs/CactusCrypto.nitro.d.ts +8 -0
- package/lib/typescript/src/specs/CactusCrypto.nitro.d.ts.map +1 -0
- package/lib/typescript/src/specs/CactusDeviceInfo.nitro.d.ts +16 -0
- package/lib/typescript/src/specs/CactusDeviceInfo.nitro.d.ts.map +1 -0
- package/lib/typescript/src/specs/CactusFileSystem.nitro.d.ts +16 -0
- package/lib/typescript/src/specs/CactusFileSystem.nitro.d.ts.map +1 -0
- package/lib/typescript/src/specs/CactusUtil.nitro.d.ts +10 -0
- package/lib/typescript/src/specs/CactusUtil.nitro.d.ts.map +1 -0
- package/lib/typescript/src/telemetry/Telemetry.d.ts +30 -0
- package/lib/typescript/src/telemetry/Telemetry.d.ts.map +1 -0
- package/lib/typescript/src/types/CactusLM.d.ts +65 -0
- package/lib/typescript/src/types/CactusLM.d.ts.map +1 -0
- package/lib/typescript/src/types/CactusModel.d.ts +12 -0
- package/lib/typescript/src/types/CactusModel.d.ts.map +1 -0
- package/lib/typescript/src/utils/error.d.ts +2 -0
- package/lib/typescript/src/utils/error.d.ts.map +1 -0
- package/nitro.json +31 -0
- package/nitrogen/generated/android/c++/JDeviceInfo.hpp +74 -0
- package/nitrogen/generated/android/c++/JFunc_void_double.hpp +74 -0
- package/nitrogen/generated/android/c++/JHybridCactusCryptoSpec.cpp +65 -0
- package/nitrogen/generated/android/c++/JHybridCactusCryptoSpec.hpp +65 -0
- package/nitrogen/generated/android/c++/JHybridCactusDeviceInfoSpec.cpp +85 -0
- package/nitrogen/generated/android/c++/JHybridCactusDeviceInfoSpec.hpp +66 -0
- package/nitrogen/generated/android/c++/JHybridCactusFileSystemSpec.cpp +192 -0
- package/nitrogen/generated/android/c++/JHybridCactusFileSystemSpec.hpp +73 -0
- package/nitrogen/generated/android/cactus+autolinking.cmake +87 -0
- package/nitrogen/generated/android/cactus+autolinking.gradle +27 -0
- package/nitrogen/generated/android/cactusOnLoad.cpp +86 -0
- package/nitrogen/generated/android/cactusOnLoad.hpp +25 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/cactus/DeviceInfo.kt +50 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/cactus/Func_void_double.kt +80 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/cactus/HybridCactusCryptoSpec.kt +58 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/cactus/HybridCactusDeviceInfoSpec.kt +62 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/cactus/HybridCactusFileSystemSpec.kt +95 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/cactus/cactusOnLoad.kt +35 -0
- package/nitrogen/generated/ios/Cactus+autolinking.rb +60 -0
- package/nitrogen/generated/ios/Cactus-Swift-Cxx-Bridge.cpp +122 -0
- package/nitrogen/generated/ios/Cactus-Swift-Cxx-Bridge.hpp +373 -0
- package/nitrogen/generated/ios/Cactus-Swift-Cxx-Umbrella.hpp +60 -0
- package/nitrogen/generated/ios/CactusAutolinking.mm +69 -0
- package/nitrogen/generated/ios/CactusAutolinking.swift +55 -0
- package/nitrogen/generated/ios/c++/HybridCactusCryptoSpecSwift.cpp +11 -0
- package/nitrogen/generated/ios/c++/HybridCactusCryptoSpecSwift.hpp +77 -0
- package/nitrogen/generated/ios/c++/HybridCactusDeviceInfoSpecSwift.cpp +11 -0
- package/nitrogen/generated/ios/c++/HybridCactusDeviceInfoSpecSwift.hpp +88 -0
- package/nitrogen/generated/ios/c++/HybridCactusFileSystemSpecSwift.cpp +11 -0
- package/nitrogen/generated/ios/c++/HybridCactusFileSystemSpecSwift.hpp +143 -0
- package/nitrogen/generated/ios/swift/DeviceInfo.swift +98 -0
- package/nitrogen/generated/ios/swift/Func_void.swift +47 -0
- package/nitrogen/generated/ios/swift/Func_void_DeviceInfo.swift +47 -0
- package/nitrogen/generated/ios/swift/Func_void_bool.swift +47 -0
- package/nitrogen/generated/ios/swift/Func_void_double.swift +47 -0
- package/nitrogen/generated/ios/swift/Func_void_std__exception_ptr.swift +47 -0
- package/nitrogen/generated/ios/swift/Func_void_std__optional_std__string_.swift +54 -0
- package/nitrogen/generated/ios/swift/Func_void_std__string.swift +47 -0
- package/nitrogen/generated/ios/swift/HybridCactusCryptoSpec.swift +57 -0
- package/nitrogen/generated/ios/swift/HybridCactusCryptoSpec_cxx.swift +139 -0
- package/nitrogen/generated/ios/swift/HybridCactusDeviceInfoSpec.swift +58 -0
- package/nitrogen/generated/ios/swift/HybridCactusDeviceInfoSpec_cxx.swift +164 -0
- package/nitrogen/generated/ios/swift/HybridCactusFileSystemSpec.swift +65 -0
- package/nitrogen/generated/ios/swift/HybridCactusFileSystemSpec_cxx.swift +303 -0
- package/nitrogen/generated/shared/c++/DeviceInfo.hpp +92 -0
- package/nitrogen/generated/shared/c++/HybridCactusCryptoSpec.cpp +21 -0
- package/nitrogen/generated/shared/c++/HybridCactusCryptoSpec.hpp +63 -0
- package/nitrogen/generated/shared/c++/HybridCactusDeviceInfoSpec.cpp +22 -0
- package/nitrogen/generated/shared/c++/HybridCactusDeviceInfoSpec.hpp +67 -0
- package/nitrogen/generated/shared/c++/HybridCactusFileSystemSpec.cpp +29 -0
- package/nitrogen/generated/shared/c++/HybridCactusFileSystemSpec.hpp +73 -0
- package/nitrogen/generated/shared/c++/HybridCactusSpec.cpp +26 -0
- package/nitrogen/generated/shared/c++/HybridCactusSpec.hpp +71 -0
- package/nitrogen/generated/shared/c++/HybridCactusUtilSpec.cpp +23 -0
- package/nitrogen/generated/shared/c++/HybridCactusUtilSpec.hpp +66 -0
- package/package.json +84 -143
- package/src/api/Database.ts +83 -0
- package/src/classes/CactusLM.ts +203 -0
- package/src/config/CactusConfig.ts +4 -0
- package/src/constants/packageVersion.ts +1 -0
- package/src/hooks/useCactusLM.ts +282 -0
- package/src/index.tsx +23 -0
- package/src/native/Cactus.ts +79 -0
- package/src/native/CactusCrypto.ts +11 -0
- package/src/native/CactusDeviceInfo.ts +18 -0
- package/src/native/CactusFileSystem.ts +47 -0
- package/src/native/CactusUtil.ts +27 -0
- package/src/native/index.ts +5 -0
- package/src/specs/Cactus.nitro.ts +16 -0
- package/src/specs/CactusCrypto.nitro.ts +6 -0
- package/src/specs/CactusDeviceInfo.nitro.ts +15 -0
- package/src/specs/CactusFileSystem.nitro.ts +21 -0
- package/src/specs/CactusUtil.nitro.ts +8 -0
- package/src/telemetry/Telemetry.ts +159 -0
- package/src/types/CactusLM.ts +71 -0
- package/src/types/CactusModel.ts +14 -0
- package/src/utils/error.ts +2 -0
- package/LICENSE.txt +0 -20
- package/android/src/main/CMakeLists.txt +0 -139
- package/android/src/main/java/com/cactus/Cactus.java +0 -1190
- package/android/src/main/java/com/cactus/CactusPackage.java +0 -48
- package/android/src/main/java/com/cactus/LlamaContext.java +0 -814
- package/android/src/main/jni-utils.h +0 -100
- package/android/src/main/jni.cpp +0 -1605
- package/android/src/main/jniLibs/arm64-v8a/libcactus_v8.so +0 -0
- package/android/src/main/jniLibs/arm64-v8a/libcactus_v8_2.so +0 -0
- package/android/src/main/jniLibs/arm64-v8a/libcactus_v8_2_dotprod.so +0 -0
- package/android/src/main/jniLibs/arm64-v8a/libcactus_v8_2_dotprod_i8mm.so +0 -0
- package/android/src/main/jniLibs/arm64-v8a/libcactus_v8_2_i8mm.so +0 -0
- package/android/src/newarch/java/com/cactus/CactusModule.java +0 -206
- package/android/src/oldarch/java/com/cactus/CactusModule.java +0 -205
- package/cactus-react-native.podspec +0 -42
- package/ios/CMakeLists.txt +0 -131
- package/ios/Cactus.h +0 -6
- package/ios/Cactus.mm +0 -681
- package/ios/CactusContext.h +0 -81
- package/ios/CactusContext.mm +0 -1032
- package/ios/cactus.xcframework/ios-arm64/cactus.framework/Headers/chat.h +0 -145
- package/ios/cactus.xcframework/ios-arm64/cactus.framework/Headers/common.h +0 -674
- package/ios/cactus.xcframework/ios-arm64/cactus.framework/Headers/ggml-alloc.h +0 -76
- package/ios/cactus.xcframework/ios-arm64/cactus.framework/Headers/ggml-backend-impl.h +0 -255
- package/ios/cactus.xcframework/ios-arm64/cactus.framework/Headers/ggml-backend.h +0 -354
- package/ios/cactus.xcframework/ios-arm64/cactus.framework/Headers/ggml-common.h +0 -1857
- package/ios/cactus.xcframework/ios-arm64/cactus.framework/Headers/ggml-cpp.h +0 -39
- package/ios/cactus.xcframework/ios-arm64/cactus.framework/Headers/ggml-cpu.h +0 -143
- package/ios/cactus.xcframework/ios-arm64/cactus.framework/Headers/ggml-impl.h +0 -601
- package/ios/cactus.xcframework/ios-arm64/cactus.framework/Headers/ggml-metal-impl.h +0 -622
- package/ios/cactus.xcframework/ios-arm64/cactus.framework/Headers/ggml-metal.h +0 -66
- package/ios/cactus.xcframework/ios-arm64/cactus.framework/Headers/ggml-opt.h +0 -237
- package/ios/cactus.xcframework/ios-arm64/cactus.framework/Headers/ggml-quants.h +0 -100
- package/ios/cactus.xcframework/ios-arm64/cactus.framework/Headers/ggml-threading.h +0 -14
- package/ios/cactus.xcframework/ios-arm64/cactus.framework/Headers/ggml.h +0 -2202
- package/ios/cactus.xcframework/ios-arm64/cactus.framework/Headers/gguf.h +0 -202
- package/ios/cactus.xcframework/ios-arm64/cactus.framework/Headers/json-schema-to-grammar.h +0 -21
- package/ios/cactus.xcframework/ios-arm64/cactus.framework/Headers/json.hpp +0 -24766
- package/ios/cactus.xcframework/ios-arm64/cactus.framework/Headers/llama-adapter.h +0 -76
- package/ios/cactus.xcframework/ios-arm64/cactus.framework/Headers/llama-arch.h +0 -437
- package/ios/cactus.xcframework/ios-arm64/cactus.framework/Headers/llama-batch.h +0 -89
- package/ios/cactus.xcframework/ios-arm64/cactus.framework/Headers/llama-chat.h +0 -58
- package/ios/cactus.xcframework/ios-arm64/cactus.framework/Headers/llama-context.h +0 -276
- package/ios/cactus.xcframework/ios-arm64/cactus.framework/Headers/llama-cparams.h +0 -39
- package/ios/cactus.xcframework/ios-arm64/cactus.framework/Headers/llama-cpp.h +0 -30
- package/ios/cactus.xcframework/ios-arm64/cactus.framework/Headers/llama-grammar.h +0 -173
- package/ios/cactus.xcframework/ios-arm64/cactus.framework/Headers/llama-graph.h +0 -640
- package/ios/cactus.xcframework/ios-arm64/cactus.framework/Headers/llama-hparams.h +0 -190
- package/ios/cactus.xcframework/ios-arm64/cactus.framework/Headers/llama-impl.h +0 -61
- package/ios/cactus.xcframework/ios-arm64/cactus.framework/Headers/llama-io.h +0 -35
- package/ios/cactus.xcframework/ios-arm64/cactus.framework/Headers/llama-kv-cache.h +0 -515
- package/ios/cactus.xcframework/ios-arm64/cactus.framework/Headers/llama-memory.h +0 -32
- package/ios/cactus.xcframework/ios-arm64/cactus.framework/Headers/llama-mmap.h +0 -68
- package/ios/cactus.xcframework/ios-arm64/cactus.framework/Headers/llama-model-loader.h +0 -169
- package/ios/cactus.xcframework/ios-arm64/cactus.framework/Headers/llama-model-saver.h +0 -37
- package/ios/cactus.xcframework/ios-arm64/cactus.framework/Headers/llama-model.h +0 -425
- package/ios/cactus.xcframework/ios-arm64/cactus.framework/Headers/llama-sampling.h +0 -32
- package/ios/cactus.xcframework/ios-arm64/cactus.framework/Headers/llama-vocab.h +0 -131
- package/ios/cactus.xcframework/ios-arm64/cactus.framework/Headers/llama.h +0 -1376
- package/ios/cactus.xcframework/ios-arm64/cactus.framework/Headers/log.h +0 -103
- package/ios/cactus.xcframework/ios-arm64/cactus.framework/Headers/minja/chat-template.hpp +0 -542
- package/ios/cactus.xcframework/ios-arm64/cactus.framework/Headers/minja/minja.hpp +0 -2974
- package/ios/cactus.xcframework/ios-arm64/cactus.framework/Headers/sampling.h +0 -107
- package/ios/cactus.xcframework/ios-arm64/cactus.framework/Headers/unicode-data.h +0 -20
- package/ios/cactus.xcframework/ios-arm64/cactus.framework/Headers/unicode.h +0 -66
- package/ios/cactus.xcframework/ios-arm64/cactus.framework/ggml-llama.metallib +0 -0
- package/ios/cactus.xcframework/ios-arm64_x86_64-simulator/cactus.framework/Headers/cactus.h +0 -232
- package/ios/cactus.xcframework/ios-arm64_x86_64-simulator/cactus.framework/Headers/cactus_ffi.h +0 -256
- package/ios/cactus.xcframework/ios-arm64_x86_64-simulator/cactus.framework/Headers/chat.h +0 -145
- package/ios/cactus.xcframework/ios-arm64_x86_64-simulator/cactus.framework/Headers/common.h +0 -674
- package/ios/cactus.xcframework/ios-arm64_x86_64-simulator/cactus.framework/Headers/ggml-alloc.h +0 -76
- package/ios/cactus.xcframework/ios-arm64_x86_64-simulator/cactus.framework/Headers/ggml-backend-impl.h +0 -255
- package/ios/cactus.xcframework/ios-arm64_x86_64-simulator/cactus.framework/Headers/ggml-backend.h +0 -354
- package/ios/cactus.xcframework/ios-arm64_x86_64-simulator/cactus.framework/Headers/ggml-common.h +0 -1857
- package/ios/cactus.xcframework/ios-arm64_x86_64-simulator/cactus.framework/Headers/ggml-cpp.h +0 -39
- package/ios/cactus.xcframework/ios-arm64_x86_64-simulator/cactus.framework/Headers/ggml-cpu.h +0 -143
- package/ios/cactus.xcframework/ios-arm64_x86_64-simulator/cactus.framework/Headers/ggml-impl.h +0 -601
- package/ios/cactus.xcframework/ios-arm64_x86_64-simulator/cactus.framework/Headers/ggml-metal-impl.h +0 -622
- package/ios/cactus.xcframework/ios-arm64_x86_64-simulator/cactus.framework/Headers/ggml-metal.h +0 -66
- package/ios/cactus.xcframework/ios-arm64_x86_64-simulator/cactus.framework/Headers/ggml-opt.h +0 -237
- package/ios/cactus.xcframework/ios-arm64_x86_64-simulator/cactus.framework/Headers/ggml-quants.h +0 -100
- package/ios/cactus.xcframework/ios-arm64_x86_64-simulator/cactus.framework/Headers/ggml-threading.h +0 -14
- package/ios/cactus.xcframework/ios-arm64_x86_64-simulator/cactus.framework/Headers/ggml.h +0 -2202
- package/ios/cactus.xcframework/ios-arm64_x86_64-simulator/cactus.framework/Headers/gguf.h +0 -202
- package/ios/cactus.xcframework/ios-arm64_x86_64-simulator/cactus.framework/Headers/json-schema-to-grammar.h +0 -21
- package/ios/cactus.xcframework/ios-arm64_x86_64-simulator/cactus.framework/Headers/json.hpp +0 -24766
- package/ios/cactus.xcframework/ios-arm64_x86_64-simulator/cactus.framework/Headers/llama-adapter.h +0 -76
- package/ios/cactus.xcframework/ios-arm64_x86_64-simulator/cactus.framework/Headers/llama-arch.h +0 -437
- package/ios/cactus.xcframework/ios-arm64_x86_64-simulator/cactus.framework/Headers/llama-batch.h +0 -89
- package/ios/cactus.xcframework/ios-arm64_x86_64-simulator/cactus.framework/Headers/llama-chat.h +0 -58
- package/ios/cactus.xcframework/ios-arm64_x86_64-simulator/cactus.framework/Headers/llama-context.h +0 -276
- package/ios/cactus.xcframework/ios-arm64_x86_64-simulator/cactus.framework/Headers/llama-cparams.h +0 -39
- package/ios/cactus.xcframework/ios-arm64_x86_64-simulator/cactus.framework/Headers/llama-cpp.h +0 -30
- package/ios/cactus.xcframework/ios-arm64_x86_64-simulator/cactus.framework/Headers/llama-grammar.h +0 -173
- package/ios/cactus.xcframework/ios-arm64_x86_64-simulator/cactus.framework/Headers/llama-graph.h +0 -640
- package/ios/cactus.xcframework/ios-arm64_x86_64-simulator/cactus.framework/Headers/llama-hparams.h +0 -190
- package/ios/cactus.xcframework/ios-arm64_x86_64-simulator/cactus.framework/Headers/llama-impl.h +0 -61
- package/ios/cactus.xcframework/ios-arm64_x86_64-simulator/cactus.framework/Headers/llama-io.h +0 -35
- package/ios/cactus.xcframework/ios-arm64_x86_64-simulator/cactus.framework/Headers/llama-kv-cache.h +0 -515
- package/ios/cactus.xcframework/ios-arm64_x86_64-simulator/cactus.framework/Headers/llama-memory.h +0 -32
- package/ios/cactus.xcframework/ios-arm64_x86_64-simulator/cactus.framework/Headers/llama-mmap.h +0 -68
- package/ios/cactus.xcframework/ios-arm64_x86_64-simulator/cactus.framework/Headers/llama-model-loader.h +0 -169
- package/ios/cactus.xcframework/ios-arm64_x86_64-simulator/cactus.framework/Headers/llama-model-saver.h +0 -37
- package/ios/cactus.xcframework/ios-arm64_x86_64-simulator/cactus.framework/Headers/llama-model.h +0 -425
- package/ios/cactus.xcframework/ios-arm64_x86_64-simulator/cactus.framework/Headers/llama-sampling.h +0 -32
- package/ios/cactus.xcframework/ios-arm64_x86_64-simulator/cactus.framework/Headers/llama-vocab.h +0 -131
- package/ios/cactus.xcframework/ios-arm64_x86_64-simulator/cactus.framework/Headers/llama.h +0 -1376
- package/ios/cactus.xcframework/ios-arm64_x86_64-simulator/cactus.framework/Headers/log.h +0 -103
- package/ios/cactus.xcframework/ios-arm64_x86_64-simulator/cactus.framework/Headers/minja/chat-template.hpp +0 -542
- package/ios/cactus.xcframework/ios-arm64_x86_64-simulator/cactus.framework/Headers/minja/minja.hpp +0 -2974
- package/ios/cactus.xcframework/ios-arm64_x86_64-simulator/cactus.framework/Headers/sampling.h +0 -107
- package/ios/cactus.xcframework/ios-arm64_x86_64-simulator/cactus.framework/Headers/unicode-data.h +0 -20
- package/ios/cactus.xcframework/ios-arm64_x86_64-simulator/cactus.framework/Headers/unicode.h +0 -66
- package/ios/cactus.xcframework/ios-arm64_x86_64-simulator/cactus.framework/cactus +0 -0
- package/ios/cactus.xcframework/ios-arm64_x86_64-simulator/cactus.framework/ggml-llama-sim.metallib +0 -0
- package/ios/cactus.xcframework/tvos-arm64/cactus.framework/Headers/cactus.h +0 -232
- package/ios/cactus.xcframework/tvos-arm64/cactus.framework/Headers/cactus_ffi.h +0 -256
- package/ios/cactus.xcframework/tvos-arm64/cactus.framework/Headers/chat.h +0 -145
- package/ios/cactus.xcframework/tvos-arm64/cactus.framework/Headers/common.h +0 -674
- package/ios/cactus.xcframework/tvos-arm64/cactus.framework/Headers/ggml-alloc.h +0 -76
- package/ios/cactus.xcframework/tvos-arm64/cactus.framework/Headers/ggml-backend-impl.h +0 -255
- package/ios/cactus.xcframework/tvos-arm64/cactus.framework/Headers/ggml-backend.h +0 -354
- package/ios/cactus.xcframework/tvos-arm64/cactus.framework/Headers/ggml-common.h +0 -1857
- package/ios/cactus.xcframework/tvos-arm64/cactus.framework/Headers/ggml-cpp.h +0 -39
- package/ios/cactus.xcframework/tvos-arm64/cactus.framework/Headers/ggml-cpu.h +0 -143
- package/ios/cactus.xcframework/tvos-arm64/cactus.framework/Headers/ggml-impl.h +0 -601
- package/ios/cactus.xcframework/tvos-arm64/cactus.framework/Headers/ggml-metal-impl.h +0 -622
- package/ios/cactus.xcframework/tvos-arm64/cactus.framework/Headers/ggml-metal.h +0 -66
- package/ios/cactus.xcframework/tvos-arm64/cactus.framework/Headers/ggml-opt.h +0 -237
- package/ios/cactus.xcframework/tvos-arm64/cactus.framework/Headers/ggml-quants.h +0 -100
- package/ios/cactus.xcframework/tvos-arm64/cactus.framework/Headers/ggml-threading.h +0 -14
- package/ios/cactus.xcframework/tvos-arm64/cactus.framework/Headers/ggml.h +0 -2202
- package/ios/cactus.xcframework/tvos-arm64/cactus.framework/Headers/gguf.h +0 -202
- package/ios/cactus.xcframework/tvos-arm64/cactus.framework/Headers/json-schema-to-grammar.h +0 -21
- package/ios/cactus.xcframework/tvos-arm64/cactus.framework/Headers/json.hpp +0 -24766
- package/ios/cactus.xcframework/tvos-arm64/cactus.framework/Headers/llama-adapter.h +0 -76
- package/ios/cactus.xcframework/tvos-arm64/cactus.framework/Headers/llama-arch.h +0 -437
- package/ios/cactus.xcframework/tvos-arm64/cactus.framework/Headers/llama-batch.h +0 -89
- package/ios/cactus.xcframework/tvos-arm64/cactus.framework/Headers/llama-chat.h +0 -58
- package/ios/cactus.xcframework/tvos-arm64/cactus.framework/Headers/llama-context.h +0 -276
- package/ios/cactus.xcframework/tvos-arm64/cactus.framework/Headers/llama-cparams.h +0 -39
- package/ios/cactus.xcframework/tvos-arm64/cactus.framework/Headers/llama-cpp.h +0 -30
- package/ios/cactus.xcframework/tvos-arm64/cactus.framework/Headers/llama-grammar.h +0 -173
- package/ios/cactus.xcframework/tvos-arm64/cactus.framework/Headers/llama-graph.h +0 -640
- package/ios/cactus.xcframework/tvos-arm64/cactus.framework/Headers/llama-hparams.h +0 -190
- package/ios/cactus.xcframework/tvos-arm64/cactus.framework/Headers/llama-impl.h +0 -61
- package/ios/cactus.xcframework/tvos-arm64/cactus.framework/Headers/llama-io.h +0 -35
- package/ios/cactus.xcframework/tvos-arm64/cactus.framework/Headers/llama-kv-cache.h +0 -515
- package/ios/cactus.xcframework/tvos-arm64/cactus.framework/Headers/llama-memory.h +0 -32
- package/ios/cactus.xcframework/tvos-arm64/cactus.framework/Headers/llama-mmap.h +0 -68
- package/ios/cactus.xcframework/tvos-arm64/cactus.framework/Headers/llama-model-loader.h +0 -169
- package/ios/cactus.xcframework/tvos-arm64/cactus.framework/Headers/llama-model-saver.h +0 -37
- package/ios/cactus.xcframework/tvos-arm64/cactus.framework/Headers/llama-model.h +0 -425
- package/ios/cactus.xcframework/tvos-arm64/cactus.framework/Headers/llama-sampling.h +0 -32
- package/ios/cactus.xcframework/tvos-arm64/cactus.framework/Headers/llama-vocab.h +0 -131
- package/ios/cactus.xcframework/tvos-arm64/cactus.framework/Headers/llama.h +0 -1376
- package/ios/cactus.xcframework/tvos-arm64/cactus.framework/Headers/log.h +0 -103
- package/ios/cactus.xcframework/tvos-arm64/cactus.framework/Headers/minja/chat-template.hpp +0 -542
- package/ios/cactus.xcframework/tvos-arm64/cactus.framework/Headers/minja/minja.hpp +0 -2974
- package/ios/cactus.xcframework/tvos-arm64/cactus.framework/Headers/sampling.h +0 -107
- package/ios/cactus.xcframework/tvos-arm64/cactus.framework/Headers/unicode-data.h +0 -20
- package/ios/cactus.xcframework/tvos-arm64/cactus.framework/Headers/unicode.h +0 -66
- package/ios/cactus.xcframework/tvos-arm64/cactus.framework/Info.plist +0 -0
- package/ios/cactus.xcframework/tvos-arm64/cactus.framework/cactus +0 -0
- package/ios/cactus.xcframework/tvos-arm64/cactus.framework/ggml-llama.metallib +0 -0
- package/ios/cactus.xcframework/tvos-arm64_x86_64-simulator/cactus.framework/Headers/cactus.h +0 -232
- package/ios/cactus.xcframework/tvos-arm64_x86_64-simulator/cactus.framework/Headers/cactus_ffi.h +0 -256
- package/ios/cactus.xcframework/tvos-arm64_x86_64-simulator/cactus.framework/Headers/chat.h +0 -145
- package/ios/cactus.xcframework/tvos-arm64_x86_64-simulator/cactus.framework/Headers/common.h +0 -674
- package/ios/cactus.xcframework/tvos-arm64_x86_64-simulator/cactus.framework/Headers/ggml-alloc.h +0 -76
- package/ios/cactus.xcframework/tvos-arm64_x86_64-simulator/cactus.framework/Headers/ggml-backend-impl.h +0 -255
- package/ios/cactus.xcframework/tvos-arm64_x86_64-simulator/cactus.framework/Headers/ggml-backend.h +0 -354
- package/ios/cactus.xcframework/tvos-arm64_x86_64-simulator/cactus.framework/Headers/ggml-common.h +0 -1857
- package/ios/cactus.xcframework/tvos-arm64_x86_64-simulator/cactus.framework/Headers/ggml-cpp.h +0 -39
- package/ios/cactus.xcframework/tvos-arm64_x86_64-simulator/cactus.framework/Headers/ggml-cpu.h +0 -143
- package/ios/cactus.xcframework/tvos-arm64_x86_64-simulator/cactus.framework/Headers/ggml-impl.h +0 -601
- package/ios/cactus.xcframework/tvos-arm64_x86_64-simulator/cactus.framework/Headers/ggml-metal-impl.h +0 -622
- package/ios/cactus.xcframework/tvos-arm64_x86_64-simulator/cactus.framework/Headers/ggml-metal.h +0 -66
- package/ios/cactus.xcframework/tvos-arm64_x86_64-simulator/cactus.framework/Headers/ggml-opt.h +0 -237
- package/ios/cactus.xcframework/tvos-arm64_x86_64-simulator/cactus.framework/Headers/ggml-quants.h +0 -100
- package/ios/cactus.xcframework/tvos-arm64_x86_64-simulator/cactus.framework/Headers/ggml-threading.h +0 -14
- package/ios/cactus.xcframework/tvos-arm64_x86_64-simulator/cactus.framework/Headers/ggml.h +0 -2202
- package/ios/cactus.xcframework/tvos-arm64_x86_64-simulator/cactus.framework/Headers/gguf.h +0 -202
- package/ios/cactus.xcframework/tvos-arm64_x86_64-simulator/cactus.framework/Headers/json-schema-to-grammar.h +0 -21
- package/ios/cactus.xcframework/tvos-arm64_x86_64-simulator/cactus.framework/Headers/json.hpp +0 -24766
- package/ios/cactus.xcframework/tvos-arm64_x86_64-simulator/cactus.framework/Headers/llama-adapter.h +0 -76
- package/ios/cactus.xcframework/tvos-arm64_x86_64-simulator/cactus.framework/Headers/llama-arch.h +0 -437
- package/ios/cactus.xcframework/tvos-arm64_x86_64-simulator/cactus.framework/Headers/llama-batch.h +0 -89
- package/ios/cactus.xcframework/tvos-arm64_x86_64-simulator/cactus.framework/Headers/llama-chat.h +0 -58
- package/ios/cactus.xcframework/tvos-arm64_x86_64-simulator/cactus.framework/Headers/llama-context.h +0 -276
- package/ios/cactus.xcframework/tvos-arm64_x86_64-simulator/cactus.framework/Headers/llama-cparams.h +0 -39
- package/ios/cactus.xcframework/tvos-arm64_x86_64-simulator/cactus.framework/Headers/llama-cpp.h +0 -30
- package/ios/cactus.xcframework/tvos-arm64_x86_64-simulator/cactus.framework/Headers/llama-grammar.h +0 -173
- package/ios/cactus.xcframework/tvos-arm64_x86_64-simulator/cactus.framework/Headers/llama-graph.h +0 -640
- package/ios/cactus.xcframework/tvos-arm64_x86_64-simulator/cactus.framework/Headers/llama-hparams.h +0 -190
- package/ios/cactus.xcframework/tvos-arm64_x86_64-simulator/cactus.framework/Headers/llama-impl.h +0 -61
- package/ios/cactus.xcframework/tvos-arm64_x86_64-simulator/cactus.framework/Headers/llama-io.h +0 -35
- package/ios/cactus.xcframework/tvos-arm64_x86_64-simulator/cactus.framework/Headers/llama-kv-cache.h +0 -515
- package/ios/cactus.xcframework/tvos-arm64_x86_64-simulator/cactus.framework/Headers/llama-memory.h +0 -32
- package/ios/cactus.xcframework/tvos-arm64_x86_64-simulator/cactus.framework/Headers/llama-mmap.h +0 -68
- package/ios/cactus.xcframework/tvos-arm64_x86_64-simulator/cactus.framework/Headers/llama-model-loader.h +0 -169
- package/ios/cactus.xcframework/tvos-arm64_x86_64-simulator/cactus.framework/Headers/llama-model-saver.h +0 -37
- package/ios/cactus.xcframework/tvos-arm64_x86_64-simulator/cactus.framework/Headers/llama-model.h +0 -425
- package/ios/cactus.xcframework/tvos-arm64_x86_64-simulator/cactus.framework/Headers/llama-sampling.h +0 -32
- package/ios/cactus.xcframework/tvos-arm64_x86_64-simulator/cactus.framework/Headers/llama-vocab.h +0 -131
- package/ios/cactus.xcframework/tvos-arm64_x86_64-simulator/cactus.framework/Headers/llama.h +0 -1376
- package/ios/cactus.xcframework/tvos-arm64_x86_64-simulator/cactus.framework/Headers/log.h +0 -103
- package/ios/cactus.xcframework/tvos-arm64_x86_64-simulator/cactus.framework/Headers/minja/chat-template.hpp +0 -542
- package/ios/cactus.xcframework/tvos-arm64_x86_64-simulator/cactus.framework/Headers/minja/minja.hpp +0 -2974
- package/ios/cactus.xcframework/tvos-arm64_x86_64-simulator/cactus.framework/Headers/sampling.h +0 -107
- package/ios/cactus.xcframework/tvos-arm64_x86_64-simulator/cactus.framework/Headers/unicode-data.h +0 -20
- package/ios/cactus.xcframework/tvos-arm64_x86_64-simulator/cactus.framework/Headers/unicode.h +0 -66
- package/ios/cactus.xcframework/tvos-arm64_x86_64-simulator/cactus.framework/Info.plist +0 -0
- package/ios/cactus.xcframework/tvos-arm64_x86_64-simulator/cactus.framework/cactus +0 -0
- package/ios/cactus.xcframework/tvos-arm64_x86_64-simulator/cactus.framework/ggml-llama-sim.metallib +0 -0
- package/lib/commonjs/NativeCactus.js +0 -9
- package/lib/commonjs/NativeCactus.js.map +0 -1
- package/lib/commonjs/agent.js +0 -73
- package/lib/commonjs/agent.js.map +0 -1
- package/lib/commonjs/chat.js +0 -73
- package/lib/commonjs/chat.js.map +0 -1
- package/lib/commonjs/index.js +0 -523
- package/lib/commonjs/index.js.map +0 -1
- package/lib/commonjs/lm.js +0 -272
- package/lib/commonjs/lm.js.map +0 -1
- package/lib/commonjs/package.json +0 -1
- package/lib/commonjs/projectId.js +0 -8
- package/lib/commonjs/projectId.js.map +0 -1
- package/lib/commonjs/remote.js +0 -100
- package/lib/commonjs/remote.js.map +0 -1
- package/lib/commonjs/telemetry.js +0 -102
- package/lib/commonjs/telemetry.js.map +0 -1
- package/lib/commonjs/tools.js +0 -72
- package/lib/commonjs/tools.js.map +0 -1
- package/lib/commonjs/tts.js +0 -29
- package/lib/commonjs/tts.js.map +0 -1
- package/lib/commonjs/vlm.js +0 -221
- package/lib/commonjs/vlm.js.map +0 -1
- package/lib/module/NativeCactus.js +0 -5
- package/lib/module/NativeCactus.js.map +0 -1
- package/lib/module/agent.js +0 -68
- package/lib/module/agent.js.map +0 -1
- package/lib/module/chat.js +0 -67
- package/lib/module/chat.js.map +0 -1
- package/lib/module/lm.js +0 -267
- package/lib/module/lm.js.map +0 -1
- package/lib/module/projectId.js +0 -4
- package/lib/module/projectId.js.map +0 -1
- package/lib/module/remote.js +0 -91
- package/lib/module/remote.js.map +0 -1
- package/lib/module/telemetry.js +0 -97
- package/lib/module/telemetry.js.map +0 -1
- package/lib/module/tools.js +0 -66
- package/lib/module/tools.js.map +0 -1
- package/lib/module/tts.js +0 -24
- package/lib/module/tts.js.map +0 -1
- package/lib/module/vlm.js +0 -216
- package/lib/module/vlm.js.map +0 -1
- package/lib/typescript/NativeCactus.d.ts +0 -252
- package/lib/typescript/NativeCactus.d.ts.map +0 -1
- package/lib/typescript/agent.d.ts +0 -31
- package/lib/typescript/agent.d.ts.map +0 -1
- package/lib/typescript/chat.d.ts +0 -23
- package/lib/typescript/chat.d.ts.map +0 -1
- package/lib/typescript/index.d.ts +0 -114
- package/lib/typescript/index.d.ts.map +0 -1
- package/lib/typescript/lm.d.ts +0 -36
- package/lib/typescript/lm.d.ts.map +0 -1
- package/lib/typescript/projectId.d.ts +0 -2
- package/lib/typescript/projectId.d.ts.map +0 -1
- package/lib/typescript/remote.d.ts +0 -8
- package/lib/typescript/remote.d.ts.map +0 -1
- package/lib/typescript/telemetry.d.ts +0 -25
- package/lib/typescript/telemetry.d.ts.map +0 -1
- package/lib/typescript/tools.d.ts +0 -36
- package/lib/typescript/tools.d.ts.map +0 -1
- package/lib/typescript/tts.d.ts +0 -10
- package/lib/typescript/tts.d.ts.map +0 -1
- package/lib/typescript/vlm.d.ts +0 -33
- package/lib/typescript/vlm.d.ts.map +0 -1
- package/scripts/postInstall.js +0 -33
- package/src/NativeCactus.ts +0 -317
- package/src/agent.ts +0 -112
- package/src/chat.ts +0 -91
- package/src/index.ts +0 -662
- package/src/lm.ts +0 -324
- package/src/projectId.ts +0 -1
- package/src/remote.ts +0 -113
- package/src/telemetry.ts +0 -137
- package/src/tools.ts +0 -94
- package/src/tts.ts +0 -42
- package/src/vlm.ts +0 -276
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"vlm.d.ts","sourceRoot":"","sources":["../../src/vlm.ts"],"names":[],"mappings":"AAAA,OAAO,EAKL,KAAK,aAAa,EAClB,KAAK,gBAAgB,EACrB,KAAK,0BAA0B,EAC/B,KAAK,sBAAsB,EAC5B,MAAM,SAAS,CAAA;AAIhB,OAAO,EAAE,0BAA0B,EAAE,MAAM,QAAQ,CAAA;AAEnD,UAAU,eAAe;IACvB,GAAG,EAAE,SAAS,GAAG,IAAI,CAAA;IACrB,KAAK,EAAE,KAAK,GAAG,IAAI,CAAA;CACpB;AAED,MAAM,MAAM,gBAAgB,GAAG,aAAa,GAAG;IAC7C,MAAM,EAAE,MAAM,CAAA;CACf,CAAA;AAED,MAAM,MAAM,mBAAmB,GAAG,IAAI,CAAC,gBAAgB,EAAE,QAAQ,CAAC,GAAG;IACnE,MAAM,CAAC,EAAE,MAAM,EAAE,CAAA;IACjB,IAAI,CAAC,EAAE,MAAM,CAAA;CACd,CAAA;AAED,qBAAa,SAAS;IACpB,OAAO,CAAC,OAAO,CAAc;IAC7B,SAAS,CAAC,0BAA0B,EAAE,0BAA0B,CAAA;IAEhE,OAAO,CAAC,MAAM,CAAC,UAAU,CAAoD;IAE7E,OAAO,CAAC,MAAM,CAAC,WAAW;IAI1B,OAAO;WAKM,IAAI,CACf,MAAM,EAAE,gBAAgB,EACxB,UAAU,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,IAAI,EACvC,WAAW,CAAC,EAAE,MAAM,EACpB,YAAY,CAAC,EAAE;QAAE,UAAU,CAAC,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,MAAM,CAAA;KAAE,GACvD,OAAO,CAAC,eAAe,CAAC;IA8ErB,UAAU,CACd,QAAQ,EAAE,0BAA0B,EAAE,EACtC,MAAM,GAAE,mBAAwB,EAChC,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,GAAG,KAAK,IAAI,GAC7B,OAAO,CAAC,sBAAsB,CAAC;IAuClC,OAAO,CAAC,sBAAsB,CAyC7B;YAEa,uBAAuB;IA+C/B,MAAM,IAAI,OAAO,CAAC,IAAI,CAAC;IAIvB,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;IAIxB,cAAc,IAAI,OAAO,CAAC,IAAI,CAAC;IAIrC,gBAAgB,IAAI,OAAO;CAG5B"}
|
package/scripts/postInstall.js
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
const fs = require('fs');
|
|
2
|
-
const path = require('path');
|
|
3
|
-
const crypto = require('crypto');
|
|
4
|
-
|
|
5
|
-
const projectRoot = process.env.INIT_CWD;
|
|
6
|
-
|
|
7
|
-
if (!projectRoot || projectRoot === process.cwd()) {
|
|
8
|
-
return;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
const rootIdPath = path.join(projectRoot, '.projectId.json');
|
|
12
|
-
const internalIdPath = path.join(__dirname, '..', 'src', 'projectId.ts');
|
|
13
|
-
|
|
14
|
-
let projectId;
|
|
15
|
-
try {
|
|
16
|
-
if (fs.existsSync(rootIdPath)) {
|
|
17
|
-
projectId = JSON.parse(fs.readFileSync(rootIdPath, 'utf8'));
|
|
18
|
-
} else {
|
|
19
|
-
projectId = crypto.randomUUID();
|
|
20
|
-
fs.writeFileSync(rootIdPath, JSON.stringify(projectId), 'utf8');
|
|
21
|
-
}
|
|
22
|
-
} catch (error) {
|
|
23
|
-
console.error('Failed to read or create project ID.', error);
|
|
24
|
-
return;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
const fileContent = `// DO NOT EDIT. This file is automatically generated by a post-install script.\nexport const PROJECT_ID = '${projectId}';`;
|
|
28
|
-
|
|
29
|
-
try {
|
|
30
|
-
fs.writeFileSync(internalIdPath, fileContent, 'utf8');
|
|
31
|
-
} catch (error) {
|
|
32
|
-
console.error('Failed to sync project ID into the framework.', error);
|
|
33
|
-
}
|
package/src/NativeCactus.ts
DELETED
|
@@ -1,317 +0,0 @@
|
|
|
1
|
-
import type { TurboModule } from 'react-native'
|
|
2
|
-
import { TurboModuleRegistry } from 'react-native'
|
|
3
|
-
|
|
4
|
-
export type NativeEmbeddingParams = {
|
|
5
|
-
embd_normalize?: number
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
export type NativeContextParams = {
|
|
9
|
-
model: string
|
|
10
|
-
chat_template?: string
|
|
11
|
-
reasoning_format?: string
|
|
12
|
-
is_model_asset?: boolean
|
|
13
|
-
use_progress_callback?: boolean
|
|
14
|
-
n_ctx?: number
|
|
15
|
-
n_batch?: number
|
|
16
|
-
n_ubatch?: number
|
|
17
|
-
n_threads?: number
|
|
18
|
-
n_gpu_layers?: number
|
|
19
|
-
no_gpu_devices?: boolean
|
|
20
|
-
flash_attn?: boolean
|
|
21
|
-
cache_type_k?: string
|
|
22
|
-
cache_type_v?: string
|
|
23
|
-
use_mlock?: boolean
|
|
24
|
-
use_mmap?: boolean
|
|
25
|
-
vocab_only?: boolean
|
|
26
|
-
lora?: string
|
|
27
|
-
lora_scaled?: number
|
|
28
|
-
lora_list?: Array<{ path: string; scaled?: number }>
|
|
29
|
-
rope_freq_base?: number
|
|
30
|
-
rope_freq_scale?: number
|
|
31
|
-
pooling_type?: number
|
|
32
|
-
embedding?: boolean
|
|
33
|
-
embd_normalize?: number
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
export type NativeCompletionParams = {
|
|
37
|
-
prompt: string
|
|
38
|
-
n_threads?: number
|
|
39
|
-
json_schema?: string
|
|
40
|
-
grammar?: string
|
|
41
|
-
grammar_lazy?: boolean
|
|
42
|
-
grammar_triggers?: Array<{
|
|
43
|
-
type: number
|
|
44
|
-
value: string
|
|
45
|
-
token: number
|
|
46
|
-
}>
|
|
47
|
-
preserved_tokens?: Array<string>
|
|
48
|
-
chat_format?: number
|
|
49
|
-
stop?: Array<string>
|
|
50
|
-
n_predict?: number
|
|
51
|
-
n_probs?: number
|
|
52
|
-
top_k?: number
|
|
53
|
-
top_p?: number
|
|
54
|
-
min_p?: number
|
|
55
|
-
xtc_probability?: number
|
|
56
|
-
xtc_threshold?: number
|
|
57
|
-
typical_p?: number
|
|
58
|
-
temperature?: number
|
|
59
|
-
penalty_last_n?: number
|
|
60
|
-
penalty_repeat?: number
|
|
61
|
-
penalty_freq?: number
|
|
62
|
-
penalty_present?: number
|
|
63
|
-
mirostat?: number
|
|
64
|
-
mirostat_tau?: number
|
|
65
|
-
mirostat_eta?: number
|
|
66
|
-
dry_multiplier?: number
|
|
67
|
-
dry_base?: number
|
|
68
|
-
dry_allowed_length?: number
|
|
69
|
-
dry_penalty_last_n?: number
|
|
70
|
-
dry_sequence_breakers?: Array<string>
|
|
71
|
-
top_n_sigma?: number
|
|
72
|
-
ignore_eos?: boolean
|
|
73
|
-
logit_bias?: Array<Array<number>>
|
|
74
|
-
seed?: number
|
|
75
|
-
emit_partial_completion: boolean
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
export type NativeCompletionTokenProbItem = {
|
|
79
|
-
tok_str: string
|
|
80
|
-
prob: number
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
export type NativeCompletionTokenProb = {
|
|
84
|
-
content: string
|
|
85
|
-
probs: Array<NativeCompletionTokenProbItem>
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
export type NativeCompletionResultTimings = {
|
|
89
|
-
prompt_n: number
|
|
90
|
-
prompt_ms: number
|
|
91
|
-
prompt_per_token_ms: number
|
|
92
|
-
prompt_per_second: number
|
|
93
|
-
predicted_n: number
|
|
94
|
-
predicted_ms: number
|
|
95
|
-
predicted_per_token_ms: number
|
|
96
|
-
predicted_per_second: number
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
export type NativeCompletionResult = {
|
|
100
|
-
text: string
|
|
101
|
-
reasoning_content: string
|
|
102
|
-
tool_calls: Array<{
|
|
103
|
-
type: 'function'
|
|
104
|
-
function: {
|
|
105
|
-
name: string
|
|
106
|
-
arguments: string
|
|
107
|
-
}
|
|
108
|
-
id?: string
|
|
109
|
-
}>
|
|
110
|
-
content: string
|
|
111
|
-
tokens_predicted: number
|
|
112
|
-
tokens_evaluated: number
|
|
113
|
-
truncated: boolean
|
|
114
|
-
stopped_eos: boolean
|
|
115
|
-
stopped_word: string
|
|
116
|
-
stopped_limit: number
|
|
117
|
-
stopping_word: string
|
|
118
|
-
tokens_cached: number
|
|
119
|
-
timings: NativeCompletionResultTimings
|
|
120
|
-
completion_probabilities?: Array<NativeCompletionTokenProb>
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
export type NativeTokenizeResult = {
|
|
124
|
-
tokens: Array<number>
|
|
125
|
-
has_media?: boolean
|
|
126
|
-
bitmap_hashes?: Array<string>
|
|
127
|
-
chunk_pos?: Array<number>
|
|
128
|
-
chunk_pos_media?: Array<number>
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
export type NativeEmbeddingResult = {
|
|
132
|
-
embedding: Array<number>
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
export type NativeTTSType = {
|
|
136
|
-
type: number
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
export type NativeAudioCompletionResult = {
|
|
140
|
-
formatted_prompt: string
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
export type NativeAudioTokensResult = {
|
|
144
|
-
tokens: Array<number>
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
export type NativeAudioDecodeResult = {
|
|
148
|
-
audio_data: Array<number>
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
export type NativeDeviceInfo = {
|
|
152
|
-
deviceId: string
|
|
153
|
-
model: string
|
|
154
|
-
make: string
|
|
155
|
-
os: string
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
export type NativeLlamaContext = {
|
|
159
|
-
contextId: number
|
|
160
|
-
model: {
|
|
161
|
-
desc: string
|
|
162
|
-
size: number
|
|
163
|
-
nEmbd: number
|
|
164
|
-
nParams: number
|
|
165
|
-
chatTemplates: {
|
|
166
|
-
llamaChat: boolean
|
|
167
|
-
minja: {
|
|
168
|
-
default: boolean
|
|
169
|
-
defaultCaps: {
|
|
170
|
-
tools: boolean
|
|
171
|
-
toolCalls: boolean
|
|
172
|
-
toolResponses: boolean
|
|
173
|
-
systemRole: boolean
|
|
174
|
-
parallelToolCalls: boolean
|
|
175
|
-
toolCallId: boolean
|
|
176
|
-
}
|
|
177
|
-
toolUse: boolean
|
|
178
|
-
toolUseCaps: {
|
|
179
|
-
tools: boolean
|
|
180
|
-
toolCalls: boolean
|
|
181
|
-
toolResponses: boolean
|
|
182
|
-
systemRole: boolean
|
|
183
|
-
parallelToolCalls: boolean
|
|
184
|
-
toolCallId: boolean
|
|
185
|
-
}
|
|
186
|
-
}
|
|
187
|
-
}
|
|
188
|
-
metadata: Object
|
|
189
|
-
isChatTemplateSupported: boolean
|
|
190
|
-
}
|
|
191
|
-
androidLib?: string
|
|
192
|
-
gpu: boolean
|
|
193
|
-
reasonNoGPU: string
|
|
194
|
-
}
|
|
195
|
-
|
|
196
|
-
export type NativeSessionLoadResult = {
|
|
197
|
-
tokens_loaded: number
|
|
198
|
-
prompt: string
|
|
199
|
-
}
|
|
200
|
-
|
|
201
|
-
export type NativeLlamaChatMessage = {
|
|
202
|
-
role: string
|
|
203
|
-
content: string
|
|
204
|
-
}
|
|
205
|
-
|
|
206
|
-
export type JinjaFormattedChatResult = {
|
|
207
|
-
prompt: string
|
|
208
|
-
chat_format?: number
|
|
209
|
-
grammar?: string
|
|
210
|
-
grammar_lazy?: boolean
|
|
211
|
-
grammar_triggers?: Array<{
|
|
212
|
-
type: number
|
|
213
|
-
value: string
|
|
214
|
-
token: number
|
|
215
|
-
}>
|
|
216
|
-
preserved_tokens?: Array<string>
|
|
217
|
-
additional_stops?: Array<string>
|
|
218
|
-
}
|
|
219
|
-
|
|
220
|
-
export interface Spec extends TurboModule {
|
|
221
|
-
toggleNativeLog(enabled: boolean): Promise<void>
|
|
222
|
-
setContextLimit(limit: number): Promise<void>
|
|
223
|
-
modelInfo(path: string, skip?: string[]): Promise<Object>
|
|
224
|
-
initContext(
|
|
225
|
-
contextId: number,
|
|
226
|
-
params: NativeContextParams,
|
|
227
|
-
): Promise<NativeLlamaContext>
|
|
228
|
-
getFormattedChat(
|
|
229
|
-
contextId: number,
|
|
230
|
-
messages: string,
|
|
231
|
-
chatTemplate?: string,
|
|
232
|
-
params?: {
|
|
233
|
-
jinja?: boolean
|
|
234
|
-
json_schema?: string
|
|
235
|
-
tools?: string
|
|
236
|
-
parallel_tool_calls?: string
|
|
237
|
-
tool_choice?: string
|
|
238
|
-
},
|
|
239
|
-
): Promise<JinjaFormattedChatResult | string>
|
|
240
|
-
loadSession(
|
|
241
|
-
contextId: number,
|
|
242
|
-
filepath: string,
|
|
243
|
-
): Promise<NativeSessionLoadResult>
|
|
244
|
-
saveSession(
|
|
245
|
-
contextId: number,
|
|
246
|
-
filepath: string,
|
|
247
|
-
size: number,
|
|
248
|
-
): Promise<number>
|
|
249
|
-
completion(
|
|
250
|
-
contextId: number,
|
|
251
|
-
params: NativeCompletionParams,
|
|
252
|
-
): Promise<NativeCompletionResult>
|
|
253
|
-
multimodalCompletion(
|
|
254
|
-
contextId: number,
|
|
255
|
-
prompt: string,
|
|
256
|
-
mediaPaths: string[],
|
|
257
|
-
params: NativeCompletionParams,
|
|
258
|
-
): Promise<NativeCompletionResult>
|
|
259
|
-
stopCompletion(contextId: number): Promise<void>
|
|
260
|
-
tokenize(contextId: number, text: string, mediaPaths?: string[]): Promise<NativeTokenizeResult>
|
|
261
|
-
detokenize(contextId: number, tokens: number[]): Promise<string>
|
|
262
|
-
embedding(
|
|
263
|
-
contextId: number,
|
|
264
|
-
text: string,
|
|
265
|
-
params: NativeEmbeddingParams,
|
|
266
|
-
): Promise<NativeEmbeddingResult>
|
|
267
|
-
bench(
|
|
268
|
-
contextId: number,
|
|
269
|
-
pp: number,
|
|
270
|
-
tg: number,
|
|
271
|
-
pl: number,
|
|
272
|
-
nr: number,
|
|
273
|
-
): Promise<string>
|
|
274
|
-
applyLoraAdapters(
|
|
275
|
-
contextId: number,
|
|
276
|
-
loraAdapters: Array<{ path: string; scaled?: number }>,
|
|
277
|
-
): Promise<void>
|
|
278
|
-
removeLoraAdapters(contextId: number): Promise<void>
|
|
279
|
-
getLoadedLoraAdapters(
|
|
280
|
-
contextId: number,
|
|
281
|
-
): Promise<Array<{ path: string; scaled?: number }>>
|
|
282
|
-
initMultimodal(
|
|
283
|
-
contextId: number,
|
|
284
|
-
mmprojPath: string,
|
|
285
|
-
useGpu?: boolean,
|
|
286
|
-
): Promise<boolean>
|
|
287
|
-
isMultimodalEnabled(contextId: number): Promise<boolean>
|
|
288
|
-
isMultimodalSupportVision(contextId: number): Promise<boolean>
|
|
289
|
-
isMultimodalSupportAudio(contextId: number): Promise<boolean>
|
|
290
|
-
releaseMultimodal(contextId: number): Promise<void>
|
|
291
|
-
initVocoder(
|
|
292
|
-
contextId: number,
|
|
293
|
-
vocoderModelPath: string,
|
|
294
|
-
): Promise<boolean>
|
|
295
|
-
isVocoderEnabled(contextId: number): Promise<boolean>
|
|
296
|
-
getTTSType(contextId: number): Promise<NativeTTSType>
|
|
297
|
-
getFormattedAudioCompletion(
|
|
298
|
-
contextId: number,
|
|
299
|
-
speakerJsonStr: string,
|
|
300
|
-
textToSpeak: string,
|
|
301
|
-
): Promise<NativeAudioCompletionResult>
|
|
302
|
-
getAudioCompletionGuideTokens(
|
|
303
|
-
contextId: number,
|
|
304
|
-
textToSpeak: string,
|
|
305
|
-
): Promise<NativeAudioTokensResult>
|
|
306
|
-
decodeAudioTokens(
|
|
307
|
-
contextId: number,
|
|
308
|
-
tokens: number[],
|
|
309
|
-
): Promise<NativeAudioDecodeResult>
|
|
310
|
-
getDeviceInfo(contextId: number): Promise<NativeDeviceInfo>
|
|
311
|
-
releaseVocoder(contextId: number): Promise<void>
|
|
312
|
-
rewind(contextId: number): Promise<void>
|
|
313
|
-
releaseContext(contextId: number): Promise<void>
|
|
314
|
-
releaseAllContexts(): Promise<void>
|
|
315
|
-
}
|
|
316
|
-
|
|
317
|
-
export default TurboModuleRegistry.get<Spec>('Cactus') as Spec
|
package/src/agent.ts
DELETED
|
@@ -1,112 +0,0 @@
|
|
|
1
|
-
import { CactusLM } from './lm'
|
|
2
|
-
|
|
3
|
-
import type {
|
|
4
|
-
ContextParams,
|
|
5
|
-
CompletionParams,
|
|
6
|
-
CactusOAICompatibleMessage,
|
|
7
|
-
NativeCompletionResult,
|
|
8
|
-
TokenData,
|
|
9
|
-
} from './index'
|
|
10
|
-
|
|
11
|
-
import { Tools } from './tools'
|
|
12
|
-
|
|
13
|
-
interface Parameter {
|
|
14
|
-
type: string
|
|
15
|
-
description: string
|
|
16
|
-
required?: boolean
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
interface CactusAgentReturn {
|
|
20
|
-
agent: CactusAgent | null
|
|
21
|
-
error: Error | null
|
|
22
|
-
lm: CactusAgent | null
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
export interface AgentCompletionParams extends CompletionParams {
|
|
26
|
-
tools?: Tools
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
export class CactusAgent extends CactusLM {
|
|
30
|
-
private tools!: Tools
|
|
31
|
-
|
|
32
|
-
static async init(
|
|
33
|
-
params: ContextParams,
|
|
34
|
-
onProgress?: (progress: number) => void,
|
|
35
|
-
cactusToken?: string,
|
|
36
|
-
retryOptions?: { maxRetries?: number; delayMs?: number },
|
|
37
|
-
): Promise<CactusAgentReturn> {
|
|
38
|
-
const result = await CactusLM.init(params, onProgress, cactusToken, retryOptions)
|
|
39
|
-
|
|
40
|
-
if (result.error || !result.lm) {
|
|
41
|
-
return { agent: null, error: result.error, lm: null }
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
const agent = Object.setPrototypeOf(result.lm, CactusAgent.prototype) as CactusAgent
|
|
45
|
-
agent.tools = new Tools()
|
|
46
|
-
return { agent, error: null, lm: agent }
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
addTool(
|
|
50
|
-
func: Function,
|
|
51
|
-
description: string,
|
|
52
|
-
parameters: { [key: string]: Parameter }
|
|
53
|
-
): Function {
|
|
54
|
-
return this.tools.add(func, description, parameters)
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
getTools(): Tools {
|
|
58
|
-
return this.tools
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
async completionWithTools(
|
|
62
|
-
messages: CactusOAICompatibleMessage[],
|
|
63
|
-
params: AgentCompletionParams = {},
|
|
64
|
-
callback?: (data: TokenData) => void,
|
|
65
|
-
recursionCount: number = 0,
|
|
66
|
-
recursionLimit: number = 3
|
|
67
|
-
): Promise<NativeCompletionResult> {
|
|
68
|
-
const tools = params.tools || this.tools
|
|
69
|
-
|
|
70
|
-
if (!messages?.length) {
|
|
71
|
-
return this.completion([], params, callback)
|
|
72
|
-
}
|
|
73
|
-
if (!tools || tools.getSchemas().length === 0) {
|
|
74
|
-
return this.completion(messages, params, callback)
|
|
75
|
-
}
|
|
76
|
-
if (recursionCount >= recursionLimit) {
|
|
77
|
-
return this.completion(messages, {
|
|
78
|
-
...params,
|
|
79
|
-
jinja: true,
|
|
80
|
-
tools: tools.getSchemas()
|
|
81
|
-
}, callback)
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
const { newMessages, requiresReset } =
|
|
85
|
-
this.conversationHistoryManager.processNewMessages(messages)
|
|
86
|
-
|
|
87
|
-
if (requiresReset) {
|
|
88
|
-
this.context?.rewind()
|
|
89
|
-
this.conversationHistoryManager.reset()
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
const result = await this.context.completionWithTools({
|
|
93
|
-
...params,
|
|
94
|
-
messages: newMessages.length > 0 ? newMessages : messages,
|
|
95
|
-
tools: tools
|
|
96
|
-
}, callback, recursionCount, recursionLimit)
|
|
97
|
-
|
|
98
|
-
this.conversationHistoryManager.update(
|
|
99
|
-
newMessages.length > 0 ? newMessages : messages,
|
|
100
|
-
{
|
|
101
|
-
role: 'assistant',
|
|
102
|
-
content: result.content,
|
|
103
|
-
tool_calls: result.tool_calls
|
|
104
|
-
}
|
|
105
|
-
)
|
|
106
|
-
|
|
107
|
-
return result
|
|
108
|
-
}
|
|
109
|
-
isJinjaSupported(): boolean {
|
|
110
|
-
return this.context.isJinjaSupported();
|
|
111
|
-
}
|
|
112
|
-
}
|
package/src/chat.ts
DELETED
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
import type { NativeLlamaChatMessage } from './NativeCactus'
|
|
2
|
-
|
|
3
|
-
export type CactusMessagePart = {
|
|
4
|
-
text?: string
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
export type CactusOAICompatibleMessage = {
|
|
8
|
-
role: string
|
|
9
|
-
content?: string | CactusMessagePart[] | any
|
|
10
|
-
tool_calls?: any[]
|
|
11
|
-
tool_call_id?: string
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
export function formatChat(
|
|
15
|
-
messages: CactusOAICompatibleMessage[],
|
|
16
|
-
): NativeLlamaChatMessage[] {
|
|
17
|
-
const chat: NativeLlamaChatMessage[] = []
|
|
18
|
-
|
|
19
|
-
messages.forEach((currMsg) => {
|
|
20
|
-
const role: string = currMsg.role || ''
|
|
21
|
-
|
|
22
|
-
let content: string = ''
|
|
23
|
-
if ('content' in currMsg) {
|
|
24
|
-
if (typeof currMsg.content === 'string') {
|
|
25
|
-
;({ content } = currMsg)
|
|
26
|
-
} else if (Array.isArray(currMsg.content)) {
|
|
27
|
-
currMsg.content.forEach((part) => {
|
|
28
|
-
if ('text' in part) {
|
|
29
|
-
content += `${content ? '\n' : ''}${part.text}`
|
|
30
|
-
}
|
|
31
|
-
})
|
|
32
|
-
} else {
|
|
33
|
-
throw new TypeError(
|
|
34
|
-
"Invalid 'content' type (ref: https://github.com/ggerganov/llama.cpp/issues/8367)",
|
|
35
|
-
)
|
|
36
|
-
}
|
|
37
|
-
} else {
|
|
38
|
-
throw new Error(
|
|
39
|
-
"Missing 'content' (ref: https://github.com/ggerganov/llama.cpp/issues/8367)",
|
|
40
|
-
)
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
chat.push({ role, content })
|
|
44
|
-
})
|
|
45
|
-
return chat
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
export interface ProcessedMessages {
|
|
49
|
-
newMessages: CactusOAICompatibleMessage[];
|
|
50
|
-
requiresReset: boolean;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
export class ConversationHistoryManager {
|
|
54
|
-
private history: CactusOAICompatibleMessage[] = [];
|
|
55
|
-
|
|
56
|
-
public processNewMessages(
|
|
57
|
-
fullMessageHistory: CactusOAICompatibleMessage[]
|
|
58
|
-
): ProcessedMessages {
|
|
59
|
-
let divergent = fullMessageHistory.length < this.history.length;
|
|
60
|
-
if (!divergent) {
|
|
61
|
-
for (let i = 0; i < this.history.length; i++) {
|
|
62
|
-
if (JSON.stringify(this.history[i]) !== JSON.stringify(fullMessageHistory[i])) {
|
|
63
|
-
divergent = true;
|
|
64
|
-
break;
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
if (divergent) {
|
|
70
|
-
return { newMessages: fullMessageHistory, requiresReset: true };
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
const newMessages = fullMessageHistory.slice(this.history.length);
|
|
74
|
-
return { newMessages, requiresReset: false };
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
public update(
|
|
78
|
-
newMessages: CactusOAICompatibleMessage[],
|
|
79
|
-
assistantResponse: CactusOAICompatibleMessage
|
|
80
|
-
) {
|
|
81
|
-
this.history.push(...newMessages, assistantResponse);
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
public reset() {
|
|
85
|
-
this.history = [];
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
public getMessages(): CactusOAICompatibleMessage[] {
|
|
89
|
-
return this.history;
|
|
90
|
-
}
|
|
91
|
-
}
|