fix(memory): align substring index with trimmed input in extractHeuristicFact
This commit is contained in:
@@ -205,7 +205,8 @@ final class PlayerMemory {
|
||||
if (text == null) {
|
||||
return null;
|
||||
}
|
||||
String lower = text.toLowerCase(Locale.ROOT).trim();
|
||||
String clean = text.trim();
|
||||
String lower = clean.toLowerCase(Locale.ROOT);
|
||||
String[] triggers = {
|
||||
"minha base", "meu spawn", "minha casa", "estou construindo",
|
||||
"meu plano", "meu objetivo", "sou especialista em", "moro em"
|
||||
@@ -213,7 +214,7 @@ final class PlayerMemory {
|
||||
for (String trigger : triggers) {
|
||||
int idx = lower.indexOf(trigger);
|
||||
if (idx >= 0) {
|
||||
String candidate = text.substring(idx).trim();
|
||||
String candidate = clean.substring(idx).trim();
|
||||
candidate = candidate.replaceAll("[?!.]+$", "").trim();
|
||||
if (candidate.length() > 60) {
|
||||
candidate = candidate.substring(0, 60) + "…";
|
||||
|
||||
Reference in New Issue
Block a user