From 4d1324ff0f89571a83e28477260f97fd1399ccb7 Mon Sep 17 00:00:00 2001 From: Hans Date: Tue, 22 Oct 2024 00:02:34 +0800 Subject: [PATCH] fix(Android): fix android build --- android/src/main/java/com/barkrn/BarkContext.kt | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/android/src/main/java/com/barkrn/BarkContext.kt b/android/src/main/java/com/barkrn/BarkContext.kt index 9578f50..f240051 100644 --- a/android/src/main/java/com/barkrn/BarkContext.kt +++ b/android/src/main/java/com/barkrn/BarkContext.kt @@ -3,7 +3,11 @@ package com.barkrn class BarkContext { private var context: Long = 0L - class BarkResult(success: Boolean, load_time: Int, eval_time: Int) + class BarkResult(success: Boolean, load_time: Int, eval_time: Int) { + val success: Boolean = success + val load_time: Int = load_time + val eval_time: Int = eval_time + } external fun nativeInitContext(model_path: String, params: Map): Long external fun nativeGenerate(context: Long, text: String, out_path: String, threads: Int): BarkResult @@ -14,7 +18,7 @@ class BarkContext { } fun generate(text: String, out_path: String, threads: Int = 1): BarkResult { - if (context == 0) { + if (context == 0L) { throw IllegalStateException("Context not initialized") } return nativeGenerate(context, text, out_path, threads)