Skip to content

Commit

Permalink
Merge pull request #21 from Iheuzio/dev
Browse files Browse the repository at this point in the history
Release 0.1.3
  • Loading branch information
Iheuzio authored Jun 25, 2023
2 parents 15283f0 + fd56052 commit dfc76f2
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 12 deletions.
20 changes: 13 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,19 @@ Submit -> Submits the query to the api

Refresh -> refreshes the window so that all new files will be available for that session.

User must ctrl+shift+p and click on the `Open GPT Context Panel` option and then add files (before or after), then input the question.
- 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.
- Select the files uses checkboxes
- After submit is pressed, wait until the question disappears, this means the query is processed by openai and was fully sent
- Click `API Response` to view your query

# Examples

Demo of how to use the extension:
![](./images/demo-program.gif)

# 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:

```
Expand All @@ -40,14 +49,11 @@ c:\dev\test\gpt-contextfiles-test\program.js:
\```
window.alert("Hello World!")
\```
```

Functions based on the principle of files passed into it
```
Selected Files:
[x] c:\dev\test\gpt-contextfiles-test\program.js
[ ] c:\dev\test\gpt-contextfiles-test\program2.js
```

Expected Ouput:

`
The window.alert() method is a built-in JavaScript function that displays an alert box with a specified message and an OK button. In this case, the message is "Hello World!".
`
9 changes: 6 additions & 3 deletions extension.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,7 @@ async function handleQuestionSubmission(panel, question, selectedUris) {
model: "gpt-3.5-turbo-16k",
messages: [
{ role: "system", content: "Answer the coding questions, only provide the code and documentation, explaining the solution after providing the code." },
{ role: "user", content: question },
{ role: "assistant", content: fileContents }
{ role: "user", content: question + "\n" + fileContents},
],
});

Expand Down Expand Up @@ -445,7 +444,7 @@ function getWebviewContent(apiResponse = '', question = '') {
${
apiResponse ? `
<div id="rendered">
<p>${apiResponse}</p>
<p id="responses">${apiResponse}</p>
</div>
` : null
}
Expand Down Expand Up @@ -481,6 +480,10 @@ function getWebviewContent(apiResponse = '', question = '') {
function toggleApiResponse() {
const apiResponse = document.getElementById('api-response');
var response = document.getElementById('responses');
if(response === null || response === 'null') {
return;
}
apiResponse.classList.toggle('active');
const content = apiResponse;
const collapsible = apiResponse.previousElementSibling;
Expand Down
Binary file added images/demo-program.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "gpt-contextfiles",
"displayName": "GPT-ContextFiles",
"description": "Choose the files to pass into GPT to provide a question with multiple files (doesn't check context)",
"version": "0.1.2",
"version": "0.1.3",
"engines": {
"vscode": "^1.79.0"
},
Expand Down Expand Up @@ -67,7 +67,7 @@
"menus": {
"explorer/context": [
{
"when": "resourceLangId == javascript",
"when": "resourceIsFolder == false",
"command": "extension.addFilesToGPTContext",
"group": "navigation"
}
Expand Down

0 comments on commit dfc76f2

Please sign in to comment.