fix: enhance image upload validation and include prompt in submission metadata
This commit is contained in:
parent
95f2a94e31
commit
8054007163
|
|
@ -47,6 +47,7 @@ export default function Create() {
|
||||||
|
|
||||||
// 提交处理
|
// 提交处理
|
||||||
const handleSubmit = async () => {
|
const handleSubmit = async () => {
|
||||||
|
console.log('handleSubmit', template?.imageCount, image1, image2, prompt);
|
||||||
if (!isLoggedIn) {
|
if (!isLoggedIn) {
|
||||||
setLoginRedirecting(true);
|
setLoginRedirecting(true);
|
||||||
setLoading(true);
|
setLoading(true);
|
||||||
|
|
@ -57,7 +58,7 @@ export default function Create() {
|
||||||
alert('Template code not set');
|
alert('Template code not set');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (template?.imageCount && !image1 || (template?.imageCount === 2 && !image2)) {
|
if ((template?.imageCount && !image1) || (template?.imageCount === 2 && !image2)) {
|
||||||
alert('Upload two images');
|
alert('Upload two images');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -77,6 +78,7 @@ export default function Create() {
|
||||||
metadata: {
|
metadata: {
|
||||||
cb_url: cbUrl,
|
cb_url: cbUrl,
|
||||||
imageUrls: [image1, image2 || image1],
|
imageUrls: [image1, image2 || image1],
|
||||||
|
prompt: prompt,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
if (checkout && checkout.url) {
|
if (checkout && checkout.url) {
|
||||||
|
|
@ -152,7 +154,7 @@ export default function Create() {
|
||||||
<div className="submit-section">
|
<div className="submit-section">
|
||||||
<button
|
<button
|
||||||
className={`submit-button ${(!image1 || (template?.imageCount === 2 && !image2) || loading) && isLoggedIn ? 'disabled' : ''}`}
|
className={`submit-button ${(!image1 || (template?.imageCount === 2 && !image2) || loading) && isLoggedIn ? 'disabled' : ''}`}
|
||||||
disabled={(!image1 || (template?.imageCount === 2 && !image2) || loading) && isLoggedIn}
|
disabled={((template?.imageCount && !image1) || (template?.imageCount === 2 && !image2) || loading) && isLoggedIn}
|
||||||
onClick={handleSubmit}
|
onClick={handleSubmit}
|
||||||
>
|
>
|
||||||
{isLoggedIn === false ? (
|
{isLoggedIn === false ? (
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue