Skip to content

Commit de5ceb6

Browse files
committed
add max history for 18 items
1 parent 891e064 commit de5ceb6

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

core/domain/src/main/kotlin/org/easy/ai/domain/Chat.kt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,9 +71,11 @@ class Chat internal constructor(
7171
}
7272

7373
private fun List<ChatMessage>.takeUseful(): List<ChatMessage> {
74-
return this.filter {
74+
val filterHistory = this.filter {
7575
(it.participant in Participant.entries.toTypedArray())
7676
}
77+
val size = filterHistory.size
78+
return if (size > 16) filterHistory.takeLast(16) else filterHistory
7779
}
7880

7981
fun sendMessageStream(prompt: String): Flow<ChatMessage> {

core/network/src/main/kotlin/org/easy/ai/network/gemini/GeminiRestApiController.kt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
package org.easy.ai.network.gemini
22

3-
import android.accounts.NetworkErrorException
43
import io.ktor.client.HttpClient
54
import io.ktor.client.call.body
65
import io.ktor.client.request.HttpRequestBuilder

0 commit comments

Comments
 (0)