瀏覽代碼

图生图和图生视频必须上传图片,以及提示信息

丸子 7 月之前
父節點
當前提交
f0319760f8
共有 2 個文件被更改,包括 10 次插入4 次删除
  1. 5 2
      src/views/AIImageToImage.vue
  2. 5 2
      src/views/AIImageToVideo.vue

+ 5 - 2
src/views/AIImageToImage.vue

@@ -143,7 +143,7 @@
               <span v-if="isRecording" class="countdown-text">{{ countdown }}s</span>
             </button>
 
-            <!-- 终止按钮 -->
+            <!-- 终止按钮 --> 
             <div
               v-if="conversationInProgress"
               @click="stopStream"
@@ -362,7 +362,7 @@ const stopStream = async () => {
 
 // 发送消息函数,图片数据
 const sendMessage = async() => {
-  if (inputMessage.value.trim() || uploadedImage.value) {
+  if (uploadedImage.value) {
     // 创建 AbortController 实例,以便中止请求
     conversationInAbortController.value = new AbortController();
     // 标记对话进行中
@@ -427,6 +427,9 @@ const sendMessage = async() => {
       console.error('生成图片失败:', error);
       conversationInProgress.value = false;
     }
+  } else {
+    // 如果没有上传图片,显示提示信息
+    Message().error('请先上传图片!', true);
   }
   // 调用子组件的方法清除预览图
   imageUploadRef.value?.clearPreview();

+ 5 - 2
src/views/AIImageToVideo.vue

@@ -91,7 +91,7 @@
                       <video
                         v-for="(video, index) in item.imageList"
                         :key="index"
-                        style="width: 30%; max-width: 600px; height: auto; margin: 10px;"
+                        style="width: 60%; max-width: 600px; height: auto; margin: 10px;border-radius: 2%;"
                         :src="video"
                         controls
                         playsinline
@@ -344,7 +344,7 @@ const stopStream = async () => {
 
 // 发送消息函数
 const sendMessage = async() => {
-  if (inputMessage.value.trim()  || uploadedImage.value) {
+  if (uploadedImage.value) {
     // 创建 AbortController 实例,以便中止请求
     conversationInAbortController.value = new AbortController();
     // 标记对话进行中
@@ -408,6 +408,9 @@ const sendMessage = async() => {
       console.error('生成视频失败:', error);
       conversationInProgress.value = false;
     }
+  } else {
+    // 如果没有上传图片,显示提示信息
+    Message().error('请先上传图片!', true);
   }
   // 调用子组件的方法清除预览图
   imageUploadRef.value?.clearPreview();