From 5f7c23a1b949e5e9e27bc46d3d952b4d57733f7d Mon Sep 17 00:00:00 2001 From: begoniezhao Date: Mon, 2 Feb 2026 15:45:58 +0800 Subject: [PATCH] refactor: Refactor rune handling for correct chunk merging --- internal/application/service/chat_pipline/merge.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/internal/application/service/chat_pipline/merge.go b/internal/application/service/chat_pipline/merge.go index 68d1b77c..c1ed13ee 100644 --- a/internal/application/service/chat_pipline/merge.go +++ b/internal/application/service/chat_pipline/merge.go @@ -101,9 +101,9 @@ func (p *PluginMerge) OnEvent(ctx context.Context, } // Merge overlapping chunks if chunks[i].EndAt > lastChunk.EndAt { - content := string([]rune(chunks[i].Content)) - offset := len(content) - (chunks[i].EndAt - lastChunk.EndAt) - lastChunk.Content = lastChunk.Content + content[offset:] + contentRunes := []rune(chunks[i].Content) + offset := len(contentRunes) - (chunks[i].EndAt - lastChunk.EndAt) + lastChunk.Content = lastChunk.Content + string(contentRunes[offset:]) lastChunk.EndAt = chunks[i].EndAt lastChunk.SubChunkID = append(lastChunk.SubChunkID, chunks[i].ID)