mirror of
https://gitee.com/dify_ai/dify.git
synced 2024-11-30 18:27:53 +08:00
306216dbe5
Co-authored-by: luowei <glpat-EjySCyNjWiLqAED-YmwM> Co-authored-by: crazywoola <427733928@qq.com>
28 lines
769 B
JavaScript
28 lines
769 B
JavaScript
|
|
document.getElementById('save-button').addEventListener('click', function (e) {
|
|
e.preventDefault();
|
|
const chatbotUrl = document.getElementById('chatbot-url').value;
|
|
const errorTip = document.getElementById('error-tip');
|
|
|
|
if (chatbotUrl.trim() === "") {
|
|
errorTip.textContent = "Dify ChatBot URL cannot be empty.";
|
|
} else {
|
|
errorTip.textContent = "";
|
|
|
|
chrome.storage.sync.set({
|
|
'chatbotUrl': chatbotUrl,
|
|
}, function () {
|
|
alert('Save Success!');
|
|
});
|
|
}
|
|
});
|
|
|
|
// Load parameters from chrome.storage when the page loads
|
|
chrome.storage.sync.get(['chatbotUrl'], function (result) {
|
|
const chatbotUrlInput = document.getElementById('chatbot-url');
|
|
|
|
if (result.chatbotUrl) {
|
|
chatbotUrlInput.value = result.chatbotUrl;
|
|
}
|
|
|
|
}); |