This commit is contained in:
2025-09-04 13:47:34 +08:00
parent c255ef4c67
commit 8241849c55

View File

@@ -228,23 +228,27 @@
padding-top: 20px; padding-top: 20px;
border-top: 1px solid #eee; border-top: 1px solid #eee;
} }
.history-title { .history-title {
color: #333; color: #333;
margin-bottom: 15px; margin-bottom: 15px;
font-size: 18px; font-size: 18px;
font-weight: bold; font-weight: bold;
} }
.history-images { .history-images {
display: flex; display: flex;
flex-wrap: wrap; flex-wrap: wrap;
gap: 15px; gap: 15px;
justify-content: center; justify-content: center;
} }
.history-image-item { .history-image-item {
width: calc(20% - 15px); width: calc(20% - 15px);
min-width: 120px; min-width: 120px;
cursor: pointer; cursor: pointer;
} }
.history-image-item img { .history-image-item img {
width: 100%; width: 100%;
height: 250px; height: 250px;
@@ -253,6 +257,7 @@
border: 2px solid #ddd; border: 2px solid #ddd;
transition: all 0.3s ease; transition: all 0.3s ease;
} }
.history-image-item img:hover { .history-image-item img:hover {
border-color: #007bff; border-color: #007bff;
transform: scale(1.05); transform: scale(1.05);
@@ -290,7 +295,8 @@
<select id="modelSelect"> <select id="modelSelect">
<option value="custom">Dream Tech XL</option> <option value="custom">Dream Tech XL</option>
</select> </select>
<div class="model-link">更多模型请访问:<a href="https://www.liblib.art/" target="_blank">https://www.liblib.art/</a></div> <div class="model-link">更多模型请访问:<a href="https://www.liblib.art/"
target="_blank">https://www.liblib.art/</a></div>
</div> </div>
<div class="form-group"> <div class="form-group">
@@ -384,7 +390,8 @@
<div class="param-group"> <div class="param-group">
<label for="hiresDenoisingStrengthInput">去噪强度:</label> <label for="hiresDenoisingStrengthInput">去噪强度:</label>
<input type="number" id="hiresDenoisingStrengthInput" value="0.75" min="0" max="1" step="0.05"> <input type="number" id="hiresDenoisingStrengthInput" value="0.75" min="0" max="1"
step="0.05">
</div> </div>
<div class="param-group"> <div class="param-group">
@@ -439,6 +446,10 @@
<img src="https://dsideal.obs.cn-north-1.myhuaweicloud.com/HuangHai/LibLib/1f5a3b654ae743a0acbc7b9a908dc64d.jpg" <img src="https://dsideal.obs.cn-north-1.myhuaweicloud.com/HuangHai/LibLib/1f5a3b654ae743a0acbc7b9a908dc64d.jpg"
alt="生成历史图片5" onclick="openModal(this.src)"/> alt="生成历史图片5" onclick="openModal(this.src)"/>
</div> </div>
<div class="history-image-item">
<img src="https://dsideal.obs.cn-north-1.myhuaweicloud.com/HuangHai/LibLib/139b21fc79b344e480d834a70b32386c.jpg"
alt="生成历史图片6" onclick="openModal(this.src)"/>
</div>
</div> </div>
</div> </div>
@@ -586,24 +597,15 @@
resultMessage.innerHTML = '<div class="success">图片生成成功!</div>'; resultMessage.innerHTML = '<div class="success">图片生成成功!</div>';
// 检查是否有图片数据 // 检查是否有图片数据
if (data.images && data.images.length > 0) { data.images=[]
data.images.push(data.obs_url)
// 处理图片数据支持Base64和URL两种格式 // 处理图片数据支持Base64和URL两种格式
let imagesHtml = ''; let imagesHtml = '';
data.images.forEach((image, index) => { data.images.forEach((image, index) => {
const imageId = `generatedImage_${Date.now()}_${index}`; const imageId = `generatedImage_${Date.now()}_${index}`;
// 检查是否为URL格式以http或https开头
if (typeof image === 'string' && (image.startsWith('http://') || image.startsWith('https://'))) {
// URL格式图片
imagesHtml += `<img id="${imageId}" src="${image}" alt="生成图片${index + 1}" onclick="openModal(this.src)" style="max-width: 100%; margin-top: 10px; border-radius: 5px; cursor: pointer;">`; imagesHtml += `<img id="${imageId}" src="${image}" alt="生成图片${index + 1}" onclick="openModal(this.src)" style="max-width: 100%; margin-top: 10px; border-radius: 5px; cursor: pointer;">`;
} else {
// Base64格式图片
imagesHtml += `<img id="${imageId}" src="data:image/png;base64,${image}" alt="生成图片${index + 1}" onclick="openModal(this.src)" style="max-width: 100%; margin-top: 10px; border-radius: 5px; cursor: pointer;">`;
}
}); });
resultImage.innerHTML = imagesHtml; resultImage.innerHTML = imagesHtml;
} else {
resultImage.innerHTML = '<p>未获取到图片数据</p>';
}
} else { } else {
// 显示错误信息 // 显示错误信息
resultContainer.style.display = 'block'; resultContainer.style.display = 'block';