From 06acfd721e4f2caa5fcf797372e73125787bed6e Mon Sep 17 00:00:00 2001 From: dan0v Date: Fri, 18 Jul 2025 16:14:42 +0100 Subject: [PATCH 1/3] fix: Include Editor Content description with request --- .../mainInput/TipTapEditor/utils/processEditorContent.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gui/src/components/mainInput/TipTapEditor/utils/processEditorContent.ts b/gui/src/components/mainInput/TipTapEditor/utils/processEditorContent.ts index 0f6f0c0e4..cc655e66e 100644 --- a/gui/src/components/mainInput/TipTapEditor/utils/processEditorContent.ts +++ b/gui/src/components/mainInput/TipTapEditor/utils/processEditorContent.ts @@ -96,7 +96,7 @@ export function processEditorContent(editorState: JSONContent) { rif.filepath, window.workspacePaths ?? [], ); - const codeText = `\n\`\`\`${extension} ${relativePathOrBasename}\n${contextItem.content}\n\`\`\`\n`; + const codeText = `\n\`\`\`${extension} ${relativePathOrBasename} ${contextItem.description}\n${contextItem.content}\n\`\`\`\n`; if (parts[parts.length - 1]?.type === "text") { (parts[parts.length - 1] as TextMessagePart).text += "\n" + codeText; From bf2b76439eb894b48da96bb9c6dc231a82f37732 Mon Sep 17 00:00:00 2001 From: dan0v Date: Fri, 18 Jul 2025 19:26:03 +0100 Subject: [PATCH 2/3] Include description in test expectations --- .../mainInput/TipTapEditor/utils/processEditorContent.test.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gui/src/components/mainInput/TipTapEditor/utils/processEditorContent.test.ts b/gui/src/components/mainInput/TipTapEditor/utils/processEditorContent.test.ts index 891cb2855..930118c8e 100644 --- a/gui/src/components/mainInput/TipTapEditor/utils/processEditorContent.test.ts +++ b/gui/src/components/mainInput/TipTapEditor/utils/processEditorContent.test.ts @@ -189,7 +189,7 @@ describe("processEditorContent", () => { expect(result.parts).toEqual([ { type: "text", - text: "Check this code:\n\n```js example.js\nfunction test() {\n return 'hello';\n}\n```\n", + text: "Check this code:\n\n```js example.js a description\nfunction test() {\n return 'hello';\n}\n```\n", }, ]); expect(result.selectedCode).toHaveLength(1); @@ -347,7 +347,7 @@ describe("processEditorContent", () => { expect(result.parts).toEqual([ { type: "text", - text: "Please explain this code and also check @related\n\n```ts script.ts\nconst x = 42;\n```\n\nWhat does this constant do?", + text: "Please explain this code and also check @related\n\n```ts script.ts a description\nconst x = 42;\n```\n\nWhat does this constant do?", }, { type: "imageUrl", From 91febac73da3b279293928d7ac759099a0968a10 Mon Sep 17 00:00:00 2001 From: dan0v Date: Mon, 4 Aug 2025 18:15:28 +0100 Subject: [PATCH 3/3] Build description from RiF, as elsewhere --- .../mainInput/TipTapEditor/utils/processEditorContent.test.ts | 4 ++-- .../mainInput/TipTapEditor/utils/processEditorContent.ts | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/gui/src/components/mainInput/TipTapEditor/utils/processEditorContent.test.ts b/gui/src/components/mainInput/TipTapEditor/utils/processEditorContent.test.ts index 930118c8e..6786e43b7 100644 --- a/gui/src/components/mainInput/TipTapEditor/utils/processEditorContent.test.ts +++ b/gui/src/components/mainInput/TipTapEditor/utils/processEditorContent.test.ts @@ -189,7 +189,7 @@ describe("processEditorContent", () => { expect(result.parts).toEqual([ { type: "text", - text: "Check this code:\n\n```js example.js a description\nfunction test() {\n return 'hello';\n}\n```\n", + text: "Check this code:\n\n```js example.js (1-1)\nfunction test() {\n return 'hello';\n}\n```\n", }, ]); expect(result.selectedCode).toHaveLength(1); @@ -347,7 +347,7 @@ describe("processEditorContent", () => { expect(result.parts).toEqual([ { type: "text", - text: "Please explain this code and also check @related\n\n```ts script.ts a description\nconst x = 42;\n```\n\nWhat does this constant do?", + text: "Please explain this code and also check @related\n\n```ts script.ts (1-1)\nconst x = 42;\n```\n\nWhat does this constant do?", }, { type: "imageUrl", diff --git a/gui/src/components/mainInput/TipTapEditor/utils/processEditorContent.ts b/gui/src/components/mainInput/TipTapEditor/utils/processEditorContent.ts index cc655e66e..4801c853f 100644 --- a/gui/src/components/mainInput/TipTapEditor/utils/processEditorContent.ts +++ b/gui/src/components/mainInput/TipTapEditor/utils/processEditorContent.ts @@ -96,7 +96,7 @@ export function processEditorContent(editorState: JSONContent) { rif.filepath, window.workspacePaths ?? [], ); - const codeText = `\n\`\`\`${extension} ${relativePathOrBasename} ${contextItem.description}\n${contextItem.content}\n\`\`\`\n`; + const codeText = `\n\`\`\`${extension} ${relativePathOrBasename} (${rif.range.start.line + 1}-${rif.range.end.line + 1})\n${contextItem.content}\n\`\`\`\n`; if (parts[parts.length - 1]?.type === "text") { (parts[parts.length - 1] as TextMessagePart).text += "\n" + codeText;