remove leave tool due to delay

This commit is contained in:
Huaaudio 2026-03-21 07:21:33 +01:00
parent 176705d8f0
commit 4651eb700a
3 changed files with 1 additions and 55 deletions

View file

@ -246,9 +246,6 @@ func registerSharedTools(
agent.Tools.Register(messageTool) agent.Tools.Register(messageTool)
} }
// Always register Voice Leave Tool (it inherently checks if channel == "discord")
agent.Tools.Register(tools.NewVoiceLeaveTool(msgBus))
// Send file tool (outbound media via MediaStore — store injected later by SetMediaStore) // Send file tool (outbound media via MediaStore — store injected later by SetMediaStore)
if cfg.Tools.IsToolEnabled("send_file") { if cfg.Tools.IsToolEnabled("send_file") {
sendFileTool := tools.NewSendFileTool( sendFileTool := tools.NewSendFileTool(

View file

@ -1,52 +0,0 @@
package tools
import (
"context"
"github.com/sipeed/picoclaw/pkg/bus"
"github.com/sipeed/picoclaw/pkg/logger"
)
type VoiceLeaveTool struct {
bus *bus.MessageBus
}
func NewVoiceLeaveTool(mb *bus.MessageBus) *VoiceLeaveTool {
return &VoiceLeaveTool{bus: mb}
}
func (t *VoiceLeaveTool) Name() string {
return "voice_leave"
}
func (t *VoiceLeaveTool) Description() string {
return "Disconnects the bot from the current voice channel. Use this tool when the user says goodbye or explicitly asks you to leave the voice chat."
}
func (t *VoiceLeaveTool) Parameters() map[string]any {
return map[string]any{
"type": "object",
"properties": map[string]any{},
}
}
func (t *VoiceLeaveTool) Execute(ctx context.Context, args map[string]any) *ToolResult {
channel := ToolChannel(ctx)
chatID := ToolChatID(ctx)
if channel != "discord" {
return &ToolResult{ForLLM: "Can only leave voice channels on Discord", IsError: true}
}
t.bus.PublishVoiceControl(ctx, bus.VoiceControl{
ChatID: chatID,
Type: "command",
Action: "leave",
})
logger.InfoCF("agent", "Voice command triggered via tool: leave", map[string]any{"chat_id": chatID})
return &ToolResult{
ForLLM: "Successfully sent disconnect command to voice adapter.",
}
}

View file

@ -5,6 +5,7 @@ import (
"fmt" "fmt"
"os" "os"
"path/filepath" "path/filepath"
"strings"
"sync" "sync"
"time" "time"