Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

/wirte 在1.75版之後失效 #143

Closed
ymli0215 opened this issue Apr 10, 2024 · 16 comments
Closed

/wirte 在1.75版之後失效 #143

ymli0215 opened this issue Apr 10, 2024 · 16 comments
Assignees
Labels
bug Something isn't working

Comments

@ymli0215
Copy link
Contributor

/write:len/README.md#L1-L12
`` `<-- Here is ``` inside code block
public class Controller {
    public void method() {
        System.out.println("Hello, World!");
    }
}
`` `

上述的內容,在1.73版可以正常執行且寫入到檔案中
但1.75版之後就無法成功,會跳出chat panel,並出現下面的訊息,就是想透過chat來解決問題

You are a top software developer in the world, which can help me to fix the issue. When I use shell-like language and compile the script, I got an error, can you help me to fix it? Origin script: ```devin /write:len/README.md
public class Controller {
public void method() {
System.out.println("Hello, World!");
}
}
`` ` Script with result: #### : Must not change document outside command or undo-transparent action. See com.intellij.openapi.command.WriteCommandAction or com.intellij.openapi.command.CommandProcessor

看到比較有關的log是 : Read access is allowed from inside read-action (see Application.runReadAction())


嘗試把原有內容改成下方內容

`` `devin  <-- Here is ``` inside code block

/write:len/README.md#L1-L12

\`\`\` java
public class Controller {
    public void method() {
        System.out.println("Hello, World!");
    }
}
\`\`\`
`` `

雖然執行結果成功,但是並沒有真的寫文字到指定檔案中..


可以許願讓 /write 可以自動產生不存在的檔案嗎???
這樣可以讓產生test code的情境上更加方便,不用先新增檔案後才能去/write

@phodal phodal self-assigned this Apr 10, 2024
@phodal
Copy link
Member

phodal commented Apr 10, 2024

应该是 bug 了

phodal added a commit that referenced this issue Apr 10, 2024
…andAction for better performance and error handling #143
@phodal phodal added the bug Something isn't working label Apr 10, 2024
phodal added a commit that referenced this issue Apr 10, 2024
@phodal
Copy link
Member

phodal commented Apr 10, 2024

@ymli0215 可以从这里下载测试试试:https://github.com/unit-mesh/auto-dev/actions/runs/8626280030

@ymli0215
Copy link
Contributor Author

ymli0215 commented Apr 10, 2024

@phodal
感謝迅速處理,/write 已經可以正常寫入內容

希望作者可以加入 針對不存在檔案可以自動產生檔案而不要報錯
謝謝

@phodal
Copy link
Member

phodal commented Apr 10, 2024

@ymli0215 你要的这个功能应该加了,可以试试

@ymli0215
Copy link
Contributor Author

@
@phodal
我知道問題了,這邊回報一下

如果是有資料夾路徑的話

/write:len/test2.java#L1-L12
`` `<-- Here is ``` inside code block
public class Controller {
    public void method() {
        System.out.println("Hello, World!");
    }
}
`` `

他就會報錯誤 Error running 'write.devin' Invalid file name: 'len/test2.java'

但我改成,檔案路徑沒有資料夾

/write:test2.java#L1-L12
`` `<-- Here is ``` inside code block
public class Controller {
    public void method() {
        System.out.println("Hello, World!");
    }
}
`` `

結果會變成產生一個相同檔名的資料夾,然後檔案產生在資料夾下
image

@phodal
Copy link
Member

phodal commented Apr 10, 2024

哦,bug 了,我处理一下,

phodal added a commit that referenced this issue Apr 10, 2024
…#143

Additionally, spike on TypeScript rename behavior in RenameLookupManagerListener.
@phodal
Copy link
Member

phodal commented Apr 10, 2024

前面没处理好,等这个 bug 跑完就可以下载了:https://github.com/unit-mesh/auto-dev/actions/runs/8627964871

@ymli0215
Copy link
Contributor Author

@phodal 回報一下

這版測試,應該是程式中有用 File.separator 來處理,所以導致要分成windows/Mac兩種情況了

  1. /write:test2.java
  • 會在專案目錄下產生test2.java
  1. /write:len\test2.java,len資料夾存在,test2.java不存在
  • 在len資料夾下產生test2.java
  • windows環境要改成\ 才會正常,len/test2.java 會錯
  1. /write:len\test2.java,len資料夾存在,test2.java有存在
  • len\test2.java、len/test2.java 都正常
  1. /write:len2\test2.java,len2資料夾不存在
  • 會產生一個len2資料夾,並產生一個test2.java
  • windows環境要改成\ 才會正常,len2/test2.java 會錯

@phodal
Copy link
Member

phodal commented Apr 10, 2024

@ymli0215 那就只改成 / 方式 ?

@ymli0215
Copy link
Contributor Author

應該可以寫死/了,提供的範例全部都是 /
大家都習慣了,反正windows 在 lookupFile() 丟 len/test.java 也是正常

謝謝

@phodal
Copy link
Member

phodal commented Apr 10, 2024

@phodal
Copy link
Member

phodal commented Apr 10, 2024

没有失败,或者从这里下载:https://github.com/unit-mesh/auto-dev/releases/tag/v1.8.1

我刚好在测试一个 JB 市场的问题。

@ymli0215
Copy link
Contributor Author

回報結果

已經測試完畢,新檔案/新資料夾都可以正常建立了

謝謝

@phodal phodal closed this as completed Apr 10, 2024
@phodal
Copy link
Member

phodal commented Apr 10, 2024

@ymli0215 有新需求,欢迎来 issue

@ymli0215
Copy link
Contributor Author

@phodal
回報一個問題

因為正在嘗試透過 agent 來做一些連續性的流程
下面內容,透過 .devin 可以正常產生出新檔案,test.java不存在的話
但是agent回傳的話,就沒有辦法產生新檔案,如果檔案已經存在的話,就可以正常寫入

/write:len/test.java#L1-L12

`` `java
public class Controller {
    public void method() {
        System.out.println("Hello, World!441");
    }
}


`` `

我是透過nodejs來寫一個agent

app.post("/api/agent/junit", (req, res) => {
    const reqCtx = req.body.messages[0].content;
    
    res.type('text/plain');
    res.send( `
/write:len/test.java#L1-L12

\`\`\`java
public class Controller {
    public void method() {
        System.out.println("Hello, World!441");
    }
}


\`\`\`
`);
});

@phodal
Copy link
Member

phodal commented Apr 10, 2024

新建个 issue? 方便区别,顺便给一下建议?

参考一下这个 example/custom_agent/server.py

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants