Browse Source

限制上传图片数量

cq.tianyong 2 hours ago
parent
commit
61569faef6
1 changed files with 2 additions and 1 deletions
  1. 2 1
      lib/AIChat/ConversationService.js

+ 2 - 1
lib/AIChat/ConversationService.js

@@ -5,6 +5,7 @@ const ACTIVE_STATE = 1
 const DELETED_STATE = 2
 const DELETED_STATE = 2
 const ASSISTANT_UUID = 'e4fe0277-0b1a-41a1-b25f-8b6e4cec3281'
 const ASSISTANT_UUID = 'e4fe0277-0b1a-41a1-b25f-8b6e4cec3281'
 const DEFAULT_TITLE = '新对话'
 const DEFAULT_TITLE = '新对话'
+const MAX_MESSAGE_IMAGES = 3
 
 
 function toPositiveInt(value, fallback = null) {
 function toPositiveInt(value, fallback = null) {
     const n = Number(value)
     const n = Number(value)
@@ -31,7 +32,7 @@ function normalizeImages(images) {
         })
         })
         .map((item) => String(item || '').trim())
         .map((item) => String(item || '').trim())
         .filter(Boolean)
         .filter(Boolean)
-        .slice(0, 6)
+        .slice(0, MAX_MESSAGE_IMAGES)
 }
 }
 
 
 function buildPreview(content, images = []) {
 function buildPreview(content, images = []) {