chore: rename cognition core into context core

This commit is contained in:
2026-05-15 16:16:44 +08:00
parent cb8ddfe4e2
commit ed743521ec
2 changed files with 6 additions and 6 deletions

View File

@@ -27,7 +27,7 @@ import java.util.concurrent.locks.ReentrantLock;
@Slf4j @Slf4j
@CapabilityCore(value = "cognition") @CapabilityCore(value = "cognition")
public class CognitionCore implements StateSerializable { public class ContextCore implements StateSerializable {
private static final String RECENT_CHAT_MESSAGE_NOTES = """ private static final String RECENT_CHAT_MESSAGE_NOTES = """
消息格式: 消息格式:
@@ -58,7 +58,7 @@ public class CognitionCore implements StateSerializable {
private final ContextWorkspace contextWorkspace = new ContextWorkspace(); private final ContextWorkspace contextWorkspace = new ContextWorkspace();
public CognitionCore() { public ContextCore() {
register(); register();
} }

View File

@@ -20,15 +20,15 @@ class CognitionCoreTest {
@Test @Test
void shouldRenderRecentChatMessagesWithWrapperAndNotes() { void shouldRenderRecentChatMessagesWithWrapperAndNotes() {
CognitionCore cognitionCore = new CognitionCore(); ContextCore contextCore = new ContextCore();
cognitionCore.getChatMessages().addAll(List.of( contextCore.getChatMessages().addAll(List.of(
new Message(Message.Character.USER, "[[USER]: user-1]: hello"), new Message(Message.Character.USER, "[[USER]: user-1]: hello"),
new Message(Message.Character.ASSISTANT, "[NOT_REPLIED]: wait"), new Message(Message.Character.ASSISTANT, "[NOT_REPLIED]: wait"),
new Message(Message.Character.ASSISTANT, "latest message") new Message(Message.Character.ASSISTANT, "latest message")
)); ));
cognitionCore.refreshRecentChatMessagesContext(); contextCore.refreshRecentChatMessagesContext();
String content = cognitionCore.contextWorkspace() String content = contextCore.contextWorkspace()
.resolve(List.of(ContextBlock.FocusedDomain.COMMUNICATION)) .resolve(List.of(ContextBlock.FocusedDomain.COMMUNICATION))
.encodeToMessage() .encodeToMessage()
.getContent(); .getContent();