Compare commits

...

39 Commits

Author SHA1 Message Date
Andrew 7550b96389 update settings 2024-10-02 00:00:04 -07:00
Andrew Pareles 8aa3282c3d Update CONTRIBUTING.md 2024-10-01 23:24:49 -07:00
Andrew Pareles 9ed68d5fac Update CONTRIBUTING.md 2024-10-01 23:24:19 -07:00
Andrew Pareles 7668d3dee7 Update CONTRIBUTING.md 2024-10-01 23:23:31 -07:00
Andrew Pareles fc65d847c4 Update CONTRIBUTING.md 2024-10-01 23:08:38 -07:00
Andrew Pareles 653d5e9c1f Merge pull request #22 from w1gs/main
Added Ollama integration
2024-10-01 22:26:07 -07:00
Andrew 631f724138 merge ollama 2024-10-01 22:25:16 -07:00
Andrew Pareles 162bf704cc Update CONTRIBUTING.md 2024-10-01 21:40:39 -07:00
Andrew d64e9c93f5 Chore : change "yarn" to "npm i" inside documentation #79 2024-10-01 16:25:31 -07:00
w1gs 74c610632e Merge remote-tracking branch 'upstream/main' 2024-09-30 23:21:08 -04:00
Andrew Pareles 656b24b701 Add PR guidelines to CONTRIBUTING.md 2024-09-30 01:39:42 -07:00
Andrew Pareles 3fd9b572fe Merge pull request #42 from DaveHogan/main
Minor improvement to whichapi & anthropic configuration
2024-09-30 00:54:11 -07:00
Andrew Pareles dab75a6614 Merge branch 'main' into main 2024-09-30 00:54:02 -07:00
Mathew Pareles 4747691e74 add enum 2024-09-30 00:53:07 -07:00
Andrew Pareles 6dac9626c0 Merge pull request #66 from voideditor/rebase
Rebase vscode into Void
2024-09-30 00:39:16 -07:00
Andrew Pareles 180df75bb4 Merge pull request #61 from anetaj/feature/open-settings-button
Link to settings from extension
2024-09-30 00:33:58 -07:00
Darion 5039ca8fdf Merge branch 'voideditor:main' into main 2024-09-24 02:05:10 -04:00
Andrew Pareles aea35c95f2 fix grammar 2024-09-23 22:34:53 -07:00
Aneta Jastrzębska 0a5ebc1c50 add settings button in ext 2024-09-23 12:02:12 +02:00
Dave Hogan cbe3d4bd45 Removes unnessary default 2024-09-22 17:36:53 +01:00
Dave Hogan 16b84ec933 Merge branch 'main' of https://github.com/DaveHogan/void 2024-09-22 17:35:02 +01:00
Dave Hogan 2661f5e8e1 Implemented feedback, removing explict defaults as this comes from package.json 2024-09-22 17:34:48 +01:00
Dave Hogan 760f8c447c Merge branch 'voideditor:main' into main 2024-09-22 17:22:17 +01:00
Darion 57db928f7a Merge branch 'voideditor:main' into main 2024-09-22 08:11:43 -04:00
w1gs bc027b2fca resolve conflicts 2024-09-21 07:46:19 -04:00
Darion afa24231e6 Merge branch 'main' into main 2024-09-21 07:33:45 -04:00
w1gs da5bb4b68e updated styles 2024-09-21 07:27:19 -04:00
Dave Hogan f2d741d01f Merge branch 'voideditor:main' into main 2024-09-21 12:17:21 +01:00
w1gs 2be5a2d13a Extension disabled when no keys set 2024-09-21 06:50:17 -04:00
w1gs 5e5fe80901 allowed urls updating when configuration changes 2024-09-21 04:56:41 -04:00
w1gs e8cf6ee9e7 Replaced fetch with Ollama client 2024-09-21 00:36:11 -04:00
w1gs 2b3f828654 Fixed parsing error in package.json 2024-09-21 00:24:51 -04:00
Darion 7ee1840e77 Merge branch 'voideditor:main' into main 2024-09-21 00:17:36 -04:00
Dave Hogan 1843cd0878 Makes anthropic model and max_tokens configurable
Makes whichApi an enum for less error prone configuration
2024-09-21 01:57:34 +01:00
Darion 7bcefd4536 Update extensions/void/package.json
Co-authored-by: Bruce MacDonald <brucewmacdonald@gmail.com>
2024-09-20 13:56:21 -04:00
Darion 99adb23149 Merge branch 'voideditor:main' into main 2024-09-19 13:09:43 -04:00
Darion 043a38bd36 Merge branch 'voideditor:main' into main 2024-09-18 18:55:54 -04:00
Darion 0269411c16 Merge branch 'voideditor:main' into main 2024-09-18 13:39:34 -04:00
w1gs f4ceb53738 Added Ollama integration 2024-09-18 02:02:43 -04:00
9 changed files with 231 additions and 141 deletions
+16 -3
View File
@@ -57,7 +57,7 @@ Make sure you're on the correct NodeJS version as per `.nvmrc`.
1. Install all dependencies.
```
yarn
npm install
```
2. In VS Code, press <kbd>Ctrl+Shift+B</kbd> to start the build process - this can take some time. If you're not using VS Code, run `npm run watch` instead.
@@ -66,7 +66,7 @@ yarn
This should open up the built IDE after loading for some time. To see new changes without restarting the build, use <kbd>Ctrl+Shift+P</kbd> and run "Reload Window".
To bundle the IDE, run `npm run gulp vscode-win32-x64`. Here are the full options: vscode-{win32-ia32 | win32-x64 | darwin-x64 | darwin-arm64 | linux-ia32 | linux-x64 | linux-arm}(-min)
To bundle the IDE, run `npm run gulp vscode-darwin-arm64`. Here are the full options: `vscode-{win32-ia32 | win32-x64 | darwin-x64 | darwin-arm64 | linux-ia32 | linux-x64 | linux-arm}(-min)`
If you're on Windows, we recommend running the project inside a dev container. VSCode should prompt you to do this automatically.
@@ -124,8 +124,21 @@ Please don't make big refactors without speaking with us first. We'd like to kee
# Submitting a Pull Request
When you've made changes and want to submit them, please submit a pull request.
Please submit a pull request once you've made a change. Here are a few guidelines:
- A PR should be about one *single* feature change. The fewer items you change, the more likely the PR is to be accepted.
- Your PR should contain a description that first explains at a high level what you did, and then describes the exact changes you made (and to which files). Please don't use vague statements like "refactored code" or "improved types" (instead, describe what code you refactored, or what types you changed).
- Your title should clearly describe the change you made.
- Add tags to help us stay organized!
- Please don't open a new Issue for your PR. Just submit the PR.
- Avoid refactoring and making feature changes in the same PR.
- Write good code. For example, a common mistake when people edit Void's config is to hard-code a default value like `'claude-3.5'` in 2+ separate places. Please follow best practices or describe your thought process if you had to compromise.
# Relevant files
+8 -1
View File
@@ -9,6 +9,7 @@
"version": "0.0.1",
"dependencies": {
"@anthropic-ai/sdk": "^0.27.1",
"ollama": "^0.5.9",
"openai": "^4.57.0"
},
"devDependencies": {
@@ -32,7 +33,6 @@
"eslint-plugin-react-hooks": "^4.6.2",
"globals": "^15.9.0",
"marked": "^14.1.0",
"ollama": "^0.5.8",
"postcss": "^8.4.41",
"react": "^18.3.1",
"react-dom": "^18.3.1",
@@ -5973,8 +5973,11 @@
"version": "0.5.9",
"resolved": "https://registry.npmjs.org/ollama/-/ollama-0.5.9.tgz",
"integrity": "sha512-F/KZuDRC+ZsVCuMvcOYuQ6zj42/idzCkkuknGyyGVmNStMZ/sU3jQpvhnl4SyC0+zBzLiKNZJnJeuPFuieWZvQ==",
<<<<<<< HEAD
=======
"dev": true,
"license": "MIT",
>>>>>>> upstream/main
"dependencies": {
"whatwg-fetch": "^3.6.20"
}
@@ -8181,9 +8184,13 @@
"node_modules/whatwg-fetch": {
"version": "3.6.20",
"resolved": "https://registry.npmjs.org/whatwg-fetch/-/whatwg-fetch-3.6.20.tgz",
<<<<<<< HEAD
"integrity": "sha512-EqhiFU6daOA8kpjOWTL0olhVOF3i7OrFzSYiGsEMB8GcXS+RrzauAERX65xMeNWVqxA6HXH2m69Z9LaKKdisfg=="
=======
"integrity": "sha512-EqhiFU6daOA8kpjOWTL0olhVOF3i7OrFzSYiGsEMB8GcXS+RrzauAERX65xMeNWVqxA6HXH2m69Z9LaKKdisfg==",
"dev": true,
"license": "MIT"
>>>>>>> upstream/main
},
"node_modules/whatwg-url": {
"version": "5.0.0",
+61 -16
View File
@@ -1,5 +1,6 @@
{
"name": "void",
"publisher": "void",
"displayName": "Void",
"description": "",
"version": "0.0.1",
@@ -13,37 +14,67 @@
"main": "./out/extension.js",
"contributes": {
"configuration": {
"title": "API Keys",
"title": "Void",
"properties": {
"void.whichApi": {
"type": "string",
"default": "anthropic",
"description": "Choose a model to use (anthropic | openai | greptile | ollama)"
"description": "Choose an API provider",
"enum": [
"anthropic",
"openai",
"greptile",
"ollama"
]
},
"void.anthropicApiKey": {
"void.anthropic.apiKey": {
"type": "string",
"default": "",
"description": "Anthropic API Key"
},
"void.openAIApiKey": {
"void.anthropic.model": {
"type": "string",
"default": "",
"description": "OpenAI API Key"
"default": "claude-3-5-sonnet-20240620",
"description": "Anthropic Model to use.",
"enum": [
"claude-3-5-sonnet-20240620"
]
},
"void.greptileApiKey": {
"void.anthropic.maxTokens": {
"type": "string",
"default": "",
"description": "Greptile API Key"
"default": "1024",
"description": "Anthropic max number of tokens to output.",
"enum":[
"1024",
"2048",
"4096",
"8192"
]
},
"void.githubPAT": {
"void.openAI.apiKey": {
"type": "string",
"default": "",
"description": "Greptile - Github PAT (gives Greptile access to your repo)"
"description": "OpenAI API Key."
},
"void.ollamaSettings": {
"void.greptile.apiKey": {
"type": "string",
"default": "",
"description": "Ollama settings (coming soon...)"
"description": "Greptile API Key."
},
"void.greptile.githubPAT": {
"type": "string",
"default": "",
"description": "Github PAT given to Greptile to access your repository."
},
"void.ollama.endpoint": {
"type": "string",
"default": "",
"description": "Ollama Endpoint. Start Ollama by running `OLLAMA_ORIGINS=\"vscode-webview://*\" ollama serve`"
},
"void.ollama.model": {
"type": "string",
"default": "",
"description": "Ollama model to use."
}
}
},
@@ -63,6 +94,11 @@
{
"command": "void.discardDiff",
"title": "Discard Diff"
},
{
"command": "void.openSettings",
"title": "Void settings",
"icon": "$(settings-gear)"
}
],
"viewsContainers": {
@@ -94,7 +130,16 @@
"key": "ctrl+k",
"mac": "cmd+k"
}
]
],
"menus": {
"view/title": [
{
"command": "void.openSettings",
"when": "view == 'void.viewnumberone'",
"group": "navigation"
}
]
}
},
"scripts": {
"vscode:prepublish": "npm run compile",
@@ -124,7 +169,6 @@
"eslint-plugin-react-hooks": "^4.6.2",
"globals": "^15.9.0",
"marked": "^14.1.0",
"ollama": "^0.5.8",
"postcss": "^8.4.41",
"react": "^18.3.1",
"react-dom": "^18.3.1",
@@ -136,6 +180,7 @@
},
"dependencies": {
"@anthropic-ai/sdk": "^0.27.1",
"ollama": "^0.5.9",
"openai": "^4.57.0"
}
}
}
+49 -34
View File
@@ -14,21 +14,62 @@ function getNonce() {
export class SidebarWebviewProvider implements vscode.WebviewViewProvider {
public static readonly viewId = 'void.viewnumberone';
public webview: Promise<vscode.Webview> // used to send messages to the webview
private readonly _extensionUri: vscode.Uri
public webview: Promise<vscode.Webview> // used to send messages to the webview, resolved by _res in resolveWebviewView
private _res: (c: vscode.Webview) => void // used to resolve the webview
private readonly _extensionUri: vscode.Uri
private _webviewView?: vscode.WebviewView; // only used inside onDidChangeConfiguration
constructor(context: vscode.ExtensionContext) {
// const extensionPath = context.extensionPath // the directory where the extension is installed, might be useful later, not sure for what though... was included in webviewProvider code
// const extensionPath = context.extensionPath // the directory where the extension is installed, might be useful later... was included in webviewProvider code
this._extensionUri = context.extensionUri
let temp_res: typeof this._res | undefined = undefined
this.webview = new Promise((res, rej) => { temp_res = res })
if (!temp_res) throw new Error("sidebar provider: resolver was undefined")
this._res = temp_res
vscode.workspace.onDidChangeConfiguration(event => {
if (event.affectsConfiguration('void.ollamaSettings.endpoint')) {
if (this._webviewView) {
this.updateWebviewHTML(this._webviewView.webview);
}
}
});
}
private updateWebviewHTML(webview: vscode.Webview) {
const allowed_urls = ['https://api.anthropic.com', 'https://api.openai.com', 'https://api.greptile.com'];
const ollamaEndpoint: string | undefined = vscode.workspace.getConfiguration('void').get('ollamaSettings.endpoint');
if (ollamaEndpoint)
allowed_urls.push(ollamaEndpoint);
const scriptUri = webview.asWebviewUri(vscode.Uri.joinPath(this._extensionUri, 'dist/sidebar/index.js'));
const stylesUri = webview.asWebviewUri(vscode.Uri.joinPath(this._extensionUri, 'dist/sidebar/styles.css'));
const rootUri = webview.asWebviewUri(vscode.Uri.joinPath(this._extensionUri));
const nonce = getNonce();
const webviewHTML = `<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Custom View</title>
<meta http-equiv="Content-Security-Policy" content="default-src 'self'; connect-src ${allowed_urls.join(' ')}; img-src vscode-resource: https:; script-src 'nonce-${nonce}'; style-src vscode-resource: 'unsafe-inline' http: https: data:;">
<base href="${rootUri}/">
<link href="${stylesUri}" rel="stylesheet">
</head>
<body>
<div id="root"></div>
<script nonce="${nonce}" src="${scriptUri}"></script>
</body>
</html>`;
webview.html = webviewHTML;
}
// called internally by vscode
resolveWebviewView(
webviewView: vscode.WebviewView,
@@ -36,43 +77,17 @@ export class SidebarWebviewProvider implements vscode.WebviewViewProvider {
token: vscode.CancellationToken,
) {
const webview = webviewView.webview
const webview = webviewView.webview;
webview.options = {
enableScripts: true,
localResourceRoots: [this._extensionUri]
};
// This allows us to use React in vscode
// when you run `npm run build`, we take the React code in the `sidebar` folder
// and compile it into `dist/sidebar/index.js` and `dist/sidebar/styles.css`
// we render that code here
const rootPath = this._extensionUri;
const scriptUri = webview.asWebviewUri(vscode.Uri.joinPath(rootPath, 'dist/sidebar/index.js'));
const stylesUri = webview.asWebviewUri(vscode.Uri.joinPath(rootPath, 'dist/sidebar/styles.css'));
const rootUri = webview.asWebviewUri(vscode.Uri.joinPath(rootPath));
const nonce = getNonce(); // only scripts with the nonce are allowed to run, this is a recommended security measure
const allowed_urls = ['https://api.anthropic.com', 'https://api.openai.com', 'https://api.greptile.com']
webview.html = `<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Custom View</title>
<meta http-equiv="Content-Security-Policy" content="default-src 'self'; connect-src ${allowed_urls.join(' ')}; img-src vscode-resource: https:; script-src 'nonce-${nonce}';style-src vscode-resource: 'unsafe-inline' http: https: data:;">
<base href="${rootUri}/">
<link href="${stylesUri}" rel="stylesheet">
</head>
<body>
<div id="root"></div>
<script nonce="${nonce}" src="${scriptUri}"></script>
</body>
</html>`;
this.updateWebviewHTML(webview);
// resolve webview and _webviewView
this._res(webview);
this._webviewView = webviewView;
}
}
+77 -77
View File
@@ -1,11 +1,15 @@
import Anthropic from '@anthropic-ai/sdk';
import OpenAI from 'openai';
import { Ollama } from 'ollama/browser'
import { getVSCodeAPI } from '../sidebar/getVscodeApi';
// import ollama from 'ollama'
// always compare these against package.json to make sure every setting in this type can actually be provided by the user
export type ApiConfig = {
anthropic: {
apikey: string,
model: string,
maxTokens: string
},
openai: {
apikey: string
@@ -20,7 +24,8 @@ export type ApiConfig = {
}
},
ollama: {
// TODO
endpoint: string,
model: string
},
whichApi: string
}
@@ -60,12 +65,11 @@ type SendLLMMessageFnTypeExternal = (params: {
// Claude
const sendClaudeMsg: SendLLMMessageFnTypeInternal = ({ messages, onText, onFinalMessage, apiConfig }) => {
const anthropic = new Anthropic({ apiKey: apiConfig.anthropic.apikey, dangerouslyAllowBrowser: true }); // defaults to process.env["ANTHROPIC_API_KEY"]
const stream = anthropic.messages.stream({
model: "claude-3-5-sonnet-20240620",
max_tokens: 1024,
model: apiConfig.anthropic.model,
max_tokens: parseInt(apiConfig.anthropic.maxTokens),
messages: messages,
});
@@ -102,11 +106,13 @@ const sendClaudeMsg: SendLLMMessageFnTypeInternal = ({ messages, onText, onFinal
// OpenAI
const sendOpenAIMsg: SendLLMMessageFnTypeInternal = ({ messages, onText, onFinalMessage, apiConfig }) => {
let did_abort = false
let didAbort = false
let fullText = ''
// if abort is called, onFinalMessage is NOT called, and no later onTexts are called either
let abort: () => void = () => { did_abort = true }
let abort: () => void = () => {
didAbort = true;
};
const openai = new OpenAI({ apiKey: apiConfig.openai.apikey, dangerouslyAllowBrowser: true });
@@ -117,13 +123,13 @@ const sendOpenAIMsg: SendLLMMessageFnTypeInternal = ({ messages, onText, onFinal
})
.then(async response => {
abort = () => {
// response.controller.abort() // this isn't needed now, to keep consistency with claude will leave it commented
did_abort = true;
// response.controller.abort()
didAbort = true;
}
// when receive text
try {
for await (const chunk of response) {
if (did_abort) return;
if (didAbort) return;
const newText = chunk.choices[0]?.delta?.content || '';
fullText += newText;
onText(newText, fullText);
@@ -135,8 +141,50 @@ const sendOpenAIMsg: SendLLMMessageFnTypeInternal = ({ messages, onText, onFinal
console.error('Error in OpenAI stream:', error);
onFinalMessage(fullText);
}
// when we get the final message on this stream
onFinalMessage(fullText)
})
return { abort };
};
// Ollama
export const sendOllamaMsg: SendLLMMessageFnTypeInternal = ({ messages, onText, onFinalMessage, apiConfig }) => {
let didAbort = false
let fullText = ""
// if abort is called, onFinalMessage is NOT called, and no later onTexts are called either
let abort = () => {
didAbort = true;
};
const ollama = new Ollama({ host: apiConfig.ollama.endpoint })
ollama.chat({
model: apiConfig.ollama.model,
messages: messages,
stream: true,
})
.then(async stream => {
abort = () => {
// ollama.abort()
didAbort = true
}
// iterate through the stream
try {
for await (const chunk of stream) {
if (didAbort) return;
const newText = chunk.message.content;
fullText += newText;
onText(newText, fullText);
}
onFinalMessage(fullText);
}
// when error/fail
catch (error) {
console.error('Error:', error);
onFinalMessage(fullText);
}
})
return { abort };
};
@@ -149,11 +197,11 @@ const sendOpenAIMsg: SendLLMMessageFnTypeInternal = ({ messages, onText, onFinal
const sendGreptileMsg: SendLLMMessageFnTypeInternal = ({ messages, onText, onFinalMessage, apiConfig }) => {
let did_abort = false
let didAbort = false
let fullText = ''
// if abort is called, onFinalMessage is NOT called, and no later onTexts are called either
let abort: () => void = () => { did_abort = true }
let abort: () => void = () => { didAbort = true }
fetch('https://api.greptile.com/v2/query', {
@@ -177,7 +225,7 @@ const sendGreptileMsg: SendLLMMessageFnTypeInternal = ({ messages, onText, onFin
})
// TODO make this actually stream, right now it just sends one message at the end
.then(async responseArr => {
if (did_abort)
if (didAbort)
return
for (let response of responseArr) {
@@ -212,74 +260,26 @@ const sendGreptileMsg: SendLLMMessageFnTypeInternal = ({ messages, onText, onFin
return { abort }
}
export const sendLLMMessage: SendLLMMessageFnTypeExternal = ({ messages, onText, onFinalMessage, apiConfig }) => {
if (!apiConfig) return { abort: () => { } }
const whichApi = apiConfig.whichApi
if (whichApi === 'anthropic') {
return sendClaudeMsg({ messages, onText, onFinalMessage, apiConfig })
switch (apiConfig.whichApi) {
case 'anthropic':
return sendClaudeMsg({ messages, onText, onFinalMessage, apiConfig });
case 'openai':
return sendOpenAIMsg({ messages, onText, onFinalMessage, apiConfig });
case 'greptile':
return sendGreptileMsg({ messages, onText, onFinalMessage, apiConfig });
case 'ollama':
return sendOllamaMsg({ messages, onText, onFinalMessage, apiConfig });
default:
console.error(`Error: whichApi was ${apiConfig.whichApi}, which is not recognized!`);
return { abort: () => { } }
//return sendClaudeMsg({ messages, onText, onFinalMessage, apiConfig }); // TODO
}
else if (whichApi === 'openai') {
return sendOpenAIMsg({ messages, onText, onFinalMessage, apiConfig })
}
else if (whichApi === 'greptile') {
return sendGreptileMsg({ messages, onText, onFinalMessage, apiConfig })
}
else if (whichApi === 'ollama') {
return sendClaudeMsg({ messages, onText, onFinalMessage, apiConfig }) // TODO
}
else {
console.error(`Error: whichApi was ${whichApi}, which is not recognized!`)
return sendClaudeMsg({ messages, onText, onFinalMessage, apiConfig }) // TODO
}
}
// Ollama
// const sendOllamaMsg: sendMsgFnType = ({ messages, onText, onFinalMessage }) => {
// let did_abort = false
// let fullText = ''
// // if abort is called, onFinalMessage is NOT called, and no later onTexts are called either
// let abort: () => void = () => {
// did_abort = true
// }
// ollama.chat({ model: 'llama3.1', messages: messages, stream: true })
// .then(async response => {
// abort = () => {
// // response.abort() // this isn't needed now, to keep consistency with claude will leave it commented for now
// did_abort = true;
// }
// // when receive text
// try {
// for await (const part of response) {
// if (did_abort) return
// let newText = part.message.content
// fullText += newText
// onText(newText, fullText)
// }
// }
// // when error/fail
// catch (e) {
// onFinalMessage(fullText)
// return
// }
// // when we get the final message on this stream
// onFinalMessage(fullText)
// })
// return { abort };
// };
+16 -7
View File
@@ -13,11 +13,15 @@ const readFileContentOfUri = async (uri: vscode.Uri) => {
const getApiConfig = () => {
const apiConfig: ApiConfig = {
anthropic: { apikey: vscode.workspace.getConfiguration('void').get('anthropicApiKey') ?? '' },
openai: { apikey: vscode.workspace.getConfiguration('void').get('openAIApiKey') ?? '' },
anthropic: {
apikey: vscode.workspace.getConfiguration('void').get('anthropic.apiKey') ?? '',
model: vscode.workspace.getConfiguration('void').get('anthropic.model') ?? '',
maxTokens: vscode.workspace.getConfiguration('void').get('anthropic.maxTokens') ?? '',
},
openai: { apikey: vscode.workspace.getConfiguration('void').get('openAI.apiKey') ?? '' },
greptile: {
apikey: vscode.workspace.getConfiguration('void').get('greptileApiKey') ?? '',
githubPAT: vscode.workspace.getConfiguration('void').get('githubPAT') ?? '',
apikey: vscode.workspace.getConfiguration('void').get('greptile.apiKey') ?? '',
githubPAT: vscode.workspace.getConfiguration('void').get('greptile.githubPAT') ?? '',
repoinfo: {
remote: 'github',
repository: 'TODO',
@@ -25,13 +29,15 @@ const getApiConfig = () => {
}
},
ollama: {
// apikey: vscode.workspace.getConfiguration('void').get('ollamaSettings') ?? '',
endpoint: vscode.workspace.getConfiguration('void').get('ollama.endpoint') ?? '',
model: vscode.workspace.getConfiguration('void').get('ollama.model') ?? '',
},
whichApi: vscode.workspace.getConfiguration('void').get('whichApi') ?? ''
}
return apiConfig
}
export function activate(context: vscode.ExtensionContext) {
// 1. Mount the chat sidebar
@@ -78,6 +84,9 @@ export function activate(context: vscode.ExtensionContext) {
approvalCodeLensProvider.discardDiff(params)
}));
context.subscriptions.push(vscode.commands.registerCommand('void.openSettings', async () => {
vscode.commands.executeCommand('workbench.action.openSettings', '@ext:void.void');
}));
// 5.
webviewProvider.webview.then(
@@ -105,7 +114,8 @@ export function activate(context: vscode.ExtensionContext) {
// send contents to webview
webview.postMessage({ type: 'files', files, } satisfies WebviewMessage)
} else if (m.type === 'applyCode') {
}
else if (m.type === 'applyCode') {
const editor = vscode.window.activeTextEditor
if (!editor) {
@@ -125,7 +135,6 @@ export function activate(context: vscode.ExtensionContext) {
}
else {
console.error('unrecognized command', m.type, m)
}
})
+2 -2
View File
@@ -266,7 +266,7 @@ const Sidebar = () => {
{!selection?.selectionStr ? null
: (
<div className="relative">
<button
<button
onClick={clearSelection}
className="absolute top-2 right-2 text-white hover:text-gray-300 z-10"
>
@@ -274,7 +274,7 @@ const Sidebar = () => {
</button>
<BlockCode text={selection.selectionStr} disableApplyButton={true} />
</div>
)}
)}
</div>
<form
ref={formRef}
+1 -1
View File
@@ -9,7 +9,7 @@ const awaiting: { [c in Command]: ((res: any) => void)[] } = {
"requestFiles": [],
"files": [],
"apiConfig": [],
"getApiConfig": []
"getApiConfig": [],
}
// use this function to await responses
Submodule
+1
Submodule void added at 6d513a1e60