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 {
|
||||
msgIDs := msg.MessageIDs
|
||||
formattedIDs := strings.Join(msgIDs, ",#")
|
||||
|
|
|
|||
|
|
@ -657,43 +657,6 @@ func (al *AgentLoop) Stop() {
|
|||
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(
|
||||
ctx context.Context,
|
||||
response agentResponse,
|
||||
|
|
|
|||
|
|
@ -522,9 +522,10 @@ func TestContinueWithSteeringMessages_ReturnsTrackedAssistantDelivery(t *testing
|
|||
}
|
||||
|
||||
sessionKey := "agent:test-continue-delivery"
|
||||
response, err := al.continueWithSteeringMessages(context.Background(), defaultAgent, sessionKey, "test", "chat1", []providers.Message{
|
||||
{Role: "user", Content: "new direction"},
|
||||
})
|
||||
response, err := al.continueWithSteeringMessages(
|
||||
context.Background(), defaultAgent, sessionKey, "test", "chat1",
|
||||
[]providers.Message{{Role: "user", Content: "new direction"}},
|
||||
)
|
||||
if err != nil {
|
||||
t.Fatalf("continueWithSteeringMessages failed: %v", err)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue