This commit is contained in:
lunaticbum 2025-03-06 18:41:34 +09:00
parent 6770f6f32e
commit a89b4904ea

View File

@ -21,6 +21,7 @@ import org.springframework.ai.ollama.api.OllamaOptions
import org.springframework.ai.ollama.management.ModelManagementOptions
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.beans.factory.annotation.Qualifier
import org.springframework.http.MediaType
import org.springframework.stereotype.Service
import org.springframework.web.reactive.function.BodyInserters
import org.springframework.web.reactive.function.client.WebClient
@ -222,20 +223,20 @@ class Lama {
println(response.message.content)
// val fullUrl = "https://api.telegram.org/${globalEvv.telegramBotKey}/sendMessage?chat_id=${globalEvv.telegramMyId}&text=${query}의 대답이 도착했어요.\n\n${response.message.content}"
CoroutineScope(Dispatchers.IO).launch {
var toalmsg = "${query}의 대답이 도착했어요.\n" + "${response.message.content}"
var toalmsg = "${query}의 대답이 도착했어요.\n${response.message.content}"
val fullUrl = "https://api.telegram.org/${globalEvv.telegramBotKey}/sendMessage"
toalmsg.chunked(2048).forEach { chunkedMsg ->
toalmsg.chunked(512).forEach { chunkedMsg ->
println("fullUrl >>> ${fullUrl}")
(targetId ?: globalEvv.telegramMyId)?.let {
var tlgSend = TelegramSendMsg(it, chunkedMsg)
WebClient
.create()
.create(fullUrl)
.post()
.uri(fullUrl)
.contentType(MediaType.APPLICATION_JSON)
.body(BodyInserters.fromValue(Gson().toJson(tlgSend)))
.retrieve().bodyToMono(String::class.java).timeout(Duration.ofMinutes(20L))
.block()?.let { result ->
println("result >>> ${result}")
}
}
}