mirror of
https://github.com/open-webui/extension
synced 2025-06-26 18:25:58 +00:00
fix: init
This commit is contained in:
parent
fe024a6e9b
commit
e26ea0f51b
18
extension/dist/main.js
vendored
18
extension/dist/main.js
vendored
File diff suppressed because one or more lines are too long
@ -8,6 +8,13 @@ export const SpotlightSearch = () => {
|
||||
|
||||
const [storageCache, setStorageCache] = useState(null);
|
||||
|
||||
const [url, setUrl] = useState("");
|
||||
const [key, setKey] = useState("");
|
||||
const [model, setModel] = useState("");
|
||||
|
||||
const [showConfig, setShowConfig] = useState(true);
|
||||
const [models, setModels] = useState(null);
|
||||
|
||||
useEffect(() => {
|
||||
async function getStorageCache() {
|
||||
let _storageCache = null;
|
||||
@ -19,17 +26,20 @@ export const SpotlightSearch = () => {
|
||||
}
|
||||
|
||||
setStorageCache(_storageCache);
|
||||
|
||||
if (_storageCache) {
|
||||
setUrl(_storageCache.url ?? "");
|
||||
setKey(_storageCache.key ?? "");
|
||||
setModel(_storageCache.model ?? "");
|
||||
if (_storageCache.url && _storageCache.key && _storageCache.model) {
|
||||
setModels(await getModels(_storageCache.key, _storageCache.url));
|
||||
setShowConfig(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
getStorageCache();
|
||||
}, []);
|
||||
|
||||
const [url, setUrl] = useState(storageCache?.url ?? "");
|
||||
const [key, setKey] = useState(storageCache?.key ?? "");
|
||||
const [model, setModel] = useState(storageCache?.model ?? "");
|
||||
|
||||
const [showConfig, setShowConfig] = useState(url === "" || key === "");
|
||||
const [models, setModels] = useState(null);
|
||||
|
||||
const resetConfig = () => {
|
||||
console.log("resetConfig");
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user