refactor(channels): move SplitMessage from pkg/utils to pkg/channels

Message splitting is exclusively a Manager responsibility. Moving it
into the channels package eliminates the cross-package dependency and
aligns with the refactoring plan.
This commit is contained in:
Hoshina
2026-02-23 05:46:34 +08:00
parent ced55e768c
commit f4b0f080e2
3 changed files with 3 additions and 4 deletions
+1 -2
View File
@@ -23,7 +23,6 @@ import (
"github.com/sipeed/picoclaw/pkg/health"
"github.com/sipeed/picoclaw/pkg/logger"
"github.com/sipeed/picoclaw/pkg/media"
"github.com/sipeed/picoclaw/pkg/utils"
)
const (
@@ -407,7 +406,7 @@ func (m *Manager) runWorker(ctx context.Context, name string, w *channelWorker)
maxLen = mlp.MaxMessageLength()
}
if maxLen > 0 && len([]rune(msg.Content)) > maxLen {
chunks := utils.SplitMessage(msg.Content, maxLen)
chunks := SplitMessage(msg.Content, maxLen)
for _, chunk := range chunks {
chunkMsg := msg
chunkMsg.Content = chunk
@@ -1,4 +1,4 @@
package utils
package channels
import (
"strings"
@@ -1,4 +1,4 @@
package utils
package channels
import (
"strings"