-
Notifications
You must be signed in to change notification settings - Fork 12
/
background.js
33 lines (32 loc) · 1.28 KB
/
background.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
chrome.runtime.onMessage.addListener((request, sender, sendResponse) => {
if (request.type === "getOpenAIKey") {
chrome.storage.sync.get("openAIKey", (data) => {
sendResponse({ openAIKey: data.openAIKey });
});
return true; // Required to use sendResponse asynchronously
}
else if (request.type === "getBigcodeServiceUrl"){
chrome.storage.sync.get("bigcodeServiceUrl", (data) => {
sendResponse({ bigcodeServiceUrl: data.bigcodeServiceUrl });
});
return true; // Required to use sendResponse asynchronously
}
else if(request.type === "getCheckedMode"){
chrome.storage.sync.get("checkedMode", (data) => {
sendResponse({ checkedMode: data.checkedMode });
});
return true; // Required to use sendResponse asynchronously
}
else if(request.type === "getGPTModelType"){
chrome.storage.sync.get("modelType", (data) => {
sendResponse({ modelType: data.modelType });
});
return true; // Required to use sendResponse asynchronously
}
else if(request.type === "getHuggingfaceAccessToken"){
chrome.storage.sync.get("huggingfaceAccessToken", (data) => {
sendResponse({ huggingfaceAccessToken : data.huggingfaceAccessToken});
})
return true;
}
});