Skip to content

Commit 8da8f46

Browse files
authored
New version 0.6.0 (#7)
* new version 0.6.0 * added missing proguard rules * ktlint issues
1 parent 694e4dc commit 8da8f46

File tree

23 files changed

+359
-304
lines changed

23 files changed

+359
-304
lines changed

composeApp/proguard-rules.pro

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,3 +99,24 @@
9999
-dontwarn javax.swing.SwingUtilities
100100
-dontwarn javax.swing.Timer
101101
-dontwarn org.slf4j.impl.StaticLoggerBinder
102+
103+
# Ktor & Kamel related
104+
-keep class io.ktor.utils.io.core.CloseableJVMKt { *; }
105+
-dontwarn io.ktor.utils.io.core.CloseableJVMKt
106+
107+
# Ktor Java HTTP Client Engine related (if you use it explicitly or a library does)
108+
# These are needed if your minSdk is below 26 and Ktor attempts to use the Java 11+ HTTP client
109+
-keep class java.net.http.HttpHeaders { *; }
110+
-keep class java.net.http.WebSocketHandshakeException { *; }
111+
-dontwarn java.net.http.**
112+
113+
# General Ktor rules (often helpful)
114+
-keep class io.ktor.** { *; }
115+
-keepnames class io.ktor.**
116+
-dontwarn io.ktor.**
117+
118+
# Kamel (if not covered by general Ktor rules, add more specific ones if needed)
119+
-keep class io.kamel.core.** { *; }
120+
-keepnames class io.kamel.core.**
121+
-dontwarn io.kamel.core.**
122+

library/build.gradle.kts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ plugins {
77
}
88

99
group = "com.llamatik.library"
10-
version = "0.5.0"
10+
version = "0.6.0"
1111

1212
// Choose ONE min iOS version and use it everywhere
1313
val minIos = "16.6"
@@ -183,6 +183,7 @@ kotlin {
183183
implementation(compose.foundation)
184184
implementation(compose.components.resources)
185185
resources.srcDir("src/commonMain/resources")
186+
resources.exclude("**/*.gguf")
186187
}
187188
}
188189
val commonTest by getting {
@@ -235,7 +236,7 @@ publishing {
235236
from(components["kotlin"])
236237
groupId = "com.llamatik.library"
237238
artifactId = "llamatik"
238-
version = "0.5.0"
239+
version = "0.6.0"
239240
}
240241
}
241242

shared/src/commonMain/kotlin/com/llamatik/app/feature/chatbot/utils/VectorStore.kt

Lines changed: 49 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -61,13 +61,50 @@ fun tidyAnswer(s: String): String = s
6161

6262
// --- Query keyword extraction & filtering ---
6363
private val STOPWORDS = setOf(
64-
"the","a","an","and","or","of","to","for","in","on","at","by","is","are","was","were",
65-
"be","with","as","that","this","it","from","your","you","we","our","us","can","could",
66-
"should","would","how","what","why","when","where","which","who","whom"
64+
"the",
65+
"a",
66+
"an",
67+
"and",
68+
"or",
69+
"of",
70+
"to",
71+
"for",
72+
"in",
73+
"on",
74+
"at",
75+
"by",
76+
"is",
77+
"are",
78+
"was",
79+
"were",
80+
"be",
81+
"with",
82+
"as",
83+
"that",
84+
"this",
85+
"it",
86+
"from",
87+
"your",
88+
"you",
89+
"we",
90+
"our",
91+
"us",
92+
"can",
93+
"could",
94+
"should",
95+
"would",
96+
"how",
97+
"what",
98+
"why",
99+
"when",
100+
"where",
101+
"which",
102+
"who",
103+
"whom"
67104
)
68105

69106
fun extractKeywords(s: String, minLen: Int = 3): Set<String> =
70-
Regex("[A-Za-z0-9][A-Za-z0-9_-]{${minLen-1},}")
107+
Regex("[A-Za-z0-9][A-Za-z0-9_-]{${minLen - 1},}")
71108
.findAll(s.lowercase())
72109
.map { it.value }
73110
.filterNot { it in STOPWORDS }
@@ -85,11 +122,14 @@ fun metaString(meta: Map<String, kotlinx.serialization.json.JsonElement>?, key:
85122

86123
// --- Cosine over List<Float> returning Double (good for MMR math) ---
87124
fun cosineD(a: List<Float>, b: List<Float>): Double {
88-
var dot = 0.0; var na = 0.0; var nb = 0.0
125+
var dot = 0.0;
126+
var na = 0.0;
127+
var nb = 0.0
89128
val n = minOf(a.size, b.size)
90129
var i = 0
91130
while (i < n) {
92-
val x = a[i].toDouble(); val y = b[i].toDouble()
131+
val x = a[i].toDouble();
132+
val y = b[i].toDouble()
93133
dot += x * y; na += x * x; nb += y * y
94134
i++
95135
}
@@ -120,7 +160,9 @@ fun mmr(
120160
cosineD(c.item.vector, s.item.vector)
121161
}
122162
val score = lambda * rel - (1 - lambda) * div
123-
if (score > bestScore) { bestScore = score; bestIdx = i }
163+
if (score > bestScore) {
164+
bestScore = score; bestIdx = i
165+
}
124166
}
125167
selected += remaining.removeAt(bestIdx)
126168
}

