Files
Memoh/internal/conversation/flow/resolver_dedupe_test.go
T
Ringo.Typowriter e6a6dbe3f6 feat(channel): add QQ channel support and image message pipeline (#199)
* feat(channel): add qq adapter and outbound delivery

* feat(channel): ingest inbound qq messages

* feat(web): expose qq channel in management ui

* feat(channel): support qq attachment ingestion

* fix(mcp): fail read raw immediately for missing files

* fix(agent): parse inline image data into native image parts

* test(agent): align read_media tool tests with SDK options

* fix(channel): harden qq image delivery and reconnect loop

Avoid data URLs for qq channel images, reset reconnect backoff after healthy sessions, and fall back gracefully for malformed public image URLs.

* fix(channel): restore qq media delivery and target resolution

* fix(qq,mcp,agent): fix message/qq regressions and pass go lint

* fix(qq,agent): validate inline base64 and sync heartbeat seq

* fix(qq): validate remote voice mime for upload checks

* fix(qq): fall back intents and restore adapter wiring

* fix(qq): prevent final text leakage and dedupe persisted inbound query
2026-03-07 17:12:06 +08:00

46 lines
1.1 KiB
Go

package flow
import (
"testing"
"github.com/memohai/memoh/internal/conversation"
)
func TestDedupePersistedCurrentUserMessageRemovesCurrentInboundFromHistory(t *testing.T) {
t.Parallel()
history := []messageWithUsage{
{
Message: conversation.ModelMessage{
Role: "user",
Content: conversation.NewTextContent("---\nmessage-id: qq-msg-1\nchannel: qq\n---\nhello"),
},
RouteID: "route-1",
ExternalMessageID: "qq-msg-1",
Platform: "qq",
SenderChannelID: "channel-identity-1",
},
{
Message: conversation.ModelMessage{
Role: "assistant",
Content: conversation.NewTextContent("ok"),
},
},
}
got := dedupePersistedCurrentUserMessage(history, conversation.ChatRequest{
UserMessagePersisted: true,
RouteID: "route-1",
ExternalMessageID: "qq-msg-1",
CurrentChannel: "qq",
SourceChannelIdentityID: "channel-identity-1",
})
if len(got) != 1 {
t.Fatalf("expected 1 message after dedupe, got %d", len(got))
}
if got[0].Message.Role != "assistant" {
t.Fatalf("unexpected remaining role: %s", got[0].Message.Role)
}
}