fix: tui attachment bound

This commit is contained in:
rekram1-node 2025-09-01 16:27:54 -05:00
parent 38f9ce05f6
commit 7ef8f720b0

View file

@ -43,6 +43,9 @@ func (p Prompt) ToMessage(
}
for _, att := range textAttachments {
if source, ok := att.GetTextSource(); ok {
if att.StartIndex > att.EndIndex || att.EndIndex > len(text) {
continue
}
text = text[:att.StartIndex] + source.Value + text[att.EndIndex:]
}
}