shared/src/commonMain/kotlin/com/llamatik/app/feature/debugmenu/DebugMenuScreen.kt

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -142,26 +142,27 @@ class DebugMenuScreen : Screen {
142142
)
143143
},
144144
colors = TopAppBarDefaults.mediumTopAppBarColors(
145-
containerColor = MaterialTheme.colorScheme.background
145+
containerColor = MaterialTheme.colorScheme.background,
146146
),
147147
navigationIcon = {
148148
IconButton(onClick = { onClose.invoke() }) {
149149
Icon(
150150
imageVector = Icons.AutoMirrored.Filled.ArrowBack,
151-
contentDescription = "Go back"
151+
contentDescription = "Go back",
152152
)
153153
}
154-
}
154+
},
155155
)
156-
}
156+
},
157157
) {
158158
val scrollState = rememberScrollState()
159159

160160
Column(
161-
modifier = Modifier
162-
.padding(it).padding(bottom = 46.dp)
163-
.background(MaterialTheme.colorScheme.background)
164-
.verticalScroll(scrollState)
161+
modifier =
162+
Modifier
163+
.padding(it).padding(bottom = 46.dp)
164+
.background(MaterialTheme.colorScheme.background)
165+
.verticalScroll(scrollState)
165166
) {
166167
/*
167168
Row(

shared/src/commonMain/kotlin/com/llamatik/app/feature/news/model/NewsModel.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,4 @@ class NewsModel(
1111
val image: String,
1212
val released: String,
1313
val modified: String?
14-
)
14+
)

shared/src/commonMain/kotlin/com/llamatik/app/feature/news/usecases/GetAllNewsUseCase.kt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,8 @@ import com.llamatik.app.feature.news.repositories.NewsFeedParser
66
import com.llamatik.app.feature.news.repositories.NewsRepository
77

88
class GetAllNewsUseCase(
9-
private val newsRepository: NewsRepository
9+
private val newsRepository: NewsRepository,
1010
) : UseCase() {
11-
1211
suspend fun invoke(): Result<List<FeedItem>> = runCatching {
1312
val news = newsRepository.getNews()
1413
return@runCatching NewsFeedParser().parse(news)

shared/src/commonMain/kotlin/com/llamatik/app/feature/news/viewmodel/FeedItemDetailViewModel.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import kotlinx.coroutines.launch
1515

1616
class FeedItemDetailViewModel(
1717
private var navigator: Navigator,
18-
private val getAllNewsUseCase: GetAllNewsUseCase
18+
private val getAllNewsUseCase: GetAllNewsUseCase,
1919
) : ScreenModel {
2020
private val _state = MutableStateFlow(FeedItemDetailScreenState())
2121
val state = _state.asStateFlow()

shared/src/commonMain/kotlin/com/llamatik/app/feature/webview/WebViewScreen.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ class WebViewScreen(
8989
*/
9090
@Composable
9191
fun WebViewScreenLayout(
92-
//viewModel: WebViewModel,
92+
// viewModel: WebViewModel,
9393
localization: Localization,
9494
onClose: () -> Unit
9595
) {

shared/src/commonMain/kotlin/com/llamatik/app/localization/Localization.kt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ interface Localization {
1818
val previous: String
1919
val welcome: String
2020

21-
2221
val backLabel: String
2322
val topAppBarActionIconDescription: String
2423
val home: String
@@ -56,7 +55,6 @@ interface Localization {
5655

5756
val feedItemTitle: String
5857

59-
6058
val loading: String
6159
val profileImageDescription: String
6260
val manuals: String

shared/src/commonMain/kotlin/com/llamatik/app/navigation/ChatBotTab.kt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ import com.llamatik.app.feature.chatbot.ChatBotTabScreen
1111
import com.llamatik.app.ui.icon.LlamatikIcons
1212

1313
internal object ChatBotTab : Tab {
14-
1514
override val options: TabOptions
1615
@Composable
1716
get() {
@@ -21,7 +20,7 @@ internal object ChatBotTab : Tab {
2120
TabOptions(
2221
index = 2u,
2322
title = "Llamatik AI",
24-
icon = icon
23+
icon = icon,
2524
)
2625
}
2726
}

0 commit comments

Comments
 (0)