Merge pull request #6706 from dan0v/main
fix: include Editor Content description with request
This commit is contained in:
commit
a12ec78077
2 changed files with 3 additions and 3 deletions
|
|
@ -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 (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\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",
|
||||
|
|
|
|||
|
|
@ -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} (${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;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue