mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-07-16 17:46:18 +08:00
fix(server): empty mimetype attachments fallback (#11869)
This commit is contained in:
@@ -166,7 +166,11 @@ export class ChatSession implements AsyncDisposable {
|
||||
firstMessage.attachments || [],
|
||||
]
|
||||
.flat()
|
||||
.filter(v => !!v?.trim());
|
||||
.filter(v =>
|
||||
typeof v === 'string'
|
||||
? !!v.trim()
|
||||
: v && v.attachment.trim() && v.mimeType
|
||||
);
|
||||
|
||||
return finished;
|
||||
}
|
||||
@@ -553,7 +557,12 @@ export class ChatSessionService {
|
||||
action: prompt.action || null,
|
||||
tokens: tokenCost,
|
||||
createdAt,
|
||||
messages: preload.concat(ret.data),
|
||||
messages: preload.concat(ret.data).map(m => ({
|
||||
...m,
|
||||
attachments: m.attachments
|
||||
?.map(a => (typeof a === 'string' ? a : a.attachment))
|
||||
.filter(a => !!a),
|
||||
})),
|
||||
};
|
||||
} else {
|
||||
this.logger.error(
|
||||
|
||||
Reference in New Issue
Block a user