From 858d8875e8a01fb070b88d5a85111f65bf11ce8e Mon Sep 17 00:00:00 2001 From: wizardchen Date: Wed, 14 Jan 2026 15:14:29 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E5=88=87=E7=89=87?= =?UTF-8?q?=E8=B6=8A=E7=95=8C=E5=AF=BC=E8=87=B4=E7=9A=84=E6=BD=9C=E5=9C=A8?= =?UTF-8?q?=E5=B4=A9=E6=BA=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- internal/application/service/knowledge.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/internal/application/service/knowledge.go b/internal/application/service/knowledge.go index 19be39b6..3bee9cc6 100644 --- a/internal/application/service/knowledge.go +++ b/internal/application/service/knowledge.go @@ -1462,7 +1462,14 @@ func (s *knowledgeService) getSummary(ctx context.Context, if chunk.EndAt > 4096 { break } - chunkContents = string([]rune(chunkContents)[:chunk.StartAt]) + chunk.Content + // Ensure we don't slice beyond the current content length + runes := []rune(chunkContents) + if chunk.StartAt <= len(runes) { + chunkContents = string(runes[:chunk.StartAt]) + chunk.Content + } else { + // If StartAt is beyond current content, just append + chunkContents = chunkContents + chunk.Content + } if chunk.ImageInfo != "" { var images []*types.ImageInfo if err := json.Unmarshal([]byte(chunk.ImageInfo), &images); err == nil {