Skip to content

Commit 3d7097c

Browse files
committed
use newline to find the end of the start tag instead of ">" to avoid issues with the filename containing ">" chars...
1 parent b338b49 commit 3d7097c

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

pkg/aiusechat/openai/openai-convertmessage.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -480,8 +480,8 @@ func (m *OpenAIChatMessage) ConvertToUIMessage() *uctypes.UIMessage {
480480
switch block.Type {
481481
case "input_text", "output_text":
482482
if strings.HasPrefix(block.Text, "<AttachedTextFile_") {
483-
openTagEnd := strings.Index(block.Text, ">")
484-
if openTagEnd == -1 {
483+
openTagEnd := strings.Index(block.Text, "\n")
484+
if openTagEnd == -1 || block.Text[openTagEnd-1] != '>' {
485485
continue
486486
}
487487

pkg/aiusechat/usechat.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ var SystemPromptText_OpenAI = strings.Join([]string{
6666
`Be concise and direct. Prefer determinism over speculation. If a brief clarifying question eliminates guesswork, ask it.`,
6767

6868
// Attached text files
69-
`User-attached text files may appear inline as <AttachedTextFile_xxxxxx file_name="...">content</AttachedTextFile_xxxxxx>.`,
69+
`User-attached text files may appear inline as <AttachedTextFile_xxxxxx file_name="...">\ncontent\n</AttachedTextFile_xxxxxx>.`,
7070
`If multiple attached files exist, treat each as a separate source file with its own file_name.`,
7171
`When the user refers to these files, use their inline content directly; do NOT call any read_text_file or file-access tools to re-read them unless asked.`,
7272

0 commit comments

Comments
 (0)