fix(lint): remove unused funcs, fix formatting after Send refactor
- Remove unused messageThreadAnnotation (superseded by messageHistoryAnnotation) - Remove unused publishResponseIfNeeded (superseded by publishAgentResponseIfNeeded) - Reformat fakeChannel method alignment broken by Send signature change - Wrap long line in steering_test.go
This commit is contained in:
parent
a26c1a26d1
commit
ec84c4dd70
4 changed files with 11 additions and 57 deletions
|
|
@ -910,16 +910,6 @@ func messageSenderAnnotation(sender *providers.MessageSender) string {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// messageThreadAnnotation returns the thread annotation prefix for a message,
|
|
||||||
// e.g. "[msg:#5, reply_to:#3] " or "" if the message has no threading IDs.
|
|
||||||
func messageThreadAnnotation(msg providers.Message) string {
|
|
||||||
body := messageThreadAnnotationBody(msg)
|
|
||||||
if body == "" {
|
|
||||||
return ""
|
|
||||||
}
|
|
||||||
return fmt.Sprintf("[%s] ", body)
|
|
||||||
}
|
|
||||||
|
|
||||||
func messageThreadAnnotationBody(msg providers.Message) string {
|
func messageThreadAnnotationBody(msg providers.Message) string {
|
||||||
msgIDs := msg.MessageIDs
|
msgIDs := msg.MessageIDs
|
||||||
formattedIDs := strings.Join(msgIDs, ",#")
|
formattedIDs := strings.Join(msgIDs, ",#")
|
||||||
|
|
|
||||||
|
|
@ -657,43 +657,6 @@ func (al *AgentLoop) Stop() {
|
||||||
al.running.Store(false)
|
al.running.Store(false)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (al *AgentLoop) publishResponseIfNeeded(ctx context.Context, channel, chatID, response string) {
|
|
||||||
if response == "" {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
alreadySent := false
|
|
||||||
defaultAgent := al.GetRegistry().GetDefaultAgent()
|
|
||||||
if defaultAgent != nil {
|
|
||||||
if tool, ok := defaultAgent.Tools.Get("message"); ok {
|
|
||||||
if mt, ok := tool.(*tools.MessageTool); ok {
|
|
||||||
alreadySent = mt.HasSentInRound()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if alreadySent {
|
|
||||||
logger.DebugCF(
|
|
||||||
"agent",
|
|
||||||
"Skipped outbound (message tool already sent)",
|
|
||||||
map[string]any{"channel": channel},
|
|
||||||
)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
al.bus.PublishOutbound(ctx, bus.OutboundMessage{
|
|
||||||
Channel: channel,
|
|
||||||
ChatID: chatID,
|
|
||||||
Content: response,
|
|
||||||
})
|
|
||||||
logger.InfoCF("agent", "Published outbound response",
|
|
||||||
map[string]any{
|
|
||||||
"channel": channel,
|
|
||||||
"chat_id": chatID,
|
|
||||||
"content_len": len(response),
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
func (al *AgentLoop) publishAgentResponseIfNeeded(
|
func (al *AgentLoop) publishAgentResponseIfNeeded(
|
||||||
ctx context.Context,
|
ctx context.Context,
|
||||||
response agentResponse,
|
response agentResponse,
|
||||||
|
|
|
||||||
|
|
@ -25,16 +25,16 @@ import (
|
||||||
|
|
||||||
type fakeChannel struct{ id string }
|
type fakeChannel struct{ id string }
|
||||||
|
|
||||||
func (f *fakeChannel) Name() string { return "fake" }
|
func (f *fakeChannel) Name() string { return "fake" }
|
||||||
func (f *fakeChannel) Start(ctx context.Context) error { return nil }
|
func (f *fakeChannel) Start(ctx context.Context) error { return nil }
|
||||||
func (f *fakeChannel) Stop(ctx context.Context) error { return nil }
|
func (f *fakeChannel) Stop(ctx context.Context) error { return nil }
|
||||||
func (f *fakeChannel) Send(ctx context.Context, msg bus.OutboundMessage) ([]string, error) {
|
func (f *fakeChannel) Send(ctx context.Context, msg bus.OutboundMessage) ([]string, error) {
|
||||||
return nil, nil
|
return nil, nil
|
||||||
}
|
}
|
||||||
func (f *fakeChannel) IsRunning() bool { return true }
|
func (f *fakeChannel) IsRunning() bool { return true }
|
||||||
func (f *fakeChannel) IsAllowed(string) bool { return true }
|
func (f *fakeChannel) IsAllowed(string) bool { return true }
|
||||||
func (f *fakeChannel) IsAllowedSender(sender bus.SenderInfo) bool { return true }
|
func (f *fakeChannel) IsAllowedSender(sender bus.SenderInfo) bool { return true }
|
||||||
func (f *fakeChannel) ReasoningChannelID() string { return f.id }
|
func (f *fakeChannel) ReasoningChannelID() string { return f.id }
|
||||||
|
|
||||||
type fakeMediaChannel struct {
|
type fakeMediaChannel struct {
|
||||||
fakeChannel
|
fakeChannel
|
||||||
|
|
|
||||||
|
|
@ -522,9 +522,10 @@ func TestContinueWithSteeringMessages_ReturnsTrackedAssistantDelivery(t *testing
|
||||||
}
|
}
|
||||||
|
|
||||||
sessionKey := "agent:test-continue-delivery"
|
sessionKey := "agent:test-continue-delivery"
|
||||||
response, err := al.continueWithSteeringMessages(context.Background(), defaultAgent, sessionKey, "test", "chat1", []providers.Message{
|
response, err := al.continueWithSteeringMessages(
|
||||||
{Role: "user", Content: "new direction"},
|
context.Background(), defaultAgent, sessionKey, "test", "chat1",
|
||||||
})
|
[]providers.Message{{Role: "user", Content: "new direction"}},
|
||||||
|
)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("continueWithSteeringMessages failed: %v", err)
|
t.Fatalf("continueWithSteeringMessages failed: %v", err)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue