feat(attachments): enforce combined limit for images and attachments

Implement a maximum limit of 5 for the total number of images and attachments that can be uploaded in a chat session. Introduce a warning message for users when the limit is exceeded. Additionally, add functionality to clear pending uploads when switching sessions to prevent errors related to stale document IDs. Update localization files to include new warning messages in English, Korean, Russian, and Chinese.
This commit is contained in:
wizardchen
2026-07-16 17:38:34 +08:00
committed by lyingbug
parent 85d10d99e3
commit 7ddac0385f
6 changed files with 36 additions and 2 deletions
+7 -2
View File
@@ -73,8 +73,13 @@ func (m *MessageImages) Scan(value interface{}) error {
// MessageAttachment represents a file attachment in a chat message
type MessageAttachment struct {
ID string `json:"id,omitempty"` // Temporary document ID for session-scoped uploads
URL string `json:"url"` // Storage URL (provider://path)
ID string `json:"id,omitempty"` // Temporary document ID for session-scoped uploads
// URL is the internal storage handle (provider://path / resource://...). It is
// an internal locator only: previews are served via the session-scoped
// attachment endpoints, so this handle must never reach the client. Kept out
// of both JSON responses and DB serialization to avoid leaking a cross-session
// downloadable reference (see /files tenant-only check).
URL string `json:"-"` // Storage URL (provider://path)
FileName string `json:"file_name"` // Original filename
FileType string `json:"file_type"` // File extension (e.g., ".pdf", ".docx")
FileSize int64 `json:"file_size"` // File size in bytes