update context image should be text
All checks were successful
Deploy to Production / deploy (push) Successful in 20s

This commit is contained in:
silverpro89
2026-02-10 17:43:17 +07:00
parent 5957636b07
commit 09e72e37e7
3 changed files with 10 additions and 14 deletions

View File

@@ -402,9 +402,9 @@
<input type="text" id="imagesUuid" placeholder="Paste UUID or click from list above">
</div>
<div class="form-group">
<label>Image URLs * (JSON Array)</label>
<textarea id="imageUrls" placeholder='["https://example.com/image1.jpg", "https://example.com/image2.jpg"]'></textarea>
<div class="small-note">Must be valid JSON array of URLs</div>
<label>Image URL * (String)</label>
<input type="text" id="imageUrls" placeholder="https://example.com/image.jpg">
<div class="small-note">Enter a single image URL</div>
</div>
<button onclick="addImages()">Add Images (Status 3 → 4)</button>
<div class="result" id="imagesResult"></div>
@@ -647,22 +647,18 @@
const headers = getHeaders();
const uuid = document.getElementById('imagesUuid').value.trim();
const imageUrlsStr = document.getElementById('imageUrls').value.trim();
const imageUrl = document.getElementById('imageUrls').value.trim();
if (!uuid || !imageUrlsStr) {
showResult('imagesResult', { error: 'UUID and image URLs are required' }, false);
if (!uuid || !imageUrl) {
showResult('imagesResult', { error: 'UUID and image URL are required' }, false);
return;
}
try {
const image = JSON.parse(imageUrlsStr);
if (!Array.isArray(image)) {
throw new Error('Image URLs must be an array');
}
const response = await fetch(`${API_BASE}/${uuid}/add-images`, {
method: 'POST',
headers: headers,
body: JSON.stringify({ image })
body: JSON.stringify({ image: imageUrl })
});
const data = await response.json();
showResult('imagesResult', data, response.ok);