Files
Memoh/internal/agent/prompt_test.go
T
Acbox 9f10033f63 feat(agent): include platform self identities in system prompts
Give bots their known per-channel account handles in the system prompt so they can reason about platform-specific self references consistently. Reuse persisted channel self_identity data across chat, discuss, schedule, heartbeat, and subagent prompts.
2026-04-16 16:44:29 +08:00

44 lines
1.3 KiB
Go

package agent
import (
"strings"
"testing"
"time"
)
func TestGenerateSystemPromptIncludesPlatformIdentitiesInChat(t *testing.T) {
t.Parallel()
prompt := GenerateSystemPrompt(SystemPromptParams{
SessionType: "chat",
Now: time.Unix(1, 0).UTC(),
Timezone: "UTC",
PlatformIdentitiesSection: "## Platform Identities\n\n<identity channel=\"telegram\" username=\"@memoh\"/>",
})
if !strings.Contains(prompt, "## Platform Identities") {
t.Fatalf("expected platform identities heading in prompt")
}
if !strings.Contains(prompt, `<identity channel="telegram" username="@memoh"/>`) {
t.Fatalf("expected platform identity XML in prompt")
}
}
func TestGenerateSystemPromptIncludesPlatformIdentitiesInDiscuss(t *testing.T) {
t.Parallel()
prompt := GenerateSystemPrompt(SystemPromptParams{
SessionType: "discuss",
Now: time.Unix(1, 0).UTC(),
Timezone: "UTC",
PlatformIdentitiesSection: "## Platform Identities\n\n<identity channel=\"discord\" username=\"@memoh\"/>",
})
if !strings.Contains(prompt, "## Platform Identities") {
t.Fatalf("expected platform identities heading in discuss prompt")
}
if !strings.Contains(prompt, `<identity channel="discord" username="@memoh"/>`) {
t.Fatalf("expected platform identity XML in discuss prompt")
}
}