mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-12-17 17:00:15 +01:00
🌿 fix: forking a long conversation breaks chat structure (#4778)
* fix: branching and forking sometimes break conversation structure * fix test for forking. * chore: message type issues * test: add conversation structure tests for message handling --------- Co-authored-by: xyqyear <xyqyear@gmail.com>
This commit is contained in:
parent
7d5be68747
commit
c87a51eaab
8 changed files with 248 additions and 16 deletions
|
|
@ -28,13 +28,20 @@ export default function Message(props: TMessageProps) {
|
|||
return null;
|
||||
}
|
||||
|
||||
const { text, children, messageId = null, isCreatedByUser, error, unfinished } = message ?? {};
|
||||
const {
|
||||
text = '',
|
||||
children,
|
||||
messageId = null,
|
||||
isCreatedByUser = true,
|
||||
error = false,
|
||||
unfinished = false,
|
||||
} = message;
|
||||
|
||||
let messageLabel = '';
|
||||
if (isCreatedByUser) {
|
||||
messageLabel = 'anonymous';
|
||||
} else {
|
||||
messageLabel = message.sender;
|
||||
messageLabel = message.sender || '';
|
||||
}
|
||||
|
||||
return (
|
||||
|
|
@ -67,12 +74,12 @@ export default function Message(props: TMessageProps) {
|
|||
error={error}
|
||||
isLast={false}
|
||||
ask={() => ({})}
|
||||
text={text ?? ''}
|
||||
text={text}
|
||||
message={message}
|
||||
isSubmitting={false}
|
||||
enterEdit={() => ({})}
|
||||
unfinished={!!unfinished}
|
||||
isCreatedByUser={isCreatedByUser ?? true}
|
||||
isCreatedByUser={isCreatedByUser}
|
||||
siblingIdx={siblingIdx ?? 0}
|
||||
setSiblingIdx={setSiblingIdx ?? (() => ({}))}
|
||||
/>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue