This is a small project that using GPT-3.5
API from Open AI to practice JavaScript, Vue.js and modules.
The icon is modified from an SVG provided by ChatGPT.
- Clone the project to your host.
- The project uses
import
method in JavaScript, which requires a web server to function properly. Therefore, it is required to install and configure a web server such as Nginx to run the project.- If using WSL in Windows, and willing to connect from other devices, here is a command for binding the port:
Also do not forget to adjust the inbound rule in Windows Defender Firewall.
netsh interface portproxy add v4tov4 listenport=<port to connect from outside> listenaddress=<ip from outside like 0.0.0.0> connectport=<port listening on WSL> connectaddress=<WSL IP like 172.20.x.x>
- If using WSL in Windows, and willing to connect from other devices, here is a command for binding the port:
- Assign the directory of the project as the root directory of the web.
- Start the web server and configure it to listen on a port. Then the project will be accessible at the port on your host such as
localhost:80
.
- Oepn /JS/modules/key.js.
- Replace the text
OPENAI-API-KEY
to your own key.
- Edit /JS/config.js.
- Add the paths of the module you want to use to
mod_paths
object, following the format"module_name": "module_path"
. You can also add your own module. This is a template of a module with the supported parameters:export const system = { "role": "system", "content": `You are a ICS converter. You output plain text in ICS format according to user input messages without other text. You give a ICS file content of one event in each message. You have to give a summary. You should add the location and URL information if possible. You do not translate summary or memo or anything. If there are no information about year, consider as ${new Date().getFullYear()}.` }; export const logit_bias = { "5297" : -0.5, "2949" : 0.5 }; export const temperature = 0; /* defualt to 0.5 in this project */ export const frequency_penalty = 2; export const presence_penalty = 2;
- system: Edit the
content
to tell the AI what should do. - logit_bias: Use this field to maake AI output more or less of certain tokens. The key must be a non-negative number representing a token, and the value should be between -100 and 100. Higher value make the AI use the token more frequently. Tokens of GPT-3 can be found using the tokenizer which is a Python package provided by Open AI.
- For More information on other parameters, see official documentation.
- system: Edit the
- Open the URL (such as
localhost:80
) of your service in a web browser. - Select a mod and click on
Confirm
button. There will be an alert to let you know that the mod is loaded. - Input some text in the
User Input
textarea. - Click on submit or press
Enter
key (useshift
+Enter
to break the line). - If the request gets a proper response, the browser will alert
OK
, and the content from the AI will be appended under the textarea. - If the request gets an error, the browser will alert
Error: status - status text
orError
if can not get the HTTP status.- You can also click on
Cancel
button while waiting for too long, and after theError
alert, you can submit again.
- You can also click on
- You can submit the next message whether the last one got
OK
or not. If the last message gotOK
, both the user input and the AI's response will be appended to the messages. Otherwise, the last user input will be delete. - You can change the mod at any time, but the messages will be cleared while you click the
Confirm
button.
You can report bugs or make feature requests through the issue, or fork the project and make your own version.
To report the bugs, please use the bug
tag.
To request new features, please use the enhancement
tag.