mirror of
https://github.com/memohai/Memoh.git
synced 2026-04-27 07:16:19 +09:00
9f10033f63
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.
44 lines
1.3 KiB
Go
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")
|
|
}
|
|
}
|