asking openai api optional permission. see #558
This commit is contained in:
parent
e94aeac45b
commit
9a0d75c7fc
1 changed files with 7 additions and 0 deletions
|
|
@ -598,6 +598,13 @@ export async function injectConnectionUI({
|
|||
let openai = new OpenAI({
|
||||
apiKey: document.getElementById("chatgpt_api_key").value,
|
||||
});
|
||||
let granted = await messenger.permissions.request({ origins: ["https://*.openai.com/*"] });
|
||||
if(!granted){
|
||||
document.getElementById('chatgpt_model_fetch_loading').style.display = 'none';
|
||||
taLog.log("OpenAI API permission denied");
|
||||
alert(browser.i18n.getMessage("Optional_Permission_Denied_Model_Fetching"));
|
||||
return;
|
||||
}
|
||||
openai.fetchModels().then((data) => {
|
||||
if(!data.ok){
|
||||
let errorDetail;
|
||||
|
|
|
|||
Loading…
Reference in a new issue