Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
|
@@ -904,7 +904,8 @@ with gr.Blocks(css="""
|
|
| 904 |
lines=10,
|
| 905 |
max_lines=50,
|
| 906 |
show_copy_button=True,
|
| 907 |
-
elem_id="generated_prompt"
|
|
|
|
| 908 |
)
|
| 909 |
|
| 910 |
with gr.Row():
|
|
@@ -1012,7 +1013,7 @@ with gr.Blocks(css="""
|
|
| 1012 |
<div style="text-align: center; margin: 10px;">
|
| 1013 |
<button
|
| 1014 |
onclick="
|
| 1015 |
-
const promptArea = document.
|
| 1016 |
if (promptArea) {
|
| 1017 |
// Try modern clipboard API first
|
| 1018 |
if (navigator.clipboard && navigator.clipboard.writeText) {
|
|
@@ -1033,7 +1034,8 @@ with gr.Blocks(css="""
|
|
| 1033 |
}, 2000);
|
| 1034 |
}, 500);
|
| 1035 |
})
|
| 1036 |
-
.catch(
|
|
|
|
| 1037 |
// Fallback to older method
|
| 1038 |
promptArea.select();
|
| 1039 |
try {
|
|
@@ -1053,6 +1055,7 @@ with gr.Blocks(css="""
|
|
| 1053 |
}, 2000);
|
| 1054 |
}, 500);
|
| 1055 |
} catch (err) {
|
|
|
|
| 1056 |
this.innerHTML = 'β Copy failed. Please try again.';
|
| 1057 |
setTimeout(() => {
|
| 1058 |
this.innerHTML = 'π Copy Prompt & Open ChatGPT';
|
|
@@ -1079,12 +1082,19 @@ with gr.Blocks(css="""
|
|
| 1079 |
}, 2000);
|
| 1080 |
}, 500);
|
| 1081 |
} catch (err) {
|
|
|
|
| 1082 |
this.innerHTML = 'β Copy failed. Please try again.';
|
| 1083 |
setTimeout(() => {
|
| 1084 |
this.innerHTML = 'π Copy Prompt & Open ChatGPT';
|
| 1085 |
}, 2000);
|
| 1086 |
}
|
| 1087 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1088 |
}
|
| 1089 |
"
|
| 1090 |
style="
|
|
|
|
| 904 |
lines=10,
|
| 905 |
max_lines=50,
|
| 906 |
show_copy_button=True,
|
| 907 |
+
elem_id="generated_prompt",
|
| 908 |
+
elem_classes="generated_prompt"
|
| 909 |
)
|
| 910 |
|
| 911 |
with gr.Row():
|
|
|
|
| 1013 |
<div style="text-align: center; margin: 10px;">
|
| 1014 |
<button
|
| 1015 |
onclick="
|
| 1016 |
+
const promptArea = document.querySelector('textarea[data-testid=\'generated_prompt\']');
|
| 1017 |
if (promptArea) {
|
| 1018 |
// Try modern clipboard API first
|
| 1019 |
if (navigator.clipboard && navigator.clipboard.writeText) {
|
|
|
|
| 1034 |
}, 2000);
|
| 1035 |
}, 500);
|
| 1036 |
})
|
| 1037 |
+
.catch(err => {
|
| 1038 |
+
console.error('Copy failed:', err);
|
| 1039 |
// Fallback to older method
|
| 1040 |
promptArea.select();
|
| 1041 |
try {
|
|
|
|
| 1055 |
}, 2000);
|
| 1056 |
}, 500);
|
| 1057 |
} catch (err) {
|
| 1058 |
+
console.error('Fallback copy failed:', err);
|
| 1059 |
this.innerHTML = 'β Copy failed. Please try again.';
|
| 1060 |
setTimeout(() => {
|
| 1061 |
this.innerHTML = 'π Copy Prompt & Open ChatGPT';
|
|
|
|
| 1082 |
}, 2000);
|
| 1083 |
}, 500);
|
| 1084 |
} catch (err) {
|
| 1085 |
+
console.error('Legacy copy failed:', err);
|
| 1086 |
this.innerHTML = 'β Copy failed. Please try again.';
|
| 1087 |
setTimeout(() => {
|
| 1088 |
this.innerHTML = 'π Copy Prompt & Open ChatGPT';
|
| 1089 |
}, 2000);
|
| 1090 |
}
|
| 1091 |
}
|
| 1092 |
+
} else {
|
| 1093 |
+
console.error('Prompt textarea not found');
|
| 1094 |
+
this.innerHTML = 'β Prompt not found. Generate a prompt first.';
|
| 1095 |
+
setTimeout(() => {
|
| 1096 |
+
this.innerHTML = 'π Copy Prompt & Open ChatGPT';
|
| 1097 |
+
}, 2000);
|
| 1098 |
}
|
| 1099 |
"
|
| 1100 |
style="
|