Skip to content

Commit a12ec78

Browse files
authored
Merge pull request #6706 from dan0v/main
fix: include Editor Content description with request
2 parents 33fa558 + e9211bb commit a12ec78

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

gui/src/components/mainInput/TipTapEditor/utils/processEditorContent.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ describe("processEditorContent", () => {
189189
expect(result.parts).toEqual([
190190
{
191191
type: "text",
192-
text: "Check this code:\n\n```js example.js\nfunction test() {\n return 'hello';\n}\n```\n",
192+
text: "Check this code:\n\n```js example.js (1-1)\nfunction test() {\n return 'hello';\n}\n```\n",
193193
},
194194
]);
195195
expect(result.selectedCode).toHaveLength(1);
@@ -347,7 +347,7 @@ describe("processEditorContent", () => {
347347
expect(result.parts).toEqual([
348348
{
349349
type: "text",
350-
text: "Please explain this code and also check @related\n\n```ts script.ts\nconst x = 42;\n```\n\nWhat does this constant do?",
350+
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?",
351351
},
352352
{
353353
type: "imageUrl",

gui/src/components/mainInput/TipTapEditor/utils/processEditorContent.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ export function processEditorContent(editorState: JSONContent) {
9696
rif.filepath,
9797
window.workspacePaths ?? [],
9898
);
99-
const codeText = `\n\`\`\`${extension} ${relativePathOrBasename}\n${contextItem.content}\n\`\`\`\n`;
99+
const codeText = `\n\`\`\`${extension} ${relativePathOrBasename} (${rif.range.start.line + 1}-${rif.range.end.line + 1})\n${contextItem.content}\n\`\`\`\n`;
100100

101101
if (parts[parts.length - 1]?.type === "text") {
102102
(parts[parts.length - 1] as TextMessagePart).text += "\n" + codeText;

0 commit comments

Comments
 (0)