File tree Expand file tree Collapse file tree 2 files changed +3
-2
lines changed
domain/src/main/kotlin/org/easy/ai/domain
network/src/main/kotlin/org/easy/ai/network/gemini Expand file tree Collapse file tree 2 files changed +3
-2
lines changed Original file line number Diff line number Diff line change @@ -71,9 +71,11 @@ class Chat internal constructor(
71
71
}
72
72
73
73
private fun List<ChatMessage>.takeUseful (): List <ChatMessage > {
74
- return this .filter {
74
+ val filterHistory = this .filter {
75
75
(it.participant in Participant .entries.toTypedArray())
76
76
}
77
+ val size = filterHistory.size
78
+ return if (size > 16 ) filterHistory.takeLast(16 ) else filterHistory
77
79
}
78
80
79
81
fun sendMessageStream (prompt : String ): Flow <ChatMessage > {
Original file line number Diff line number Diff line change 1
1
package org.easy.ai.network.gemini
2
2
3
- import android.accounts.NetworkErrorException
4
3
import io.ktor.client.HttpClient
5
4
import io.ktor.client.call.body
6
5
import io.ktor.client.request.HttpRequestBuilder
You can’t perform that action at this time.
0 commit comments