/ChatGPTWizard

A ChatGPT, WriteSonic, and YouChat plug-in for Embarcadero RAD Studio IDE 10.1 and later versions.

Primary LanguagePascalMIT LicenseMIT

ChatGPTWizard


Delphi   Buy Me A Coffee
license forks stars watchers issues
pulls last-commit Downloads

An AI plug-in for Embarcadero RAD Studio IDE.

First Plugin Ever to support ChatGPT, Writesonic, and YouChat!

PLEASE NOTE THAT You will need an API key to use this plugin. see the API section to Generate an API key

Some API Keys are Limited to a certain usage, after that you will need to purchase credits in order to keep using them

Key Features:

  • Free text question form.
  • Dockable question form.
  • Inline questions(in the editor).
  • Context menu options to help you to find bugs, write tests, optimize code, add comments, etc...
  • Class view(Code conversion, code optimizing, test units, and other options per class).
  • Predefined Questions for class view.
  • History to save your tokens on OpenAI !
  • Fuzzy string match searches in the history.
  • Animated letters(Like the website).
  • AI Code Translator
  • Proxy server options.
  • Supports Writesonic AI as the second AI service.
  • Supports YouChat AI as the third AI service.

Demo

Short1(all features)

Short2(ChatGPT, Writesonic, and YouChat actions at the same time)

Long


Platforms

This Plugin Supports the following AI Services:

generate API Key here

generate API Key here

generate API Key here

NOTE: ChatGPT is working with Rad Studio 10.1 and above but Other(non-ChatGPT) AI Services are enabled in Rad Studio 10.2 and above!

Remarks

  • This plugin is free but some AI Services are not free for ever.
  • It's compatible with Delphi 10.1 Berlin and later versions.
  • Uses XSuperObject library which is included in the project files. you can also find the latest version here
  • Settings are stored in registry which can be found here: Computer\HKEY_CURRENT_USER\Software\ChatGPTWizard

How to Install

1- Getit package manager

2- Delphinus package manager - you can install Delphinus package manager and install ChatGPTWizard there. (Delphinus-Support)

3- Direct installation - Open the project in Delphi, right-click on the project node in the project manager, build, and install.


How to Use

Plug-in's main form

You can use the ChatGPT menu from the IDE's main menu directly to ask questions and get the answer. Click on the newly added ChatGPT menu on the IDE(or press Ctrl+Shidt+Alt+C) to open the wizard, type the question and press the Ask button(or Ctrl+Enter).


how-to-use1 how-to-use2

Two New Tabs has been added to get separate results for Writesonic and YouChat.

So now you are able to get multiple different answers based on any question, compare, merge and get the best quality and accuracy for your code.


image


Settings

"Other AI Services" Tab is responsible for setting up Other AI service's tokens including Writesonic's credentials.


image


Inline Questions

If you need to use the ChatGPT inside the editor you need to type a question directly inside the code editor and surround it with cpt: at the beginning and :cpt at the end of the question then press Ctrl+Shift+Alt+A or simply select "Ask" from the editor's context menu by right-clicking on the selected text.

Usage Scenario for Inline Questions

Open a new vcl applicatiopn project, add a new unit and remove all the code from it! and type the following line, select all and press Ctrl+Shift+Alt+A.

cpt:Create a full unit in Delphi including a class to create an XML file.:cpt


Dockable Form


dockable-form1 dockable-form2

Use the "ChatGPT Dockable" menu from the main menu to show the dockable form and try to dock the form to the left or right side panel of the IDE, and enjoy with your new Google killer assistant!


Context Menu

Context Menu for Selected text or a block of code. The Result will be inserted after the selected text as a multi line comment between two brackets {}

Options

  • Ask
  • Add Test - Will try to create unit test for the selected text.
  • Find Bugs - Find fugs in the selected text.
  • Optimize - Will Optimize the selected text.
  • Add Comments - Will add necessary comments to the selected code.
  • Complete code - Will try to add any missing code to the selected code.
  • Explain code - will explain that what does the selected code in Delphi.


image


image_2023-04-25_16-08-40


Class View

Using the class view you have your class list with some functionalitis in a popup menu. It is also possible to use your custom command based on the selected class in the TreeView, in this case @Class will represent the selected class in your custom command, if you don's use @Class the selected class' source will be attached to the end of your command, just pay attention there will be some limitations, because at the moment it's not possible to send thousands of lines through the API request.

Please mind that it is best to use this feature for small classes. due to API limitation you cannot send a class with several thousand lines of code in a question.


image


History

History is available if you enable it in the setting form, it's using SQLite as a simple file base database. You can find an empty database in Resource\DB that named "History.sdb", copy this file to any place in the disk and address to the folder in the setting.


image


image


Search in History

Right click on the History grid and check search item to the search bar appears, it's not visibile by default to save some space, finally type the keyword to search and filter, there are two checkboxes as extra options like case sensitive and fuzzy match string search.


image


image


image


Issues with SSL

This issue can be fixed if you put SSL libraries(can find them in the resource folder) alongside the bds.exe or in Bpl folder(mine is C:\Users\Public\Documents\Embarcadero\Studio\22.0\Bpl) or you can use a build event on the project's properties to copy these two class libraries if they don't exist. Another thing is, You don't have to do that because it will work fine when you open any project in the IDE before using this plugin! I'm not sure that this behavior depends on the installed components or libraries or if the IDE loads SSL libraries at the moment you open even a new application. although using the plugin when you are working on a project seems more useful anyways.


Miscellaneous

Presentation: ChatGPT wizard.pptx


Contributors

Special Thanks to


Do not hesitate to star! if you like it take a leap of faith, and hit that 'Star' button, also watch the repository to stay tune with the latest updates, debugs, features, and etc. All PRs, disscutions, and issues are welcome but please read check the closed issues before opening a new one to avoid duplicates!

Good luck!


Delphi

Made with ❤️ on Delphi