Skip to content

Inspired by GitHub Copilot, this plugin adds AI-powered interaction capabilities to the Delphi IDE

License

Notifications You must be signed in to change notification settings

Code4Delphi/Delphi-AI-Developer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Delphi AI Developer (Copilot)

Inspired by GitHub Copilot, Delphi AI Developer is a plugin that adds Artificial intelligence (AI) interaction capabilities to the Delphi IDE, using both the OpenAI API, Gemini API and Groq API, as well as offering offline AI support.

With Delphi AI Developer, you will have assistance in generating and refactoring code, facilitating and accelerating development.

Receive suggestions for creating and improving code directly in the IDE and take advantage of the possibility of creating predefined questions to speed up your searches.

📞 Contacts

       

🚀 INSTALLATION

1 - Download Delphi AI Developer. You can download the .zip file or clone the project on your PC. image

2 - In your Delphi, access the menu File > Open and select the file: Package\DelphiAIDeveloper.dpk

image

3 - Right-click on the project name and select "Install"

image

4- The "AI Developer" item will be added to the IDE's MainMenu

image


⚙️ PLUGIN SETTINGS

Access the menu “AI Developer” > “Settings” > Tab “Preferences” image

  1. Language used in questions: Indicate in which language you will ask questions in chats, so that the prompts generated by the Plugin are generated in the same language.
  2. AI default (Chat and Databases Chat): Default AI when starting the IDE.
  3. Color to highlight Delphi/Pascal code: Color to highlight Delphi/Pascal/SQL code in responses displayed on chat screens
  4. Default Prompts: Prompts added in this field will be sent to the AIs along with the requests. This can significantly improve the quality of the responses. (Example prompt: Always return SQL commands in lowercase letters)

⚪ CONFIGURING IAS ONLINE

You can choose between 3 APIs, Gemini (Google), ChatGPT (OpenAI) and Groq. Gemini and Groq APIs are free.

Access the menu “AI Developer” > “Settings” > Tab “IAs on-line” image

  1. Inform the desired model.
  2. Click on the "Generate API Key" link to generate your key.
  3. In this field you must enter the API access key.

🟠 CODE COMPLETION

To configure, access the menu “AI Developer” > “Settings” > Tab “Code Completion”

image

  1. Enables/disables use of Code Completion
  2. AI default: Default AI that will be used by Code Completion
  3. Suggestion Code Color: Color code suggested by plugin before being accepted
  4. Shortcut to invoke Code Completion usage (requires restart of Delphi IDE)
  5. Default Prompts: Prompts added in this field will be sent to the AIs along with the requests. This can significantly improve the quality of the responses. (Example prompt: Always return SQL commands in lowercase letters)
  • To use it, simply use the configured shortcut keys (default Alt+Enter)
  • To accept the suggestion, simply use the Tab key. delphi-ai-developer-previa-02

🔵 AI CHAT INTERACTING WITH DELPHI IDE

Access the menu “AI Developer” > “Chat” or Ctrl+Shift+Alt+A image

  1. Select the desired AI to be used in the chat
  2. Field where the question/prompt should be added
  3. Field where the AI ​​response will be displayed
  4. Access the menu with pre-registered questions (to register, access the menu: “AI Developer” > “Defaults Questions”)
  5. By checking this option, the AI ​​will only return codes, without inserting comments or explanations.
  6. By checking the "Use current unit code in query" option, the source code of the current unit will be used as a reference for the prompt sent to the AIs. Note: If the current unit has any code selected, only the selected code snippet will be used as a reference, otherwise the entire unit code will be used.
  7. Button that makes the request to the AIs
  8. Insert Selected Text at Cursor: Inserts the selected text into the response, field in the IDE code editor (if there is no selection, use the entire response)
  9. Create new unit with selected code (if there is no selection, use the entire response)
  10. Copy Selected Text (if there is no selection, use the entire response)
  11. Clean all and start a new chat
  12. Opens a menu with additional options

🟣 CHAT FOR DATABASE INTERACTION

  • To register Databases, access the menu “AI Developer” > “Databases Registers” image

  • Generate reference with database

  • Note: This process must always be performed whenever a new field or table is added to the database. image

  • Optional Step: Link Default Database to Project or Project Group image

  • Chat for database

image

  1. Select the desired database
  2. Quick access to the reference generation screen for the selected database
  3. Select the desired AI to be used in the chat
  4. Field where the question/prompt should be added
  5. Button that makes the request to the AIs
  6. Field where the AI ​​response will be displayed
  7. Button to execute the SQL command of the field with the response (field 6)
  8. Grid with the response from the execution of the SQl command
  9. Options for copying or exporting Grid data
  10. Access the menu with pre-registered questions (to register, access the menu: “AI Developer” > “Defaults Questions”)
  11. By checking this option, the AI ​​will only return SQL commands, without inserting comments or explanations.
  12. By checking the "Use current unit code in query" option, the source code of the current unit will be used as a reference for the prompt sent to the AIs. Note: If the current unit has any code selected, only the selected code snippet will be used as a reference, otherwise the entire unit code will be used.
  13. Insert Selected Text at Cursor: Inserts the selected text into the response, field in the IDE code editor (if there is no selection, use the entire response)
  14. Create new unit with selected code (if there is no selection, use the entire response)
  15. Copy Selected Text (if there is no selection, use the entire response)
  16. Clean all and start a new chat
  17. Opens a menu with additional options

🟤 IAS OFF-LINE

To use AI offline, follow these steps:

  1. Install Ollama, which can be found at the following link: https://ollama.com/download
  2. Choose the desired model. This can be done at the following link: https://ollama.com/library image
  3. Open command prompt or terminal and run the command “ollama run <name_model>” and wait for the installation to finish image
  4. To configure, access the menu “AI Developer” > “Settings” > Tab “IAs off-Line“ image

▶️ DEMO VIDEO

We have also created a video with details on how to download, install and use the plugin. The video is in Portuguese (ptBR), but we are providing subtitles and possibly a video in English.


💬 CONTRIBUTIONS / IDEAS / BUG FIXES

Any suggestions or help are welcome. Send us a pull request or open an issue.


⚠️ LICENSE

Delphi AI Developer is free and open-source wizard licensed under the MIT License.