@gallop.software/studio 1.3.4 → 1.3.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{StudioUI-IHTWNJHB.mjs → StudioUI-DNDMPY7Q.mjs} +67 -17
- package/dist/StudioUI-DNDMPY7Q.mjs.map +1 -0
- package/dist/{StudioUI-X5SN52MU.js → StudioUI-OY33OEG2.js} +79 -29
- package/dist/StudioUI-OY33OEG2.js.map +1 -0
- package/dist/handlers/index.js +0 -1
- package/dist/handlers/index.js.map +1 -1
- package/dist/handlers/index.mjs +0 -1
- package/dist/handlers/index.mjs.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.mjs +1 -1
- package/package.json +1 -1
- package/dist/StudioUI-IHTWNJHB.mjs.map +0 -1
- package/dist/StudioUI-X5SN52MU.js.map +0 -1
|
@@ -2122,33 +2122,83 @@ function StudioToolbar() {
|
|
|
2122
2122
|
percent: 0,
|
|
2123
2123
|
status: "processing"
|
|
2124
2124
|
});
|
|
2125
|
-
const selectedImageKeys = imagesToProcess.map((p) =>
|
|
2126
|
-
|
|
2125
|
+
const selectedImageKeys = imagesToProcess.map((p) => {
|
|
2126
|
+
const key = p.replace(/^public\//, "");
|
|
2127
|
+
return key.startsWith("/") ? key : `/${key}`;
|
|
2128
|
+
});
|
|
2129
|
+
const response = await fetch("/api/studio/reprocess-stream", {
|
|
2127
2130
|
method: "POST",
|
|
2128
2131
|
headers: { "Content-Type": "application/json" },
|
|
2129
2132
|
body: JSON.stringify({ imageKeys: selectedImageKeys }),
|
|
2130
2133
|
signal
|
|
2131
2134
|
});
|
|
2132
|
-
|
|
2133
|
-
|
|
2134
|
-
setProgressState({
|
|
2135
|
-
current: data.processed?.length || 0,
|
|
2136
|
-
total: data.processed?.length || 0,
|
|
2137
|
-
percent: 100,
|
|
2138
|
-
status: "complete",
|
|
2139
|
-
processed: data.processed?.length || 0,
|
|
2140
|
-
errors: data.errors?.length || 0
|
|
2141
|
-
});
|
|
2142
|
-
clearSelection();
|
|
2143
|
-
triggerRefresh();
|
|
2144
|
-
} else {
|
|
2135
|
+
if (!response.ok) {
|
|
2136
|
+
const error = await response.json();
|
|
2145
2137
|
setProgressState({
|
|
2146
2138
|
current: 0,
|
|
2147
2139
|
total: 0,
|
|
2148
2140
|
percent: 0,
|
|
2149
2141
|
status: "error",
|
|
2150
|
-
message:
|
|
2142
|
+
message: error.error || "Unknown error"
|
|
2151
2143
|
});
|
|
2144
|
+
} else {
|
|
2145
|
+
const reader = response.body?.getReader();
|
|
2146
|
+
const decoder = new TextDecoder();
|
|
2147
|
+
if (reader) {
|
|
2148
|
+
let buffer = "";
|
|
2149
|
+
while (true) {
|
|
2150
|
+
const { done, value } = await reader.read();
|
|
2151
|
+
if (done) break;
|
|
2152
|
+
buffer += decoder.decode(value, { stream: true });
|
|
2153
|
+
const lines = buffer.split("\n");
|
|
2154
|
+
buffer = lines.pop() || "";
|
|
2155
|
+
for (const line of lines) {
|
|
2156
|
+
if (line.startsWith("data: ")) {
|
|
2157
|
+
try {
|
|
2158
|
+
const data = JSON.parse(line.slice(6));
|
|
2159
|
+
if (data.type === "start") {
|
|
2160
|
+
setProgressState((prev) => ({
|
|
2161
|
+
...prev,
|
|
2162
|
+
total: data.total
|
|
2163
|
+
}));
|
|
2164
|
+
} else if (data.type === "progress") {
|
|
2165
|
+
setProgressState({
|
|
2166
|
+
current: data.current,
|
|
2167
|
+
total: data.total,
|
|
2168
|
+
percent: data.percent,
|
|
2169
|
+
status: "processing",
|
|
2170
|
+
message: data.message
|
|
2171
|
+
});
|
|
2172
|
+
} else if (data.type === "cleanup") {
|
|
2173
|
+
setProgressState((prev) => ({
|
|
2174
|
+
...prev,
|
|
2175
|
+
status: "cleanup",
|
|
2176
|
+
message: data.message
|
|
2177
|
+
}));
|
|
2178
|
+
} else if (data.type === "complete") {
|
|
2179
|
+
setProgressState({
|
|
2180
|
+
current: data.processed,
|
|
2181
|
+
total: data.processed,
|
|
2182
|
+
percent: 100,
|
|
2183
|
+
status: data.errors > 0 ? "error" : "complete",
|
|
2184
|
+
processed: data.processed,
|
|
2185
|
+
message: data.message
|
|
2186
|
+
});
|
|
2187
|
+
clearSelection();
|
|
2188
|
+
triggerRefresh();
|
|
2189
|
+
} else if (data.type === "error") {
|
|
2190
|
+
setProgressState((prev) => ({
|
|
2191
|
+
...prev,
|
|
2192
|
+
status: "error",
|
|
2193
|
+
message: data.message
|
|
2194
|
+
}));
|
|
2195
|
+
}
|
|
2196
|
+
} catch {
|
|
2197
|
+
}
|
|
2198
|
+
}
|
|
2199
|
+
}
|
|
2200
|
+
}
|
|
2201
|
+
}
|
|
2152
2202
|
}
|
|
2153
2203
|
}
|
|
2154
2204
|
} catch (error) {
|
|
@@ -6111,4 +6161,4 @@ export {
|
|
|
6111
6161
|
StudioUI,
|
|
6112
6162
|
StudioUI_default as default
|
|
6113
6163
|
};
|
|
6114
|
-
//# sourceMappingURL=StudioUI-
|
|
6164
|
+
//# sourceMappingURL=StudioUI-DNDMPY7Q.mjs.map
|