Skip to content

Commit

Permalink
Update README about Offline mode.md
Browse files Browse the repository at this point in the history
  • Loading branch information
AliDehbansiahkarbon authored Apr 3, 2024
1 parent 715c058 commit 75b9a22
Showing 1 changed file with 67 additions and 24 deletions.
91 changes: 67 additions & 24 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@

<h2>An AI plug-in for Embarcadero RAD Studio IDE.</h2>

<h3>First Plugin Ever to support ChatGPT, Writesonic, and YouChat!</h3>
<h3>First Plugin Ever to support Online(ChatGPT, Writesonic, and YouChat) and Offline(Ollama) AI servers!</h3>

#### **PLEASE NOTE THAT You will need an API key to use this plugin. see the [API section](#platforms) 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
#### **PLEASE NOTE THAT You will need an API key (just in Online mode) to use this plugin. see the [API section](#platforms) to Generate an API key**
#### Some API Keys are Limited to a certain usage, after that, you will need to purchase credits to keep using them.


## Key Features:
Expand All @@ -34,13 +34,14 @@
- 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 !
- 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](https://writesonic.com/chat) AI as the second AI service.
- Supports [YouChat](https://you.com/code) AI as the third AI service.
- Supports [Ollama(Offline)](https://ollama.com)

<br />

Expand All @@ -52,6 +53,48 @@ For more information, please refer to the Terms of Use defined by OpenAI: [Terms

<be />

# 🟢🟢🟢 How to use it in Offline mode 🟢🟢🟢

<details>
<summary>
🟢 setup an Offline AI server
</summary>

In order to use this plug-in with a local host follow these steps:


1- Download and Install Ollama : [here](https://ollama.com)
2- Check if the server is running by opening this in your browser: http://localhost:11434
You should see something like this:
![Screenshot 2024-04-02 094238](https://github.com/AliDehbansiahkarbon/ChatGPTWizard/assets/5601608/72eb4b84-7971-4354-bcc8-dd8c3818d3ad)

3- Then you need at least one trained model to be attached to your new AI server, there are a lot of models [here](https://ollama.com/library), so choose one (codellama is a good one, I suggest that for now) and install it with this command in command-line:
```
ollama run codellama
```
![Screenshot 2024-04-02 094133](https://github.com/AliDehbansiahkarbon/ChatGPTWizard/assets/5601608/d72a4775-c95d-47fa-b3a0-f2ef8ce027b5)

After pulling the model is finished you can ask some questions in CMD right away.

4- Now use this URL instead of OpenAPI's URL in the setting form of the Plugin in RAD Studio:
```
http://localhost:11434/api/generate
```

You don't need an Accesskey, no need to change or even clear it, just leave it.

5- tick the checkbox called Ollama(Offline) and add your model name in the text box in front of the checkbox, in my case, I use "codellama" as the model name.

6- Congratulations! you did it, now enjoy forever free AI assistance.

Note: depending on the hardware resources, the model size, and the parameter count of the model you can experience different speeds and performance, **so do not open any issues about the Offline solution's speed or performance**, there is nothing to do about that with the Plug-in itself, Plug-in is just a bridge between AI server and RAD Studio.

Good luck!

</details>

<br />

## Demo

Short1(all features)
Expand Down Expand Up @@ -90,10 +133,10 @@ This Plugin Supports the following AI Services:

## Remarks

- This plugin is free but some AI Services are not free for ever.
- This plugin is free but some AI Services are not free forever.
- 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](https://github.com/onryldz/x-superobject/blob/master/XSuperObject.pas)
- Settings are stored in registry which can be found here: `Computer\HKEY_CURRENT_USER\Software\ChatGPTWizard`
- Uses the XSuperObject library which is included in the project files. you can also find the latest version [here](https://github.com/onryldz/x-superobject/blob/master/XSuperObject.pas)
- Settings are stored in the registry which can be found here: `Computer\HKEY_CURRENT_USER\Software\ChatGPTWizard`

<br />

Expand All @@ -113,7 +156,7 @@ This Plugin Supports the following AI Services:
### **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).
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).

<br />

Expand All @@ -126,7 +169,7 @@ Click on the newly added ChatGPT menu on the IDE(or press Ctrl+Shidt+Alt+C) to o

**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.
So now you can get multiple different answers based on any question, compare, merge, and get the best quality and accuracy for your code.

<br />

Expand All @@ -153,7 +196,7 @@ If you need to use the ChatGPT inside the editor you need to type a question dir

**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,
Open a new `vcl` application 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`
Expand Down Expand Up @@ -183,17 +226,17 @@ Use the **"ChatGPT Dockable"** menu from the main menu to show the dockable form

## 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 `{}`
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.
- Add Test - Will try to create a 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.
- Explain code - will explain what the selected code does in Delphi.

<br />
<br />
Expand All @@ -209,12 +252,12 @@ Context Menu for Selected text or a block of code. The Result will be inserted a

## 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.
Using the class view you have your class list with some functionalities 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't 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.
Please note that it is best to use this feature for small classes. due to API limitations, you cannot send a class with several thousand lines of code in a question.

<br />

Expand All @@ -224,8 +267,8 @@ Please mind that it is best to use this feature for small classes. due to API li

## 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.
History is available if you enable it in the setting form, it's using SQLite as a simple file-based 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 it to the folder in the setting.

<br />

Expand All @@ -240,7 +283,7 @@ You can find an empty database in `Resource\DB` that named `"History.sdb"`, copy

## 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
Right-click on the History grid and check the search item in the search bar that appears, it's not visible 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.

<br />
Expand All @@ -259,7 +302,7 @@ to search and filter, there are two checkboxes as extra options like case sensit

## 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`)
This issue can be fixed if you put SSL libraries(can find them in the resource folder) alongside the `bds.exe` or in the 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.

Expand All @@ -282,8 +325,8 @@ Another thing is, You don't have to do that because it will work fine when you o

<br />

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!
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 tuned with the latest updates, debugs, features, etc.
All PRs, discussions, and issues are welcome but please read and check the closed issues before opening a new one to avoid duplicates!

**Good luck!**
<hr>
Expand Down

0 comments on commit 75b9a22

Please sign in to comment.