Skip to content

Commit

Permalink
Update v1.1.0 - Check Updates section of readme for more
Browse files Browse the repository at this point in the history
  • Loading branch information
bajrangCoder committed Jun 14, 2023
1 parent 7f37731 commit ba80e85
Show file tree
Hide file tree
Showing 5 changed files with 60 additions and 19 deletions.
2 changes: 1 addition & 1 deletion dist/main.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion plugin.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"id": "acode.plugin.chatgpt",
"name": "Chat GPT",
"main": "dist/main.js",
"version": "1.0.9",
"version": "1.1.0",
"readme": "readme.md",
"icon": "icon.png",
"files": [
Expand Down
15 changes: 13 additions & 2 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,20 @@ Chat GPT
> **⚠️ Important note**
If you face any issue or error or you want to report bugs, Please report these things in github repo of this plugin with a detailed description. Hope you understand ❤️❤️

**Chat GPT** is an advanced artificial intelligence developed by [OpenAi](https://openai.com/) and we have added it in form of plugin for **Acode**, developed to enhance your productivity while coding. With this plugin, you can communicate with an AI-powered virtual assistant that can remember your previous responses, provide contextual suggestions, and offer helpful solutions to your coding problems.
**Chat GPT** is an advanced artificial intelligence developed by [OpenAi](https://openai.com/) and we have added it in form of plugin for **Acode**, developed to enhance your productivity while coding. With this plugin, you can communicate with an AI-powered virtual assistant that can remember your previous responses, provide contextual suggestions, and offer helpful solutions to your coding problems. You can also ask Acode related doubt and problems.

<details>
<summary>Updates 🤩🤩</summary>
<details>
<summary>
<code><strong>v1.1.0</strong></code>
</summary>
<ul>
<li>Improved chatting experience</li>
<li>internal improvement and added a shortcut to open chatgpt - <kbd>Ctrl-Shift-C</kbd></li>
<li>Now you can also ask doubt related to Acode to Chatgpt</li>
</ul>
</details>
<details>
<summary>
<code><strong>v1.0.9</strong></code>
Expand Down Expand Up @@ -123,6 +133,7 @@ Features
- View Chat History
- Syntax highlighting and markdown styling, etc
- Generate images with your prompts
- Can answer to doubt related to Acode

### Important Links
- [Github Issue Page](https://github.com/bajrangCoder/acode-plugin-chatgpt/issues)
Expand All @@ -131,7 +142,7 @@ Features
- [Acode](https://acode.foxdebug.com)

## How to use:
To use Chat GPT, simply search for `"Chat GPT"` in the **command palette (•••)** to open the chat interface. From there, you can communicate with the AI and receive helpful suggestions and solutions.
To use Chat GPT, simply search for `"Chat GPT"` in the **command palette (•••)** to open the chat interface or use this shortcut <kbd>Ctrl-Shift-C</kbd>. From there, you can communicate with the AI and receive helpful suggestions and solutions.

To update your token, simply type `"Chat GPT update token"`.

Expand Down
56 changes: 43 additions & 13 deletions src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,35 @@ const AI_HISTORY_PATH = window.DATA_STORAGE + "chatgpt";

let CURRENT_SESSION_FILEPATH = null;

const SYSTEM_PROMPT = `You are ChatGPT, a large language model trained by OpenAI.
Currently you are on an mobile code editor name - Acode(developed by Ajitkumar - https://github.com/deadlyjack).
this code editor try to give vs code like features on mobile device, it also supports plugin for more features and customisation.
You are on acode app via a plugin name ChatGpt , this Plugin is developed by Raunak Raj(core dev https://github.com/bajrangCoder) and Mayank Sharma(https://github.com/mayank0274) with ❤️.
Raunak Raj is also known by his username/brand - bajrangCoder,
He is from India and he is 17 years old student but a passionated self-taught developer.
Mayank Sharma is also from India and He is also a college student.
This chatgpt plugin is open source and Many contributers also contributed in this plugin, namely - legendSabbir and PatAbah.
Some Acode features are: user friendly, able to edit many types of file, there dozen of themes available, code highlighting, linting, formatting and many more.
On Acode you can run python, javascript, html, Markdown and many more.
for running Python there are multiple ways:
1st way(for begginers):
Use Python Plugin, you can download it from Acode App > Settings > Plugins > And search for Python plugin, but there is one limitations in Python plugin that you can't download any external module.
2nd way(for beginners):
Use Basic Online Compiler, basically it runs code through a api , so it has also limitations, for downloading it Acode App > settings > and search by its name and read it description for more details.
3nd way(most useful way and for both advance and noramal user)
use AcodeX plugin basically its a terminal emulator, that uses termux in backend
and you can run many Programming language using AcodeX
If you want error detection while coding then use either Ace Linter or Lint Plugin
If you have recently instaled acode and don't get any snippets etc then you will need to download plugin for these, Use Snippet plugin to get Autocompletion,
And there 60+ Plugins available in acode.
Some frequently asked questions by Acode user:
Q) Please help, I am stuck! My code is not working!
If you want help with your code or you want to discuss why your code is not working please join our telegram group t.me/foxdebug_acode. You can report issue, request new feature and discuss about issues in the group.
Q) How to develop plugin for Acode?
If you want to develop plugin for acode then check out acode.foxdebug.com (official website of acode) here you can find documentation.
or follow this youtube video: https://youtu.be/ls--txHX3RQ
And you also warn the user if they use you for unwanted purpose, for token saving. Follow the user's instructions carefully. Always respond in markdown formate.`;

class Chatgpt {

async init($page) {
Expand Down Expand Up @@ -51,6 +80,7 @@ class Chatgpt {
editor.commands.addCommand({
name: "chatgpt",
description: "Chat GPT",
bindKey: {win: 'Ctrl-Shift-C'},
exec: this.run.bind(this),
});

Expand Down Expand Up @@ -549,23 +579,23 @@ class Chatgpt {
try {
// get all gptchat element
const responseBox = Array.from(document.querySelectorAll(".ai_message"));
// remake an prompt array
const arrMessage = this.$promptsArray > 0 ?
this.$promptsArray.map(({ prevQuestion, prevResponse }) => ({
role: "system",
content: "You are ChatGPT, a large language model trained by OpenAI. Currently you are on an mobile code editor name - Acode(developed by Ajitkumar - https://github.com/deadlyjack). this code editor try to give vs code like features on mobile device, it also supports plugin for more features and customisation. You are on acode app via a plugin name ChatGpt , this Plugin is developed by Raunak Raj(core dev https://github.com/bajrangCoder) and Mayank Sharma(https://github.com/mayank0274) with ❤️, And ypu also warn the user if the use you unwanted for token saving. Follow the user's instructions carefully. Respond using markdown."
}, {
role: "user",
content: prevQuestion
}, {
role: "assistant",
content: prevResponse
})) : [{ role: "user", content: question }];
// remake an prompt array
const arrMessage = this.$promptsArray.length === 0 ?
[
{ role: "system", content: SYSTEM_PROMPT},
{ role: "user", content: question}
] : [
{ role: "system", content: SYSTEM_PROMPT },
...this.$promptsArray.slice(Math.max(this.$promptsArray.length - 3, 0)).flatMap(obj => [
{ role: "user", content: obj.prevQuestion },
{ role: "assistant", content: obj.prevResponse }
]),
{ role: "user", content: question}
];
const res = await this.$openai.createChatCompletion({
model: "gpt-3.5-turbo",
messages: arrMessage,
temperature: 0,
max_tokens: 3000,
})
// remove dot loader
clearInterval(this.$loadInterval);
Expand Down

0 comments on commit ba80e85

Please sign in to comment.