Created
May 11, 2023 09:39
-
-
Save Apurer/c126877d6b8d0a41702d6c7ce37b709c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
async provideInlineCompletionItems(document, position, context, token) { | |
console.log('provideInlineCompletionItems triggered'); | |
// Read the configuration settings | |
const config = vscode.workspace.getConfiguration('codeHelper'); | |
const maxToGenerate = config.get<number>('maxToGenerate') || 128; | |
const temperature = config.get<number>('temperature') || 0.6; | |
const modelName = config.get<string>('modelName') || 'default_model'; | |
const username = config.get<string>('username') || ''; // Read the username setting | |
const password = config.get<string>('password') || ''; // Read the password setting | |
// ... | |
// Update the axios.post() call to include the basic authentication header | |
const response = await axios.post('http://127.0.0.1:8080/generate', payload, { | |
headers: { | |
'Content-Type': 'application/json', | |
'Authorization': 'Basic ' + Buffer.from(username + ':' + password).toString('base64') // Add the basic authentication header | |
}, | |
}); | |
// ... | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment