feat(rag): LLM 전송 전 뉴스 원본 텍스트 및 루씬 매칭 기사 목록 상세 콘솔 로그 출력
This commit is contained in:
@@ -101,6 +101,11 @@ object NewsService {
|
|||||||
.take(2)
|
.take(2)
|
||||||
|
|
||||||
if (finalItems.isNotEmpty()) {
|
if (finalItems.isNotEmpty()) {
|
||||||
|
println("📰 [NaverNews] '${corpInfo.stockName}' 검색어: '$query' -> 스크래핑 대상 ${finalItems.size}건:")
|
||||||
|
finalItems.forEach {
|
||||||
|
val cleanTitle = it.title.replace("<b>", "").replace("</b>", "").replace(""", "\"")
|
||||||
|
println(" - $cleanTitle (${it.originallink})")
|
||||||
|
}
|
||||||
SafeScraper.scrapeParallel(corpInfo, finalItems)
|
SafeScraper.scrapeParallel(corpInfo, finalItems)
|
||||||
}
|
}
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
|
|||||||
@@ -369,9 +369,21 @@ object RagService {
|
|||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
}
|
}
|
||||||
|
|
||||||
tradingDecision.newsContext = finalSearchResult?.matches()?.distinct()
|
val matches = finalSearchResult?.matches() ?: emptyList()
|
||||||
?.take(4)
|
println("\n================================================================================")
|
||||||
?.joinToString("\n\n") {
|
println("🔍 [루씬 RAG 검색] [$stockName($stockCode)] 매칭된 기사 수: ${matches.size}개")
|
||||||
|
matches.take(4).forEachIndexed { idx, match ->
|
||||||
|
val title = match.embedded().metadata().getString("title") ?: "제목 없음"
|
||||||
|
val date = match.embedded().metadata().getString("date") ?: ""
|
||||||
|
val link = match.embedded().metadata().getString("link") ?: ""
|
||||||
|
val simScore = match.score()
|
||||||
|
println(" [$idx] (유사도: ${String.format("%.3f", simScore)}) $title | $date | $link")
|
||||||
|
}
|
||||||
|
println("================================================================================")
|
||||||
|
|
||||||
|
tradingDecision.newsContext = matches.distinct()
|
||||||
|
.take(4)
|
||||||
|
.joinToString("\n\n") {
|
||||||
it.embedded().text()
|
it.embedded().text()
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -953,7 +965,17 @@ object RagService {
|
|||||||
}
|
}
|
||||||
""".trimIndent()
|
""".trimIndent()
|
||||||
|
|
||||||
println("📰 [RagService.getAiNewsScore] 대상 종목: [$stockName] | 뉴스 텍스트 길이: ${news.length}자 | 마켓 컨텍스트: ${techSummary.length}자")
|
println("""
|
||||||
|
================================================================================
|
||||||
|
📰 [LLM 전송 전 뉴스 원본 텍스트 - $stockName] (총 ${news.length}자)
|
||||||
|
--------------------------------------------------------------------------------
|
||||||
|
$news
|
||||||
|
--------------------------------------------------------------------------------
|
||||||
|
📊 [마켓 컨텍스트]
|
||||||
|
$techSummary
|
||||||
|
================================================================================
|
||||||
|
""".trimIndent())
|
||||||
|
|
||||||
return try {
|
return try {
|
||||||
val raw = callLlamaWithSchema(prompt)
|
val raw = callLlamaWithSchema(prompt)
|
||||||
val startIndex = raw.indexOf("{")
|
val startIndex = raw.indexOf("{")
|
||||||
|
|||||||
Reference in New Issue
Block a user