mirror of
https://github.com/memohai/Memoh.git
synced 2026-04-27 07:16:19 +09:00
5cfbaa40e2
* refactor(agent): replace XML tag extraction with tool-based send/react/speak Remove the <attachments>, <reactions>, and <speech> XML tag extraction system from the agent streaming pipeline. Instead, the send/react/speak tools now handle both same-conversation and cross-conversation delivery: - send: omit target to deliver attachments in the current conversation; specify target for cross-channel messaging - react: omit target to react in the current conversation - speak: omit target to speak in the current conversation Backend changes: - Add StreamEmitter callback to tools.SessionContext so tools can push attachment/reaction/speech events directly into the agent stream - Wire emitter in agent.go for both streaming and non-streaming paths - Remove StreamTagExtractor, DefaultTagResolvers, emitTagEvents, and delete internal/agent/tags.go entirely - Remove StripAgentTags calls from assistant_output.go - Add IsSameConversation detection in messaging executor; same-conv sends pass raw paths through the emitter for downstream ingestion - Auto-resolve relative paths (e.g. "IDENTITY.md" -> "/data/IDENTITY.md") - Add Metadata propagation through the full attachment chain (tools.Attachment -> agent.FileAttachment -> parseAttachmentDelta) - Update system_chat.md and _contacts.md prompts Frontend changes (apps/web): - Hide send/react/speak tool_call blocks when result indicates delivered to current conversation - Defer attachment_delta blocks to end of message (flush on stream completion) for consistent positioning with DB-loaded history * fix(agent): speak tool emits synthesized audio directly as voice attachment Instead of emitting speech_delta (which requires downstream re-synthesis), the speak tool now emits the already-synthesized audio as an attachment_delta with voice type. This avoids double TTS synthesis and eliminates dependency on ttsService being configured on the inbound processor. Also fixes speak on WebUI where ReplyTarget is empty (same fix as send).
18 lines
1.1 KiB
Markdown
18 lines
1.1 KiB
Markdown
## Contacts & Messaging
|
|
|
|
Use `get_contacts` to list all known contacts and conversations. It returns each route's platform, conversation type, and `target` (the value you pass to `send`).
|
|
|
|
- **`send`**: Send a message, file, or attachment. Omit `target` to deliver in the current conversation; specify `target` for another channel/person.
|
|
- **`react`**: Add or remove an emoji reaction on a message. Omit `target` to react in the current conversation.
|
|
- **`speak`**: Send a voice message. Omit `target` to speak in the current conversation; specify `target` for another channel/person.
|
|
|
|
## Sessions & History
|
|
|
|
- **`list_sessions`**: List all chat sessions with their bound contact/route info. Filter by `type` (chat/heartbeat/schedule) or `platform`. Returns session IDs you can pass to `search_messages`.
|
|
- **`search_messages`**: Search past message history. All parameters are optional:
|
|
- `start_time` / `end_time` — ISO 8601 time range
|
|
- `keyword` — text search (case-insensitive)
|
|
- `session_id` — scope to a specific session
|
|
- `contact_id` — filter by sender
|
|
- `role` — filter by user or assistant
|