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:
parent
5d304a9aeb
commit
a7276e2632
3 changed files with 3 additions and 4 deletions
|
|
@ -23,7 +23,6 @@ import (
|
||||||
"github.com/sipeed/picoclaw/pkg/health"
|
"github.com/sipeed/picoclaw/pkg/health"
|
||||||
"github.com/sipeed/picoclaw/pkg/logger"
|
"github.com/sipeed/picoclaw/pkg/logger"
|
||||||
"github.com/sipeed/picoclaw/pkg/media"
|
"github.com/sipeed/picoclaw/pkg/media"
|
||||||
"github.com/sipeed/picoclaw/pkg/utils"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
|
@ -407,7 +406,7 @@ func (m *Manager) runWorker(ctx context.Context, name string, w *channelWorker)
|
||||||
maxLen = mlp.MaxMessageLength()
|
maxLen = mlp.MaxMessageLength()
|
||||||
}
|
}
|
||||||
if maxLen > 0 && len([]rune(msg.Content)) > maxLen {
|
if maxLen > 0 && len([]rune(msg.Content)) > maxLen {
|
||||||
chunks := utils.SplitMessage(msg.Content, maxLen)
|
chunks := SplitMessage(msg.Content, maxLen)
|
||||||
for _, chunk := range chunks {
|
for _, chunk := range chunks {
|
||||||
chunkMsg := msg
|
chunkMsg := msg
|
||||||
chunkMsg.Content = chunk
|
chunkMsg.Content = chunk
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
package utils
|
package channels
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"strings"
|
"strings"
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
package utils
|
package channels
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"strings"
|
"strings"
|
||||||
Loading…
Add table
Reference in a new issue