mirror of
https://github.com/slhaf/Partner.git
synced 2026-05-12 16:53:04 +08:00
记忆模块、主模块完成, 进行了一些小测试
- 完成了totalSummarizer、staticMemoryExtractor的提示词设计 - 更新了 coreModel 的提示词设计,使其聚焦于最新用户,同时做到不同用户的上下文语义隔离、知识共享 - 更新了 MemoryUpdater 中针对多人场景的记忆切片设置 involvedUserId 功能 - 在程序结束时将主动触发 MemoryGraph 的持久化 - 在Config中添加了对于StaticMemoryExtractor的适配 - PersistableObject 移动位置至common包
This commit is contained in:
31
src/test/java/memory/RegexTest.java
Normal file
31
src/test/java/memory/RegexTest.java
Normal file
@@ -0,0 +1,31 @@
|
||||
package memory;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
public class RegexTest {
|
||||
|
||||
@Test
|
||||
public void regexTest(){
|
||||
String[] examples = {
|
||||
"[小明(userId)] 我在开会] (te[]st)",
|
||||
"[用户(昵)称(userId)] 你好[呀]",
|
||||
"[测试账号(userId)] 这是一个(test(123))消息"
|
||||
};
|
||||
|
||||
Pattern pattern = Pattern.compile("\\[.*?\\(([^)]+)\\)\\]");
|
||||
|
||||
for (String example : examples) {
|
||||
Matcher matcher = pattern.matcher(example);
|
||||
if (matcher.find()) {
|
||||
System.out.println("在 '" + example + "' 中找到 userId: " + matcher.group(1));
|
||||
System.out.println();
|
||||
} else {
|
||||
System.out.println("在 '" + example + "' 中未找到 userId");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user