refactor(settings): replace getStorageItem with state.global.settings for default root retrieval

This commit is contained in:
Will Miao
2025-09-19 22:57:05 +08:00
parent 1610048974
commit f3544b3471
5 changed files with 17 additions and 225 deletions

View File

@@ -33,6 +33,20 @@ export async function loadExampleImages(images, modelHash) {
const params = `model_hash=${modelHash}`;
const response = await fetch(`${endpoint}?${params}`);
if (!response.ok) {
// Try to parse error message from backend
let errorMsg = `HTTP error ${response.status}`;
try {
const errorData = await response.json();
if (errorData && errorData.error) {
errorMsg = errorData.error;
}
} catch (e) {
// Ignore JSON parse error
}
console.warn("Failed to get example files:", errorMsg);
return;
}
const result = await response.json();
if (result.success) {