推进记忆模块

- 在 InteractionThreadPoolExecutor 中引入虚拟线程池 (newVirtualThreadPerTaskExecutor)
- 更新相关测试文件以适应新的线程池
- 优化 MemorySummarizer 中的单条目摘要逻辑
- 为 SingleSummarizer 、 MultiSummarizer 设计了提示词
- 还差两份提示词没有设计...
This commit is contained in:
2025-05-07 21:38:41 +08:00
parent 3dd21f840e
commit 9e0af5e5aa
8 changed files with 289 additions and 31 deletions

View File

@@ -0,0 +1,34 @@
package memory;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.TimeUnit;
public class ThreadPoolTest {
public static void main(String[] args) throws InterruptedException {
testExecutor(Executors.newVirtualThreadPerTaskExecutor());
// Thread.sleep(2000); // 等待系统输出稳定
// testExecutor("普通线程池", Executors.newFixedThreadPool(100));
}
private static void testExecutor(ExecutorService es) throws InterruptedException {
long start = System.currentTimeMillis();
for (int i = 0; i < 100000; i++) {
es.submit(() -> {
Thread.sleep(1000);
return 0;
});
}
es.shutdown();
if (es.awaitTermination(5, TimeUnit.MINUTES)) {
long end = System.currentTimeMillis();
System.out.println("虚拟线程" + "耗时:" + (end - start));
} else {
System.err.println("虚拟线程" + "未能在规定时间内完成所有任务");
}
}
}