Skip to content

Commit f4683b1

Browse files
committed
removed bot names due to semantic search collision
1 parent 6809517 commit f4683b1

File tree

1 file changed

+10
-1
lines changed
  • src/main/kotlin/dev/storozhenko/familybot/feature/talking/services/rag

1 file changed

+10
-1
lines changed

src/main/kotlin/dev/storozhenko/familybot/feature/talking/services/rag/RagService.kt

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,18 @@ class RagService(
6767
return true
6868
}
6969

70+
private fun cleanupBotMentions(text: String?): String? {
71+
if (text == null) return null
72+
var clean: String = text
73+
for (alias in botConfig.botNameAliases) {
74+
clean = clean.replace(alias, "")
75+
}
76+
return clean.replace(botConfig.botName, "")
77+
}
78+
7079
suspend fun getContext(context: ExecutorContext, chatMessages: MutableList<ChatMessage>): String {
7180
try {
72-
val text = context.message.text ?: return ""
81+
val text = cleanupBotMentions(context.message.text) ?: return ""
7382
val semantic =
7483
coroutineScope {
7584
async {

0 commit comments

Comments
 (0)