Skip to content

Instantly share code, notes, and snippets.

@Apurer
Created May 11, 2023 09:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Apurer/c126877d6b8d0a41702d6c7ce37b709c to your computer and use it in GitHub Desktop.
Save Apurer/c126877d6b8d0a41702d6c7ce37b709c to your computer and use it in GitHub Desktop.
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