cactus-react-native 1.5.0 → 1.10.0
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 +1 -1
- package/README.md +347 -241
- package/android/CMakeLists.txt +24 -5
- package/android/src/main/jniLibs/arm64-v8a/libcactus.a +0 -0
- package/android/src/main/jniLibs/arm64-v8a/libcurl.a +0 -0
- package/android/src/main/jniLibs/arm64-v8a/libmbedcrypto.a +0 -0
- package/android/src/main/jniLibs/arm64-v8a/libmbedtls.a +0 -0
- package/android/src/main/jniLibs/arm64-v8a/libmbedx509.a +0 -0
- package/cpp/HybridCactus.cpp +197 -117
- package/cpp/HybridCactus.hpp +18 -9
- package/cpp/cactus_ffi.h +66 -42
- package/ios/cactus.xcframework/ios-arm64/cactus.framework/Headers/cactus.h +0 -1
- package/ios/cactus.xcframework/ios-arm64/cactus.framework/Headers/cactus_cloud.h +48 -0
- package/ios/cactus.xcframework/ios-arm64/cactus.framework/Headers/cactus_ffi.h +66 -42
- package/ios/cactus.xcframework/ios-arm64/cactus.framework/Headers/cactus_utils.h +568 -135
- package/ios/cactus.xcframework/ios-arm64/cactus.framework/Headers/engine.h +148 -17
- package/ios/cactus.xcframework/ios-arm64/cactus.framework/Headers/graph.h +145 -36
- package/ios/cactus.xcframework/ios-arm64/cactus.framework/Headers/kernel.h +187 -6
- package/ios/cactus.xcframework/ios-arm64/cactus.framework/Headers/kernel_utils.h +49 -149
- 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 +0 -1
- package/ios/cactus.xcframework/ios-arm64-simulator/cactus.framework/Headers/cactus_cloud.h +48 -0
- package/ios/cactus.xcframework/ios-arm64-simulator/cactus.framework/Headers/cactus_ffi.h +66 -42
- package/ios/cactus.xcframework/ios-arm64-simulator/cactus.framework/Headers/cactus_utils.h +568 -135
- package/ios/cactus.xcframework/ios-arm64-simulator/cactus.framework/Headers/engine.h +148 -17
- package/ios/cactus.xcframework/ios-arm64-simulator/cactus.framework/Headers/graph.h +145 -36
- package/ios/cactus.xcframework/ios-arm64-simulator/cactus.framework/Headers/kernel.h +187 -6
- package/ios/cactus.xcframework/ios-arm64-simulator/cactus.framework/Headers/kernel_utils.h +49 -149
- package/ios/cactus.xcframework/ios-arm64-simulator/cactus.framework/Info.plist +0 -0
- package/ios/cactus.xcframework/ios-arm64-simulator/cactus.framework/_CodeSignature/CodeResources +1 -1
- package/ios/cactus.xcframework/ios-arm64-simulator/cactus.framework/cactus +0 -0
- package/lib/module/classes/CactusLM.js +16 -49
- package/lib/module/classes/CactusLM.js.map +1 -1
- package/lib/module/classes/CactusSTT.js +41 -75
- package/lib/module/classes/CactusSTT.js.map +1 -1
- package/lib/module/classes/CactusVAD.js +95 -0
- package/lib/module/classes/CactusVAD.js.map +1 -0
- package/lib/module/hooks/useCactusLM.js +10 -11
- package/lib/module/hooks/useCactusLM.js.map +1 -1
- package/lib/module/hooks/useCactusSTT.js +23 -62
- package/lib/module/hooks/useCactusSTT.js.map +1 -1
- package/lib/module/hooks/useCactusVAD.js +171 -0
- package/lib/module/hooks/useCactusVAD.js.map +1 -0
- package/lib/module/index.js +2 -3
- package/lib/module/index.js.map +1 -1
- package/lib/module/modelRegistry.js +52 -0
- package/lib/module/modelRegistry.js.map +1 -0
- package/lib/module/native/Cactus.js +103 -23
- package/lib/module/native/Cactus.js.map +1 -1
- package/lib/module/native/CactusIndex.js.map +1 -1
- package/lib/module/native/index.js +0 -3
- package/lib/module/native/index.js.map +1 -1
- package/lib/module/types/CactusVAD.js +4 -0
- package/lib/module/{specs/CactusUtil.nitro.js.map → types/CactusVAD.js.map} +1 -1
- package/lib/typescript/src/classes/CactusLM.d.ts +5 -7
- package/lib/typescript/src/classes/CactusLM.d.ts.map +1 -1
- package/lib/typescript/src/classes/CactusSTT.d.ts +9 -12
- package/lib/typescript/src/classes/CactusSTT.d.ts.map +1 -1
- package/lib/typescript/src/classes/CactusVAD.d.ts +20 -0
- package/lib/typescript/src/classes/CactusVAD.d.ts.map +1 -0
- package/lib/typescript/src/hooks/useCactusLM.d.ts +2 -2
- package/lib/typescript/src/hooks/useCactusLM.d.ts.map +1 -1
- package/lib/typescript/src/hooks/useCactusSTT.d.ts +6 -8
- package/lib/typescript/src/hooks/useCactusSTT.d.ts.map +1 -1
- package/lib/typescript/src/hooks/useCactusVAD.d.ts +15 -0
- package/lib/typescript/src/hooks/useCactusVAD.d.ts.map +1 -0
- package/lib/typescript/src/index.d.ts +7 -5
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/modelRegistry.d.ts +5 -0
- package/lib/typescript/src/modelRegistry.d.ts.map +1 -0
- package/lib/typescript/src/native/Cactus.d.ts +13 -11
- package/lib/typescript/src/native/Cactus.d.ts.map +1 -1
- package/lib/typescript/src/native/CactusIndex.d.ts +2 -2
- package/lib/typescript/src/native/CactusIndex.d.ts.map +1 -1
- package/lib/typescript/src/native/index.d.ts +0 -3
- package/lib/typescript/src/native/index.d.ts.map +1 -1
- package/lib/typescript/src/specs/Cactus.nitro.d.ts +7 -6
- package/lib/typescript/src/specs/Cactus.nitro.d.ts.map +1 -1
- package/lib/typescript/src/types/CactusIndex.d.ts +2 -2
- package/lib/typescript/src/types/CactusIndex.d.ts.map +1 -1
- package/lib/typescript/src/types/CactusLM.d.ts +19 -11
- package/lib/typescript/src/types/CactusLM.d.ts.map +1 -1
- package/lib/typescript/src/types/CactusSTT.d.ts +44 -12
- package/lib/typescript/src/types/CactusSTT.d.ts.map +1 -1
- package/lib/typescript/src/types/CactusVAD.d.ts +34 -0
- package/lib/typescript/src/types/CactusVAD.d.ts.map +1 -0
- package/lib/typescript/src/types/common.d.ts +1 -6
- package/lib/typescript/src/types/common.d.ts.map +1 -1
- package/nitro.json +0 -11
- package/nitrogen/generated/android/cactus+autolinking.cmake +0 -5
- package/nitrogen/generated/android/cactusOnLoad.cpp +0 -30
- package/nitrogen/generated/ios/Cactus-Swift-Cxx-Bridge.cpp +0 -50
- package/nitrogen/generated/ios/Cactus-Swift-Cxx-Bridge.hpp +9 -147
- package/nitrogen/generated/ios/Cactus-Swift-Cxx-Umbrella.hpp +0 -13
- package/nitrogen/generated/ios/CactusAutolinking.mm +0 -26
- package/nitrogen/generated/ios/CactusAutolinking.swift +0 -30
- package/nitrogen/generated/shared/c++/HybridCactusSpec.cpp +5 -4
- package/nitrogen/generated/shared/c++/HybridCactusSpec.hpp +7 -6
- package/package.json +3 -3
- package/src/classes/CactusLM.ts +18 -65
- package/src/classes/CactusSTT.ts +52 -90
- package/src/classes/CactusVAD.ts +129 -0
- package/src/hooks/useCactusLM.ts +14 -17
- package/src/hooks/useCactusSTT.ts +47 -98
- package/src/hooks/useCactusVAD.ts +215 -0
- package/src/index.tsx +21 -12
- package/src/modelRegistry.ts +65 -0
- package/src/native/Cactus.ts +131 -38
- package/src/native/CactusIndex.ts +2 -2
- package/src/native/index.ts +0 -3
- package/src/specs/Cactus.nitro.ts +16 -7
- package/src/types/CactusIndex.ts +2 -2
- package/src/types/CactusLM.ts +19 -11
- package/src/types/CactusSTT.ts +47 -13
- package/src/types/CactusVAD.ts +39 -0
- package/src/types/common.ts +1 -6
- package/android/src/main/java/com/margelo/nitro/cactus/HybridCactusCrypto.kt +0 -46
- package/android/src/main/java/com/margelo/nitro/cactus/HybridCactusDeviceInfo.kt +0 -27
- package/android/src/main/jniLibs/arm64-v8a/libcactus_util.a +0 -0
- package/cpp/HybridCactusUtil.cpp +0 -47
- package/cpp/HybridCactusUtil.hpp +0 -27
- package/cpp/cactus_util.h +0 -25
- package/ios/HybridCactusCrypto.swift +0 -37
- package/ios/HybridCactusDeviceInfo.swift +0 -32
- package/ios/cactus.xcframework/ios-arm64/cactus.framework/Headers/cactus_telemetry.h +0 -656
- package/ios/cactus.xcframework/ios-arm64-simulator/cactus.framework/Headers/cactus_telemetry.h +0 -656
- package/ios/cactus_util.xcframework/Info.plist +0 -39
- package/ios/cactus_util.xcframework/ios-arm64/cactus_util.framework/Headers/cactus_util.h +0 -25
- package/ios/cactus_util.xcframework/ios-arm64/cactus_util.framework/Headers/database.h +0 -27
- package/ios/cactus_util.xcframework/ios-arm64/cactus_util.framework/Headers/ios_utils.h +0 -10
- package/ios/cactus_util.xcframework/ios-arm64/cactus_util.framework/Headers/logging.h +0 -25
- 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 +0 -25
- package/ios/cactus_util.xcframework/ios-arm64-simulator/cactus_util.framework/Headers/database.h +0 -27
- package/ios/cactus_util.xcframework/ios-arm64-simulator/cactus_util.framework/Headers/ios_utils.h +0 -10
- package/ios/cactus_util.xcframework/ios-arm64-simulator/cactus_util.framework/Headers/logging.h +0 -25
- package/ios/cactus_util.xcframework/ios-arm64-simulator/cactus_util.framework/Info.plist +0 -0
- package/ios/cactus_util.xcframework/ios-arm64-simulator/cactus_util.framework/_CodeSignature/CodeResources +0 -135
- package/ios/cactus_util.xcframework/ios-arm64-simulator/cactus_util.framework/cactus_util +0 -0
- package/lib/module/api/Database.js +0 -45
- package/lib/module/api/Database.js.map +0 -1
- package/lib/module/api/RemoteLM.js +0 -201
- package/lib/module/api/RemoteLM.js.map +0 -1
- package/lib/module/config/CactusConfig.js +0 -12
- package/lib/module/config/CactusConfig.js.map +0 -1
- package/lib/module/models.js +0 -336
- package/lib/module/models.js.map +0 -1
- package/lib/module/native/CactusCrypto.js +0 -10
- package/lib/module/native/CactusCrypto.js.map +0 -1
- package/lib/module/native/CactusDeviceInfo.js +0 -13
- package/lib/module/native/CactusDeviceInfo.js.map +0 -1
- package/lib/module/native/CactusUtil.js +0 -36
- package/lib/module/native/CactusUtil.js.map +0 -1
- package/lib/module/specs/CactusCrypto.nitro.js +0 -4
- package/lib/module/specs/CactusCrypto.nitro.js.map +0 -1
- package/lib/module/specs/CactusDeviceInfo.nitro.js +0 -4
- package/lib/module/specs/CactusDeviceInfo.nitro.js.map +0 -1
- package/lib/module/specs/CactusUtil.nitro.js +0 -4
- package/lib/module/telemetry/Telemetry.js +0 -154
- package/lib/module/telemetry/Telemetry.js.map +0 -1
- package/lib/typescript/src/api/Database.d.ts +0 -12
- package/lib/typescript/src/api/Database.d.ts.map +0 -1
- package/lib/typescript/src/api/RemoteLM.d.ts +0 -14
- package/lib/typescript/src/api/RemoteLM.d.ts.map +0 -1
- package/lib/typescript/src/config/CactusConfig.d.ts +0 -7
- package/lib/typescript/src/config/CactusConfig.d.ts.map +0 -1
- package/lib/typescript/src/models.d.ts +0 -6
- package/lib/typescript/src/models.d.ts.map +0 -1
- package/lib/typescript/src/native/CactusCrypto.d.ts +0 -5
- package/lib/typescript/src/native/CactusCrypto.d.ts.map +0 -1
- package/lib/typescript/src/native/CactusDeviceInfo.d.ts +0 -7
- package/lib/typescript/src/native/CactusDeviceInfo.d.ts.map +0 -1
- package/lib/typescript/src/native/CactusUtil.d.ts +0 -6
- package/lib/typescript/src/native/CactusUtil.d.ts.map +0 -1
- package/lib/typescript/src/specs/CactusCrypto.nitro.d.ts +0 -8
- package/lib/typescript/src/specs/CactusCrypto.nitro.d.ts.map +0 -1
- package/lib/typescript/src/specs/CactusDeviceInfo.nitro.d.ts +0 -16
- package/lib/typescript/src/specs/CactusDeviceInfo.nitro.d.ts.map +0 -1
- package/lib/typescript/src/specs/CactusUtil.nitro.d.ts +0 -10
- package/lib/typescript/src/specs/CactusUtil.nitro.d.ts.map +0 -1
- package/lib/typescript/src/telemetry/Telemetry.d.ts +0 -34
- package/lib/typescript/src/telemetry/Telemetry.d.ts.map +0 -1
- package/nitrogen/generated/android/c++/JDeviceInfo.hpp +0 -74
- package/nitrogen/generated/android/c++/JHybridCactusCryptoSpec.cpp +0 -65
- package/nitrogen/generated/android/c++/JHybridCactusCryptoSpec.hpp +0 -65
- package/nitrogen/generated/android/c++/JHybridCactusDeviceInfoSpec.cpp +0 -85
- package/nitrogen/generated/android/c++/JHybridCactusDeviceInfoSpec.hpp +0 -66
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/cactus/DeviceInfo.kt +0 -50
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/cactus/HybridCactusCryptoSpec.kt +0 -58
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/cactus/HybridCactusDeviceInfoSpec.kt +0 -62
- package/nitrogen/generated/ios/c++/HybridCactusCryptoSpecSwift.cpp +0 -11
- package/nitrogen/generated/ios/c++/HybridCactusCryptoSpecSwift.hpp +0 -77
- package/nitrogen/generated/ios/c++/HybridCactusDeviceInfoSpecSwift.cpp +0 -11
- package/nitrogen/generated/ios/c++/HybridCactusDeviceInfoSpecSwift.hpp +0 -88
- package/nitrogen/generated/ios/swift/DeviceInfo.swift +0 -98
- package/nitrogen/generated/ios/swift/Func_void_DeviceInfo.swift +0 -47
- package/nitrogen/generated/ios/swift/Func_void_std__optional_std__string_.swift +0 -54
- package/nitrogen/generated/ios/swift/HybridCactusCryptoSpec.swift +0 -57
- package/nitrogen/generated/ios/swift/HybridCactusCryptoSpec_cxx.swift +0 -139
- package/nitrogen/generated/ios/swift/HybridCactusDeviceInfoSpec.swift +0 -58
- package/nitrogen/generated/ios/swift/HybridCactusDeviceInfoSpec_cxx.swift +0 -164
- package/nitrogen/generated/shared/c++/DeviceInfo.hpp +0 -92
- package/nitrogen/generated/shared/c++/HybridCactusCryptoSpec.cpp +0 -21
- package/nitrogen/generated/shared/c++/HybridCactusCryptoSpec.hpp +0 -63
- package/nitrogen/generated/shared/c++/HybridCactusDeviceInfoSpec.cpp +0 -22
- package/nitrogen/generated/shared/c++/HybridCactusDeviceInfoSpec.hpp +0 -67
- package/nitrogen/generated/shared/c++/HybridCactusUtilSpec.cpp +0 -23
- package/nitrogen/generated/shared/c++/HybridCactusUtilSpec.hpp +0 -66
- package/src/api/Database.ts +0 -55
- package/src/api/RemoteLM.ts +0 -273
- package/src/config/CactusConfig.ts +0 -11
- package/src/models.ts +0 -344
- package/src/native/CactusCrypto.ts +0 -11
- package/src/native/CactusDeviceInfo.ts +0 -18
- package/src/native/CactusUtil.ts +0 -43
- package/src/specs/CactusCrypto.nitro.ts +0 -6
- package/src/specs/CactusDeviceInfo.nitro.ts +0 -15
- package/src/specs/CactusUtil.nitro.ts +0 -8
- package/src/telemetry/Telemetry.ts +0 -236
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
#ifndef cactus_util_H
|
|
2
|
-
#define cactus_util_H
|
|
3
|
-
|
|
4
|
-
#ifdef __cplusplus
|
|
5
|
-
extern "C" {
|
|
6
|
-
#endif
|
|
7
|
-
|
|
8
|
-
const char* register_app(const char* encrypted_data);
|
|
9
|
-
|
|
10
|
-
const char* get_device_id(const char* current_token);
|
|
11
|
-
|
|
12
|
-
// Helper function to free memory allocated by register_app
|
|
13
|
-
void free_string(const char* str);
|
|
14
|
-
|
|
15
|
-
#ifdef __ANDROID__
|
|
16
|
-
// Function to set the Android app data directory
|
|
17
|
-
// This should be called from Flutter/Java side before any other functions
|
|
18
|
-
void set_android_data_directory(const char* data_dir);
|
|
19
|
-
#endif
|
|
20
|
-
|
|
21
|
-
#ifdef __cplusplus
|
|
22
|
-
}
|
|
23
|
-
#endif
|
|
24
|
-
|
|
25
|
-
#endif
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
#ifndef DATABASE_H
|
|
2
|
-
#define DATABASE_H
|
|
3
|
-
|
|
4
|
-
#include <string>
|
|
5
|
-
struct sqlite3;
|
|
6
|
-
|
|
7
|
-
class Database {
|
|
8
|
-
private:
|
|
9
|
-
sqlite3* db;
|
|
10
|
-
std::string db_path;
|
|
11
|
-
|
|
12
|
-
bool create_tables();
|
|
13
|
-
|
|
14
|
-
public:
|
|
15
|
-
Database(const std::string& path = "cactus.db");
|
|
16
|
-
~Database();
|
|
17
|
-
|
|
18
|
-
bool initialize();
|
|
19
|
-
bool register_app(const std::string& device_id, const std::string& token_expiry_date, const std::string& token);
|
|
20
|
-
bool get_registration(std::string& device_id, std::string& token_expiry_date, std::string& token);
|
|
21
|
-
const char* get_device_id();
|
|
22
|
-
void close();
|
|
23
|
-
|
|
24
|
-
bool is_open() const;
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
-
#endif // DATABASE_H
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
#ifndef LOGGING_H
|
|
2
|
-
#define LOGGING_H
|
|
3
|
-
|
|
4
|
-
#include <string>
|
|
5
|
-
|
|
6
|
-
// Log levels
|
|
7
|
-
enum LogLevel {
|
|
8
|
-
LOG_DEBUG = 0,
|
|
9
|
-
LOG_INFO = 1,
|
|
10
|
-
LOG_WARNING = 2,
|
|
11
|
-
LOG_ERROR = 3
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
// Cross-platform logging function
|
|
15
|
-
void cactus_log(LogLevel level, const char* tag, const char* message);
|
|
16
|
-
void cactus_log(LogLevel level, const char* tag, const std::string& message);
|
|
17
|
-
|
|
18
|
-
// Convenience macros
|
|
19
|
-
#define LOG_TAG "CactusUtil"
|
|
20
|
-
#define CACTUS_LOG_DEBUG(msg) cactus_log(LOG_DEBUG, LOG_TAG, msg)
|
|
21
|
-
#define CACTUS_LOG_INFO(msg) cactus_log(LOG_INFO, LOG_TAG, msg)
|
|
22
|
-
#define CACTUS_LOG_WARNING(msg) cactus_log(LOG_WARNING, LOG_TAG, msg)
|
|
23
|
-
#define CACTUS_LOG_ERROR(msg) cactus_log(LOG_ERROR, LOG_TAG, msg)
|
|
24
|
-
|
|
25
|
-
#endif
|
|
Binary file
|
|
Binary file
|
package/ios/cactus_util.xcframework/ios-arm64-simulator/cactus_util.framework/Headers/cactus_util.h
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
#ifndef cactus_util_H
|
|
2
|
-
#define cactus_util_H
|
|
3
|
-
|
|
4
|
-
#ifdef __cplusplus
|
|
5
|
-
extern "C" {
|
|
6
|
-
#endif
|
|
7
|
-
|
|
8
|
-
const char* register_app(const char* encrypted_data);
|
|
9
|
-
|
|
10
|
-
const char* get_device_id(const char* current_token);
|
|
11
|
-
|
|
12
|
-
// Helper function to free memory allocated by register_app
|
|
13
|
-
void free_string(const char* str);
|
|
14
|
-
|
|
15
|
-
#ifdef __ANDROID__
|
|
16
|
-
// Function to set the Android app data directory
|
|
17
|
-
// This should be called from Flutter/Java side before any other functions
|
|
18
|
-
void set_android_data_directory(const char* data_dir);
|
|
19
|
-
#endif
|
|
20
|
-
|
|
21
|
-
#ifdef __cplusplus
|
|
22
|
-
}
|
|
23
|
-
#endif
|
|
24
|
-
|
|
25
|
-
#endif
|
package/ios/cactus_util.xcframework/ios-arm64-simulator/cactus_util.framework/Headers/database.h
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
#ifndef DATABASE_H
|
|
2
|
-
#define DATABASE_H
|
|
3
|
-
|
|
4
|
-
#include <string>
|
|
5
|
-
struct sqlite3;
|
|
6
|
-
|
|
7
|
-
class Database {
|
|
8
|
-
private:
|
|
9
|
-
sqlite3* db;
|
|
10
|
-
std::string db_path;
|
|
11
|
-
|
|
12
|
-
bool create_tables();
|
|
13
|
-
|
|
14
|
-
public:
|
|
15
|
-
Database(const std::string& path = "cactus.db");
|
|
16
|
-
~Database();
|
|
17
|
-
|
|
18
|
-
bool initialize();
|
|
19
|
-
bool register_app(const std::string& device_id, const std::string& token_expiry_date, const std::string& token);
|
|
20
|
-
bool get_registration(std::string& device_id, std::string& token_expiry_date, std::string& token);
|
|
21
|
-
const char* get_device_id();
|
|
22
|
-
void close();
|
|
23
|
-
|
|
24
|
-
bool is_open() const;
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
-
#endif // DATABASE_H
|
package/ios/cactus_util.xcframework/ios-arm64-simulator/cactus_util.framework/Headers/logging.h
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
#ifndef LOGGING_H
|
|
2
|
-
#define LOGGING_H
|
|
3
|
-
|
|
4
|
-
#include <string>
|
|
5
|
-
|
|
6
|
-
// Log levels
|
|
7
|
-
enum LogLevel {
|
|
8
|
-
LOG_DEBUG = 0,
|
|
9
|
-
LOG_INFO = 1,
|
|
10
|
-
LOG_WARNING = 2,
|
|
11
|
-
LOG_ERROR = 3
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
// Cross-platform logging function
|
|
15
|
-
void cactus_log(LogLevel level, const char* tag, const char* message);
|
|
16
|
-
void cactus_log(LogLevel level, const char* tag, const std::string& message);
|
|
17
|
-
|
|
18
|
-
// Convenience macros
|
|
19
|
-
#define LOG_TAG "CactusUtil"
|
|
20
|
-
#define CACTUS_LOG_DEBUG(msg) cactus_log(LOG_DEBUG, LOG_TAG, msg)
|
|
21
|
-
#define CACTUS_LOG_INFO(msg) cactus_log(LOG_INFO, LOG_TAG, msg)
|
|
22
|
-
#define CACTUS_LOG_WARNING(msg) cactus_log(LOG_WARNING, LOG_TAG, msg)
|
|
23
|
-
#define CACTUS_LOG_ERROR(msg) cactus_log(LOG_ERROR, LOG_TAG, msg)
|
|
24
|
-
|
|
25
|
-
#endif
|
|
Binary file
|
|
@@ -1,135 +0,0 @@
|
|
|
1
|
-
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
-
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
3
|
-
<plist version="1.0">
|
|
4
|
-
<dict>
|
|
5
|
-
<key>files</key>
|
|
6
|
-
<dict>
|
|
7
|
-
<key>Headers/cactus_util.h</key>
|
|
8
|
-
<data>
|
|
9
|
-
5lW8KZ3LQl0aqP6TUxyB+K0vcIE=
|
|
10
|
-
</data>
|
|
11
|
-
<key>Headers/ios_utils.h</key>
|
|
12
|
-
<data>
|
|
13
|
-
DxZ6AL6QIFsgYUKBGkaAndkY1Ew=
|
|
14
|
-
</data>
|
|
15
|
-
<key>Headers/logging.h</key>
|
|
16
|
-
<data>
|
|
17
|
-
m5MdwrQVZglUAv3NSffShqQTwqE=
|
|
18
|
-
</data>
|
|
19
|
-
<key>Info.plist</key>
|
|
20
|
-
<data>
|
|
21
|
-
gD92JC49Bf9W6pi0MZWov5LMRb4=
|
|
22
|
-
</data>
|
|
23
|
-
</dict>
|
|
24
|
-
<key>files2</key>
|
|
25
|
-
<dict>
|
|
26
|
-
<key>Headers/cactus_util.h</key>
|
|
27
|
-
<dict>
|
|
28
|
-
<key>hash2</key>
|
|
29
|
-
<data>
|
|
30
|
-
Q7DuJEU0UWHgQ8cVdAc50lq592AjV42gMHSiDHx4OQk=
|
|
31
|
-
</data>
|
|
32
|
-
</dict>
|
|
33
|
-
<key>Headers/ios_utils.h</key>
|
|
34
|
-
<dict>
|
|
35
|
-
<key>hash2</key>
|
|
36
|
-
<data>
|
|
37
|
-
edmm6ZYsnfjlwb1IJ40iJ7zwVnZZrO91p++TgoSO9ig=
|
|
38
|
-
</data>
|
|
39
|
-
</dict>
|
|
40
|
-
<key>Headers/logging.h</key>
|
|
41
|
-
<dict>
|
|
42
|
-
<key>hash2</key>
|
|
43
|
-
<data>
|
|
44
|
-
YpnrA639xaUs3HHamW6aBrNfc58sEqAIKKxdkgsn7Kk=
|
|
45
|
-
</data>
|
|
46
|
-
</dict>
|
|
47
|
-
</dict>
|
|
48
|
-
<key>rules</key>
|
|
49
|
-
<dict>
|
|
50
|
-
<key>^.*</key>
|
|
51
|
-
<true/>
|
|
52
|
-
<key>^.*\.lproj/</key>
|
|
53
|
-
<dict>
|
|
54
|
-
<key>optional</key>
|
|
55
|
-
<true/>
|
|
56
|
-
<key>weight</key>
|
|
57
|
-
<real>1000</real>
|
|
58
|
-
</dict>
|
|
59
|
-
<key>^.*\.lproj/locversion.plist$</key>
|
|
60
|
-
<dict>
|
|
61
|
-
<key>omit</key>
|
|
62
|
-
<true/>
|
|
63
|
-
<key>weight</key>
|
|
64
|
-
<real>1100</real>
|
|
65
|
-
</dict>
|
|
66
|
-
<key>^Base\.lproj/</key>
|
|
67
|
-
<dict>
|
|
68
|
-
<key>weight</key>
|
|
69
|
-
<real>1010</real>
|
|
70
|
-
</dict>
|
|
71
|
-
<key>^version.plist$</key>
|
|
72
|
-
<true/>
|
|
73
|
-
</dict>
|
|
74
|
-
<key>rules2</key>
|
|
75
|
-
<dict>
|
|
76
|
-
<key>.*\.dSYM($|/)</key>
|
|
77
|
-
<dict>
|
|
78
|
-
<key>weight</key>
|
|
79
|
-
<real>11</real>
|
|
80
|
-
</dict>
|
|
81
|
-
<key>^(.*/)?\.DS_Store$</key>
|
|
82
|
-
<dict>
|
|
83
|
-
<key>omit</key>
|
|
84
|
-
<true/>
|
|
85
|
-
<key>weight</key>
|
|
86
|
-
<real>2000</real>
|
|
87
|
-
</dict>
|
|
88
|
-
<key>^.*</key>
|
|
89
|
-
<true/>
|
|
90
|
-
<key>^.*\.lproj/</key>
|
|
91
|
-
<dict>
|
|
92
|
-
<key>optional</key>
|
|
93
|
-
<true/>
|
|
94
|
-
<key>weight</key>
|
|
95
|
-
<real>1000</real>
|
|
96
|
-
</dict>
|
|
97
|
-
<key>^.*\.lproj/locversion.plist$</key>
|
|
98
|
-
<dict>
|
|
99
|
-
<key>omit</key>
|
|
100
|
-
<true/>
|
|
101
|
-
<key>weight</key>
|
|
102
|
-
<real>1100</real>
|
|
103
|
-
</dict>
|
|
104
|
-
<key>^Base\.lproj/</key>
|
|
105
|
-
<dict>
|
|
106
|
-
<key>weight</key>
|
|
107
|
-
<real>1010</real>
|
|
108
|
-
</dict>
|
|
109
|
-
<key>^Info\.plist$</key>
|
|
110
|
-
<dict>
|
|
111
|
-
<key>omit</key>
|
|
112
|
-
<true/>
|
|
113
|
-
<key>weight</key>
|
|
114
|
-
<real>20</real>
|
|
115
|
-
</dict>
|
|
116
|
-
<key>^PkgInfo$</key>
|
|
117
|
-
<dict>
|
|
118
|
-
<key>omit</key>
|
|
119
|
-
<true/>
|
|
120
|
-
<key>weight</key>
|
|
121
|
-
<real>20</real>
|
|
122
|
-
</dict>
|
|
123
|
-
<key>^embedded\.provisionprofile$</key>
|
|
124
|
-
<dict>
|
|
125
|
-
<key>weight</key>
|
|
126
|
-
<real>20</real>
|
|
127
|
-
</dict>
|
|
128
|
-
<key>^version\.plist$</key>
|
|
129
|
-
<dict>
|
|
130
|
-
<key>weight</key>
|
|
131
|
-
<real>20</real>
|
|
132
|
-
</dict>
|
|
133
|
-
</dict>
|
|
134
|
-
</dict>
|
|
135
|
-
</plist>
|
|
Binary file
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
import { CactusUtil } from "../native/index.js";
|
|
4
|
-
import { CactusConfig } from "../config/CactusConfig.js";
|
|
5
|
-
export class Database {
|
|
6
|
-
static url = 'https://vlqqczxwyaodtcdmdmlw.supabase.co';
|
|
7
|
-
static key = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6InZscXFjenh3eWFvZHRjZG1kbWx3Iiwicm9sZSI6ImFub24iLCJpYXQiOjE3NTE1MTg2MzIsImV4cCI6MjA2NzA5NDYzMn0.nBzqGuK9j6RZ6mOPWU2boAC_5H9XDs-fPpo5P3WZYbI';
|
|
8
|
-
static async sendLogRecords(records) {
|
|
9
|
-
const response = await fetch(`${this.url}/rest/v1/logs`, {
|
|
10
|
-
method: 'POST',
|
|
11
|
-
headers: {
|
|
12
|
-
'apikey': this.key,
|
|
13
|
-
'Authorization': `Bearer ${this.key}`,
|
|
14
|
-
'Content-Type': 'application/json',
|
|
15
|
-
'Content-Profile': 'cactus',
|
|
16
|
-
'Prefer': 'return=minimal'
|
|
17
|
-
},
|
|
18
|
-
body: JSON.stringify(records)
|
|
19
|
-
});
|
|
20
|
-
if (!response.ok) {
|
|
21
|
-
throw new Error('Sending logs failed');
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
static async registerDevice({
|
|
25
|
-
deviceData,
|
|
26
|
-
deviceId
|
|
27
|
-
}) {
|
|
28
|
-
const response = await fetch(`${this.url}/functions/v1/device-registration`, {
|
|
29
|
-
method: 'POST',
|
|
30
|
-
body: JSON.stringify({
|
|
31
|
-
device_data: deviceData,
|
|
32
|
-
device_id: deviceId,
|
|
33
|
-
cactus_pro_key: CactusConfig.cactusProKey
|
|
34
|
-
}),
|
|
35
|
-
headers: {
|
|
36
|
-
'Content-Type': 'application/json'
|
|
37
|
-
}
|
|
38
|
-
});
|
|
39
|
-
if (!response.ok) {
|
|
40
|
-
throw new Error('Registering device failed');
|
|
41
|
-
}
|
|
42
|
-
return await CactusUtil.registerApp(await response.text());
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
//# sourceMappingURL=Database.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["CactusUtil","CactusConfig","Database","url","key","sendLogRecords","records","response","fetch","method","headers","body","JSON","stringify","ok","Error","registerDevice","deviceData","deviceId","device_data","device_id","cactus_pro_key","cactusProKey","registerApp","text"],"sourceRoot":"../../../src","sources":["api/Database.ts"],"mappings":";;AAAA,SAASA,UAAU,QAAQ,oBAAW;AAGtC,SAASC,YAAY,QAAQ,2BAAwB;AAErD,OAAO,MAAMC,QAAQ,CAAC;EACpB,OAAwBC,GAAG,GAAG,0CAA0C;EACxE,OAAwBC,GAAG,GACzB,kNAAkN;EAEpN,aAAoBC,cAAcA,CAACC,OAAoB,EAAiB;IACtE,MAAMC,QAAQ,GAAG,MAAMC,KAAK,CAAC,GAAG,IAAI,CAACL,GAAG,eAAe,EAAE;MACvDM,MAAM,EAAE,MAAM;MACdC,OAAO,EAAE;QACP,QAAQ,EAAE,IAAI,CAACN,GAAG;QAClB,eAAe,EAAE,UAAU,IAAI,CAACA,GAAG,EAAE;QACrC,cAAc,EAAE,kBAAkB;QAClC,iBAAiB,EAAE,QAAQ;QAC3B,QAAQ,EAAE;MACZ,CAAC;MACDO,IAAI,EAAEC,IAAI,CAACC,SAAS,CAACP,OAAO;IAC9B,CAAC,CAAC;IAEF,IAAI,CAACC,QAAQ,CAACO,EAAE,EAAE;MAChB,MAAM,IAAIC,KAAK,CAAC,qBAAqB,CAAC;IACxC;EACF;EAEA,aAAoBC,cAAcA,CAAC;IACjCC,UAAU;IACVC;EAIF,CAAC,EAAmB;IAClB,MAAMX,QAAQ,GAAG,MAAMC,KAAK,CAC1B,GAAG,IAAI,CAACL,GAAG,mCAAmC,EAC9C;MACEM,MAAM,EAAE,MAAM;MACdE,IAAI,EAAEC,IAAI,CAACC,SAAS,CAAC;QACnBM,WAAW,EAAEF,UAAU;QACvBG,SAAS,EAAEF,QAAQ;QACnBG,cAAc,EAAEpB,YAAY,CAACqB;MAC/B,CAAC,CAAC;MACFZ,OAAO,EAAE;QAAE,cAAc,EAAE;MAAmB;IAChD,CACF,CAAC;IAED,IAAI,CAACH,QAAQ,CAACO,EAAE,EAAE;MAChB,MAAM,IAAIC,KAAK,CAAC,2BAA2B,CAAC;IAC9C;IAEA,OAAO,MAAMf,UAAU,CAACuB,WAAW,CAAC,MAAMhB,QAAQ,CAACiB,IAAI,CAAC,CAAC,CAAC;EAC5D;AACF","ignoreList":[]}
|
|
@@ -1,201 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
import { CactusConfig } from "../config/CactusConfig.js";
|
|
4
|
-
import { CactusImage } from "../native/CactusImage.js";
|
|
5
|
-
export class RemoteLM {
|
|
6
|
-
static completionsUrl = 'https://openrouter.ai/api/v1/chat/completions';
|
|
7
|
-
static defaultModel = 'google/gemini-2.5-flash-lite';
|
|
8
|
-
static async complete(messages, options, tools, callback) {
|
|
9
|
-
if (!CactusConfig.cactusToken) {
|
|
10
|
-
throw new Error('cactusToken is required for hybrid completions');
|
|
11
|
-
}
|
|
12
|
-
const payload = JSON.stringify({
|
|
13
|
-
model: this.defaultModel,
|
|
14
|
-
messages: await this.transformMessages(messages),
|
|
15
|
-
tools,
|
|
16
|
-
temperature: options?.temperature,
|
|
17
|
-
top_p: options?.topP,
|
|
18
|
-
top_k: options?.topK,
|
|
19
|
-
max_tokens: options?.maxTokens,
|
|
20
|
-
stop: options?.stopSequences,
|
|
21
|
-
stream: !!callback
|
|
22
|
-
});
|
|
23
|
-
return callback ? await this.streamXHR(payload, callback) : await this.nonStreamFetch(payload);
|
|
24
|
-
}
|
|
25
|
-
static getMimeType(filePath) {
|
|
26
|
-
const extension = filePath.toLowerCase().split('.').pop();
|
|
27
|
-
switch (extension) {
|
|
28
|
-
case 'jpg':
|
|
29
|
-
case 'jpeg':
|
|
30
|
-
return 'image/jpeg';
|
|
31
|
-
case 'png':
|
|
32
|
-
return 'image/png';
|
|
33
|
-
case 'gif':
|
|
34
|
-
return 'image/gif';
|
|
35
|
-
case 'webp':
|
|
36
|
-
return 'image/webp';
|
|
37
|
-
default:
|
|
38
|
-
throw new Error(`Unsupported image format: .${extension}`);
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
static async transformMessages(messages) {
|
|
42
|
-
const transformedMessages = [];
|
|
43
|
-
for (const message of messages) {
|
|
44
|
-
const content = [];
|
|
45
|
-
if (message.content) {
|
|
46
|
-
content.push({
|
|
47
|
-
type: 'text',
|
|
48
|
-
text: message.content
|
|
49
|
-
});
|
|
50
|
-
}
|
|
51
|
-
if (message.images) {
|
|
52
|
-
for (const image of message.images) {
|
|
53
|
-
const imagePath = image.replace('file://', '');
|
|
54
|
-
const mimeType = this.getMimeType(imagePath);
|
|
55
|
-
const base64Data = await CactusImage.base64(imagePath);
|
|
56
|
-
content.push({
|
|
57
|
-
type: 'image_url',
|
|
58
|
-
image_url: {
|
|
59
|
-
url: `data:${mimeType};base64,${base64Data}`
|
|
60
|
-
}
|
|
61
|
-
});
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
transformedMessages.push({
|
|
65
|
-
role: message.role,
|
|
66
|
-
content
|
|
67
|
-
});
|
|
68
|
-
}
|
|
69
|
-
return transformedMessages;
|
|
70
|
-
}
|
|
71
|
-
static streamXHR(payload, callback) {
|
|
72
|
-
return new Promise((resolve, reject) => {
|
|
73
|
-
const xhr = new XMLHttpRequest();
|
|
74
|
-
xhr.timeout = 3 * 60 * 1000; // 3 minutes
|
|
75
|
-
xhr.ontimeout = () => reject(new Error('Remote streaming completion timed out'));
|
|
76
|
-
xhr.open('POST', this.completionsUrl);
|
|
77
|
-
xhr.setRequestHeader('Authorization', `Bearer ${CactusConfig.cactusToken}`);
|
|
78
|
-
xhr.setRequestHeader('HTTP-Referer', 'https://cactuscompute.com');
|
|
79
|
-
xhr.setRequestHeader('X-Title', 'Cactus React Native SDK');
|
|
80
|
-
xhr.setRequestHeader('Content-Type', 'application/json');
|
|
81
|
-
const startTime = performance.now();
|
|
82
|
-
let lastIndex = 0;
|
|
83
|
-
let buffer = '';
|
|
84
|
-
let response = '';
|
|
85
|
-
let toolCalls;
|
|
86
|
-
let timeToFirstTokenMs = 0;
|
|
87
|
-
let prefillTokens = 0;
|
|
88
|
-
let decodeTokens = 0;
|
|
89
|
-
let totalTokens = 0;
|
|
90
|
-
xhr.onprogress = () => {
|
|
91
|
-
const chunk = xhr.responseText.substring(lastIndex);
|
|
92
|
-
lastIndex = xhr.responseText.length;
|
|
93
|
-
buffer += chunk;
|
|
94
|
-
const lines = buffer.split('\n');
|
|
95
|
-
buffer = lines.pop() || '';
|
|
96
|
-
for (const line of lines) {
|
|
97
|
-
if (!line.startsWith('data: ')) {
|
|
98
|
-
continue;
|
|
99
|
-
}
|
|
100
|
-
const jsonStr = line.slice(6).trim();
|
|
101
|
-
if (jsonStr === '[DONE]') {
|
|
102
|
-
continue;
|
|
103
|
-
}
|
|
104
|
-
try {
|
|
105
|
-
const data = JSON.parse(jsonStr);
|
|
106
|
-
if (timeToFirstTokenMs === 0) {
|
|
107
|
-
timeToFirstTokenMs = performance.now() - startTime;
|
|
108
|
-
}
|
|
109
|
-
const toolCallChunks = data?.choices?.[0]?.delta?.tool_calls;
|
|
110
|
-
if (toolCallChunks) {
|
|
111
|
-
if (!toolCalls) {
|
|
112
|
-
toolCalls = [];
|
|
113
|
-
}
|
|
114
|
-
for (const toolCallChunk of toolCallChunks) {
|
|
115
|
-
const index = toolCallChunk.index;
|
|
116
|
-
if (!toolCalls[index]) {
|
|
117
|
-
toolCalls[index] = {
|
|
118
|
-
name: '',
|
|
119
|
-
arguments: ''
|
|
120
|
-
};
|
|
121
|
-
}
|
|
122
|
-
if (toolCallChunk.function?.name) {
|
|
123
|
-
toolCalls[index].name = toolCallChunk.function.name;
|
|
124
|
-
}
|
|
125
|
-
if (toolCallChunk.function?.arguments) {
|
|
126
|
-
toolCalls[index].arguments += toolCallChunk.function.arguments;
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
const content = data?.choices?.[0]?.delta?.content;
|
|
131
|
-
if (content) {
|
|
132
|
-
response += content;
|
|
133
|
-
callback(content);
|
|
134
|
-
}
|
|
135
|
-
if (data?.usage) {
|
|
136
|
-
prefillTokens = data.usage.prompt_tokens;
|
|
137
|
-
decodeTokens = data.usage.completion_tokens;
|
|
138
|
-
totalTokens = data.usage.total_tokens;
|
|
139
|
-
}
|
|
140
|
-
} catch {}
|
|
141
|
-
}
|
|
142
|
-
};
|
|
143
|
-
xhr.onload = () => {
|
|
144
|
-
const totalTimeMs = performance.now() - startTime;
|
|
145
|
-
const functionCalls = toolCalls?.map(toolCall => ({
|
|
146
|
-
name: toolCall.name,
|
|
147
|
-
arguments: JSON.parse(toolCall.arguments)
|
|
148
|
-
}));
|
|
149
|
-
resolve({
|
|
150
|
-
success: true,
|
|
151
|
-
response,
|
|
152
|
-
functionCalls,
|
|
153
|
-
timeToFirstTokenMs,
|
|
154
|
-
totalTimeMs,
|
|
155
|
-
tokensPerSecond: decodeTokens * 1000 / totalTimeMs,
|
|
156
|
-
prefillTokens,
|
|
157
|
-
decodeTokens,
|
|
158
|
-
totalTokens
|
|
159
|
-
});
|
|
160
|
-
};
|
|
161
|
-
xhr.onerror = () => reject(new Error('Remote streaming completion failed'));
|
|
162
|
-
xhr.send(payload);
|
|
163
|
-
});
|
|
164
|
-
}
|
|
165
|
-
static async nonStreamFetch(payload) {
|
|
166
|
-
const startTime = performance.now();
|
|
167
|
-
const request = await fetch(this.completionsUrl, {
|
|
168
|
-
method: 'POST',
|
|
169
|
-
headers: {
|
|
170
|
-
'Authorization': `Bearer ${CactusConfig.cactusToken}`,
|
|
171
|
-
'HTTP-Referer': 'https://cactuscompute.com',
|
|
172
|
-
'X-Title': 'Cactus React Native SDK',
|
|
173
|
-
'Content-Type': 'application/json'
|
|
174
|
-
},
|
|
175
|
-
body: payload
|
|
176
|
-
});
|
|
177
|
-
if (!request.ok) {
|
|
178
|
-
throw new Error('Remote completion failed');
|
|
179
|
-
}
|
|
180
|
-
const data = await request.json();
|
|
181
|
-
const totalTimeMs = performance.now() - startTime;
|
|
182
|
-
const decodeTokens = data.usage.completion_tokens;
|
|
183
|
-
const toolCalls = data.choices[0].message.tool_calls;
|
|
184
|
-
const functionCalls = toolCalls?.map(toolCall => ({
|
|
185
|
-
name: toolCall.function.name,
|
|
186
|
-
arguments: toolCall.function.arguments
|
|
187
|
-
}));
|
|
188
|
-
return {
|
|
189
|
-
success: true,
|
|
190
|
-
response: data.choices[0].message.content,
|
|
191
|
-
functionCalls,
|
|
192
|
-
timeToFirstTokenMs: totalTimeMs,
|
|
193
|
-
totalTimeMs,
|
|
194
|
-
tokensPerSecond: decodeTokens * 1000 / totalTimeMs,
|
|
195
|
-
prefillTokens: data.usage.prompt_tokens,
|
|
196
|
-
decodeTokens,
|
|
197
|
-
totalTokens: data.usage.total_tokens
|
|
198
|
-
};
|
|
199
|
-
}
|
|
200
|
-
}
|
|
201
|
-
//# sourceMappingURL=RemoteLM.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["CactusConfig","CactusImage","RemoteLM","completionsUrl","defaultModel","complete","messages","options","tools","callback","cactusToken","Error","payload","JSON","stringify","model","transformMessages","temperature","top_p","topP","top_k","topK","max_tokens","maxTokens","stop","stopSequences","stream","streamXHR","nonStreamFetch","getMimeType","filePath","extension","toLowerCase","split","pop","transformedMessages","message","content","push","type","text","images","image","imagePath","replace","mimeType","base64Data","base64","image_url","url","role","Promise","resolve","reject","xhr","XMLHttpRequest","timeout","ontimeout","open","setRequestHeader","startTime","performance","now","lastIndex","buffer","response","toolCalls","timeToFirstTokenMs","prefillTokens","decodeTokens","totalTokens","onprogress","chunk","responseText","substring","length","lines","line","startsWith","jsonStr","slice","trim","data","parse","toolCallChunks","choices","delta","tool_calls","toolCallChunk","index","name","arguments","function","usage","prompt_tokens","completion_tokens","total_tokens","onload","totalTimeMs","functionCalls","map","toolCall","success","tokensPerSecond","onerror","send","request","fetch","method","headers","body","ok","json"],"sourceRoot":"../../../src","sources":["api/RemoteLM.ts"],"mappings":";;AAAA,SAASA,YAAY,QAAQ,2BAAwB;AACrD,SAASC,WAAW,QAAQ,0BAAuB;AAQnD,OAAO,MAAMC,QAAQ,CAAC;EACpB,OAAwBC,cAAc,GACpC,+CAA+C;EAEjD,OAAwBC,YAAY,GAAG,8BAA8B;EAErE,aAAoBC,QAAQA,CAC1BC,QAAmB,EACnBC,OAAyB,EACzBC,KAA8C,EAC9CC,QAAkC,EACD;IACjC,IAAI,CAACT,YAAY,CAACU,WAAW,EAAE;MAC7B,MAAM,IAAIC,KAAK,CAAC,gDAAgD,CAAC;IACnE;IAEA,MAAMC,OAAO,GAAGC,IAAI,CAACC,SAAS,CAAC;MAC7BC,KAAK,EAAE,IAAI,CAACX,YAAY;MACxBE,QAAQ,EAAE,MAAM,IAAI,CAACU,iBAAiB,CAACV,QAAQ,CAAC;MAChDE,KAAK;MACLS,WAAW,EAAEV,OAAO,EAAEU,WAAW;MACjCC,KAAK,EAAEX,OAAO,EAAEY,IAAI;MACpBC,KAAK,EAAEb,OAAO,EAAEc,IAAI;MACpBC,UAAU,EAAEf,OAAO,EAAE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OAAO,EAAE,IAAI;MACbrC,QAAQ,EAAEiB,IAAI,CAACG,OAAO,CAAC,CAAC,CAAC,CAACjD,OAAO,CAACC,OAAO;MACzC8D,aAAa;MACbhC,kBAAkB,EAAE+B,WAAW;MAC/BA,WAAW;MACXK,eAAe,EAAGlC,YAAY,GAAG,IAAI,GAAI6B,WAAW;MACpD9B,aAAa,EAAEc,IAAI,CAACW,KAAK,CAACC,aAAa;MACvCzB,YAAY;MACZC,WAAW,EAAEY,IAAI,CAACW,KAAK,CAACG;IAC1B,CAAC;EACH;AACF","ignoreList":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["CactusConfig","isTelemetryEnabled"],"sourceRoot":"../../../src","sources":["config/CactusConfig.ts"],"mappings":";;AAAA,OAAO,MAAMA,YAAY,CAAC;EACxB;;EAEA,OAAcC,kBAAkB,GAAY,IAAI;;EAEhD;;EAGA;AAEF","ignoreList":[]}
|