Merge pull request #30 from Iheuzio/dev

Release 0.2.1
This commit is contained in:
Iheuzio 2023-06-26 18:29:11 -04:00 committed by GitHub
commit 7744e9e49e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 52 additions and 61 deletions

View File

@ -1,5 +1,7 @@
# gpt-contextfiles # gpt-contextfiles
![gpt-contextfiles viewport](extension.png)
> if you'll like to contribute or provide any feedback check out the [link](https://github.com/Iheuzio/gpt-contextfiles/issues) > if you'll like to contribute or provide any feedback check out the [link](https://github.com/Iheuzio/gpt-contextfiles/issues)
This extension uses the openai api, there are many models avaliable: This extension uses the openai api, there are many models avaliable:
@ -28,13 +30,15 @@ Submit -> Submits the query to the api
Refresh -> refreshes the window so that all new files will be available for that session. Refresh -> refreshes the window so that all new files will be available for that session.
Click -> Click the orange code and then paste it in your editor for fast coding
- Right click to add files to the context window - Right click to add files to the context window
- Click on the extension addon to open the context window, refresh to update the files to check. - Click on the extension addon to open the context window, refresh to update the files to check.
- Select the files uses checkboxes - Select the files uses checkboxes
- Wait for response to be returned - Wait for response to be returned
Other features:
![Copy button demonstration](copy-image.png)
- Click copy to to copy the snippet of code into your file for fast coding
# How it works # How it works
We can select two files we want to pass through, however we can uncheck one of them for later debugging and enter our question: We can select two files we want to pass through, however we can uncheck one of them for later debugging and enter our question:

View File

@ -193,7 +193,7 @@ function getWebviewContent(apiResponse = '', question = '') {
flex-direction: column; flex-direction: column;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
width: 50%; width: 90%;
height: 100%; height: 100%;
margin: 0 auto; margin: 0 auto;
background-color: #1e1e1e; background-color: #1e1e1e;
@ -418,17 +418,41 @@ function getWebviewContent(apiResponse = '', question = '') {
} }
#code-block { #code-block {
padding: 0; padding: 10px 0 10px 10px;
background: none; padding-
border-radius: 5px;
background-color: black;
border: none; border: none;
font: inherit; font: inherit;
color: inherit; color: inherit;
cursor: pointer; cursor: pointer;
outline: inherit; outline: inherit;
margin: 0;
width: 100%; width: 100%;
text-align: left; text-align: left;
display: inline-block;
position: relative;
} }
#copy-button {
padding: 5px;
border-radius: 5px;
background-color: #007acc;
border: none;
font: inherit;
color: #fff;
cursor: pointer;
outline: inherit;
margin: 5px;
position: absolute;
top: 0;
right: 0;
}
#copy-button:hover {
background-color: #fff;
color: #000;
}
</style> </style>
</head> </head>
@ -455,7 +479,7 @@ function getWebviewContent(apiResponse = '', question = '') {
apiResponse ? ` apiResponse ? `
<div id="rendered"> <div id="rendered">
<p id="responses"> <p id="responses">
<pre id="response">${apiResponse.replace(/```([^```]+)```/g, '<button onclick="copyCode()" id="code-block"><code>$1</code></button>')}</pre> <pre id="response">${apiResponse.replace(/```([^```]+)```/g, '<div id="code-block"><code>$1</code><button onclick="copyCode(event)" id="copy-button">copy</button></div>')}</pre>
</p> </p>
</div> </div>
` : null ` : null
@ -476,13 +500,12 @@ function getWebviewContent(apiResponse = '', question = '') {
toggleApiResponse(); toggleApiResponse();
} }
function copyCode() { function copyCode(event) {
event.preventDefault(); event.preventDefault();
const codeBlocks = document.getElementsByTagName('code'); const codeBlock = event.target.parentNode.querySelector('code');
const selectedCodeBlock = event.target.closest('code');
if (selectedCodeBlock) { if (codeBlock) {
const codeText = selectedCodeBlock.innerText; const codeText = codeBlock.innerText;
const dummyTextArea = document.createElement('textarea'); const dummyTextArea = document.createElement('textarea');
dummyTextArea.value = codeText; dummyTextArea.value = codeText;
document.body.appendChild(dummyTextArea); document.body.appendChild(dummyTextArea);

BIN
images/copy-image.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.9 MiB

After

Width:  |  Height:  |  Size: 13 MiB

BIN
images/extension.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

BIN
images/gpt-banner.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 43 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.9 KiB

After

Width:  |  Height:  |  Size: 36 KiB

BIN
images/gpt-icon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 97 KiB

4
package-lock.json generated
View File

@ -1,12 +1,12 @@
{ {
"name": "gpt-contextfiles", "name": "gpt-contextfiles",
"version": "0.0.1", "version": "0.2.1",
"lockfileVersion": 3, "lockfileVersion": 3,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "gpt-contextfiles", "name": "gpt-contextfiles",
"version": "0.0.1", "version": "0.2.1",
"dependencies": { "dependencies": {
"openai": "^3.3.0" "openai": "^3.3.0"
}, },

View File

@ -1,8 +1,8 @@
{ {
"name": "gpt-contextfiles", "name": "gpt-contextfiles",
"displayName": "GPT-ContextFiles", "displayName": "GPT-ContextFiles",
"description": "Choose the files to pass into GPT to provide a question with multiple files (doesn't check context)", "description": "Choose the files to pass into GPT to provide a question with multiple files",
"version": "0.2.0", "version": "0.2.1",
"engines": { "engines": {
"vscode": "^1.79.0" "vscode": "^1.79.0"
}, },
@ -22,7 +22,12 @@
"testing", "testing",
"debugging", "debugging",
"files", "files",
"api" "api",
"snippets",
"openai",
"vscode",
"extension",
"chatbot"
], ],
"relatedTags": [ "relatedTags": [
"Artificial Intelligence", "Artificial Intelligence",
@ -115,6 +120,6 @@
"type": "git", "type": "git",
"url": "https://github.com/Iheuzio/gpt-contextfiles/" "url": "https://github.com/Iheuzio/gpt-contextfiles/"
}, },
"icon": "images/gpt-icon.jpg", "icon": "images/gpt-icon.png",
"publisher": "Iheuzio" "publisher": "Iheuzio"
} }

View File

@ -1,41 +0,0 @@
# Welcome to your VS Code Extension
## What's in the folder
* This folder contains all of the files necessary for your extension.
* `package.json` - this is the manifest file in which you declare your extension and command.
* The sample plugin registers a command and defines its title and command name. With this information VS Code can show the command in the command palette. It doesnt yet need to load the plugin.
* `extension.js` - this is the main file where you will provide the implementation of your command.
* The file exports one function, `activate`, which is called the very first time your extension is activated (in this case by executing the command). Inside the `activate` function we call `registerCommand`.
* We pass the function containing the implementation of the command as the second parameter to `registerCommand`.
## Get up and running straight away
* Press `F5` to open a new window with your extension loaded.
* Run your command from the command palette by pressing (`Ctrl+Shift+P` or `Cmd+Shift+P` on Mac) and typing `Hello World`.
* Set breakpoints in your code inside `extension.js` to debug your extension.
* Find output from your extension in the debug console.
## Make changes
* You can relaunch the extension from the debug toolbar after changing code in `extension.js`.
* You can also reload (`Ctrl+R` or `Cmd+R` on Mac) the VS Code window with your extension to load your changes.
## Explore the API
* You can open the full set of our API when you open the file `node_modules/@types/vscode/index.d.ts`.
## Run tests
* Open the debug viewlet (`Ctrl+Shift+D` or `Cmd+Shift+D` on Mac) and from the launch configuration dropdown pick `Extension Tests`.
* Press `F5` to run the tests in a new window with your extension loaded.
* See the output of the test result in the debug console.
* Make changes to `src/test/suite/extension.test.js` or create new test files inside the `test/suite` folder.
* The provided test runner will only consider files matching the name pattern `**.test.ts`.
* You can create folders inside the `test` folder to structure your tests any way you want.
## Go further
* [Follow UX guidelines](https://code.visualstudio.com/api/ux-guidelines/overview) to create extensions that seamlessly integrate with VS Code's native interface and patterns.
* [Publish your extension](https://code.visualstudio.com/api/working-with-extensions/publishing-extension) on the VS Code extension marketplace.
* Automate builds by setting up [Continuous Integration](https://code.visualstudio.com/api/working-with-extensions/continuous-integration).