Files
librechat-custom/assets/custom.js
T

18 lines
676 B
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
// Auto‑load saved image‑generation API key into the MCP input field.
// If no key is stored, prompt the user once and persist it in localStorage.
window.addEventListener('load', () => {
const storageKey = 'image_api_key';
let savedKey = localStorage.getItem(storageKey);
if (!savedKey) {
// Prompt user only once per browser session
savedKey = prompt('Enter your Inference Co‑op image‑generation API key (will be saved locally):');
if (savedKey) {
localStorage.setItem(storageKey, savedKey);
}
}
if (savedKey) {
const icInput = document.querySelector('input[name="IC_API_KEY"]');
if (icInput) icInput.value = savedKey;
}
});