mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-01 20:46:12 +00:00
fix(auto-reply): move volatile inbound flags out of system metadata
Co-authored-by: aidiffuser <aidiffuser@users.noreply.github.com>
This commit is contained in:
@@ -57,6 +57,24 @@ describe("buildInboundMetaSystemPrompt", () => {
|
||||
expect(payload["sender_id"]).toBeUndefined();
|
||||
});
|
||||
|
||||
it("does not include per-turn flags in system metadata", () => {
|
||||
const prompt = buildInboundMetaSystemPrompt({
|
||||
ReplyToBody: "quoted",
|
||||
ForwardedFrom: "sender",
|
||||
ThreadStarterBody: "starter",
|
||||
InboundHistory: [{ sender: "a", body: "b", timestamp: 1 }],
|
||||
WasMentioned: true,
|
||||
OriginatingTo: "telegram:-1001249586642",
|
||||
OriginatingChannel: "telegram",
|
||||
Provider: "telegram",
|
||||
Surface: "telegram",
|
||||
ChatType: "group",
|
||||
} as TemplateContext);
|
||||
|
||||
const payload = parseInboundMetaPayload(prompt);
|
||||
expect(payload["flags"]).toBeUndefined();
|
||||
});
|
||||
|
||||
it("omits sender_id when blank", () => {
|
||||
const prompt = buildInboundMetaSystemPrompt({
|
||||
MessageSid: "458",
|
||||
@@ -183,6 +201,25 @@ describe("buildInboundUserContextPrefix", () => {
|
||||
expect(conversationInfo["sender_id"]).toBe("289522496");
|
||||
});
|
||||
|
||||
it("includes dynamic per-turn flags in conversation info", () => {
|
||||
const text = buildInboundUserContextPrefix({
|
||||
ChatType: "group",
|
||||
WasMentioned: true,
|
||||
ReplyToBody: "quoted",
|
||||
ForwardedFrom: "sender",
|
||||
ThreadStarterBody: "starter",
|
||||
InboundHistory: [{ sender: "a", body: "b", timestamp: 1 }],
|
||||
} as TemplateContext);
|
||||
|
||||
const conversationInfo = parseConversationInfoPayload(text);
|
||||
expect(conversationInfo["is_group_chat"]).toBe(true);
|
||||
expect(conversationInfo["was_mentioned"]).toBe(true);
|
||||
expect(conversationInfo["has_reply_context"]).toBe(true);
|
||||
expect(conversationInfo["has_forwarded_context"]).toBe(true);
|
||||
expect(conversationInfo["has_thread_starter"]).toBe(true);
|
||||
expect(conversationInfo["history_count"]).toBe(1);
|
||||
});
|
||||
|
||||
it("trims sender_id in conversation info", () => {
|
||||
const text = buildInboundUserContextPrefix({
|
||||
ChatType: "group",
|
||||
|
||||
Reference in New Issue
Block a user