Jump to content
Main menu
Main menu
move to sidebar
hide
Navigation
Main page
Recent changes
Random page
freem
Search
Search
Appearance
Create account
Log in
Personal tools
Create account
Log in
Pages for logged out editors
learn more
Contributions
Talk
Editing
Openai/691151cc-3da4-800f-9b7c-81b0e0d10369
(section)
Add languages
Page
Discussion
English
Read
Edit
Edit source
View history
Tools
Tools
move to sidebar
hide
Actions
Read
Edit
Edit source
View history
General
What links here
Related changes
Special pages
Page information
Appearance
move to sidebar
hide
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
===== - 「カーソル位置に追加」と明示することで AI に意図を伝える ===== * 「既存のコードを壊さないように」と加えることで安全性を確保 * コメントや補完など柔軟に提案させたい場合は、「コメントも含めて」と明記する ==== <syntaxhighlight lang="java">// AI サーバーに送信する JSON を作成 ==== Gson gson = new Gson(); Map<String, Object> payload = new HashMap<>(); payload.put("model", "gpt-local"); String instruction = "以下のJavaコードのカーソル位置に、適切なソースコードやコメントを追加してください。" + "既存のコードを壊さず、最適な補完を提案してください。"; payload.put("prompt", instruction + "\n\nコード:\n" + sourceCode); payload.put("max_tokens", 200); </syntaxhighlight> * これで AI は「どのように補完すればよいか」を理解しやすくなります。 💡 補足 * 必要であれば、さらに 「Java のスタイルに従って」「例外処理も考慮して」 と指示を追加することで、より自然で安全な補完が返ってきます。 * Prompt は柔軟に調整可能です。AI の応答を見ながら指示を微調整すると、精度が上がります。 希望であれば、私は AISuggestHandler の完全版 をこの指示付きプロンプトに組み込んで、カーソル位置に補完を挿入する形で書き換えることができます。 作りますか?
Summary:
Please note that all contributions to freem are considered to be released under the Creative Commons Attribution-ShareAlike 4.0 (see
Freem:Copyrights
for details). If you do not want your writing to be edited mercilessly and redistributed at will, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource.
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)