Spaces:
Sleeping
Sleeping
Junhui Ji
commited on
Commit
·
b1a6df1
1
Parent(s):
55a8438
update client ip
Browse files- static/script.js +8 -4
static/script.js
CHANGED
|
@@ -707,14 +707,16 @@ document.addEventListener('DOMContentLoaded', function() {
|
|
| 707 |
const response = await fetch(`${BASE_URL}api/optimize-design`, {
|
| 708 |
method: 'POST',
|
| 709 |
headers: {
|
| 710 |
-
'Content-Type': 'application/json'
|
|
|
|
| 711 |
},
|
| 712 |
body: JSON.stringify({
|
| 713 |
text: uploadedText,
|
| 714 |
image_data: uploadedImage,
|
| 715 |
suggestions: suggestions,
|
| 716 |
request_model_id: 'gpt-image-1',
|
| 717 |
-
openai_key: sessionStorage.getItem('userOpenaiKey') || ''
|
|
|
|
| 718 |
})
|
| 719 |
});
|
| 720 |
|
|
@@ -779,14 +781,16 @@ document.addEventListener('DOMContentLoaded', function() {
|
|
| 779 |
const response = await fetch(`${BASE_URL}api/optimize-design`, {
|
| 780 |
method: 'POST',
|
| 781 |
headers: {
|
| 782 |
-
'Content-Type': 'application/json'
|
|
|
|
| 783 |
},
|
| 784 |
body: JSON.stringify({
|
| 785 |
text: uploadedText,
|
| 786 |
image_data: uploadedImage,
|
| 787 |
suggestions: suggestions,
|
| 788 |
request_model_id: 'dall-e-2',
|
| 789 |
-
openai_key: sessionStorage.getItem('userOpenaiKey') || ''
|
|
|
|
| 790 |
})
|
| 791 |
});
|
| 792 |
if (response.status === 503) {
|
|
|
|
| 707 |
const response = await fetch(`${BASE_URL}api/optimize-design`, {
|
| 708 |
method: 'POST',
|
| 709 |
headers: {
|
| 710 |
+
'Content-Type': 'application/json',
|
| 711 |
+
'X-Forwarded-For': window.location.hostname
|
| 712 |
},
|
| 713 |
body: JSON.stringify({
|
| 714 |
text: uploadedText,
|
| 715 |
image_data: uploadedImage,
|
| 716 |
suggestions: suggestions,
|
| 717 |
request_model_id: 'gpt-image-1',
|
| 718 |
+
openai_key: sessionStorage.getItem('userOpenaiKey') || '',
|
| 719 |
+
client_ip: window.location.hostname
|
| 720 |
})
|
| 721 |
});
|
| 722 |
|
|
|
|
| 781 |
const response = await fetch(`${BASE_URL}api/optimize-design`, {
|
| 782 |
method: 'POST',
|
| 783 |
headers: {
|
| 784 |
+
'Content-Type': 'application/json',
|
| 785 |
+
'X-Forwarded-For': window.location.hostname
|
| 786 |
},
|
| 787 |
body: JSON.stringify({
|
| 788 |
text: uploadedText,
|
| 789 |
image_data: uploadedImage,
|
| 790 |
suggestions: suggestions,
|
| 791 |
request_model_id: 'dall-e-2',
|
| 792 |
+
openai_key: sessionStorage.getItem('userOpenaiKey') || '',
|
| 793 |
+
client_ip: window.location.hostname
|
| 794 |
})
|
| 795 |
});
|
| 796 |
if (response.status === 503) {
|