mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-12-23 11:50:14 +01:00
🛠️ fix: Restrict Editable Content Types & Consolidate Typing (#9173)
* fix: only allow editing expected content types & align typing app-wide * chore: update TPayload to use TEditedContent type for editedContent
This commit is contained in:
parent
da4aa37493
commit
49cd3894aa
5 changed files with 39 additions and 18 deletions
|
|
@ -94,6 +94,12 @@ const ContentParts = memo(
|
|||
return null;
|
||||
}
|
||||
|
||||
const isToolCall =
|
||||
part.type === ContentTypes.TOOL_CALL || part['tool_call_ids'] != null;
|
||||
if (isToolCall) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return (
|
||||
<EditTextPart
|
||||
index={idx}
|
||||
|
|
|
|||
|
|
@ -62,17 +62,26 @@ const EditTextPart = ({
|
|||
const messages = getMessages();
|
||||
const parentMessage = messages?.find((msg) => msg.messageId === message?.parentMessageId);
|
||||
|
||||
const editedContent =
|
||||
part.type === ContentTypes.THINK
|
||||
? {
|
||||
index,
|
||||
type: ContentTypes.THINK as const,
|
||||
[ContentTypes.THINK]: data.text,
|
||||
}
|
||||
: {
|
||||
index,
|
||||
type: ContentTypes.TEXT as const,
|
||||
[ContentTypes.TEXT]: data.text,
|
||||
};
|
||||
|
||||
if (!parentMessage) {
|
||||
return;
|
||||
}
|
||||
ask(
|
||||
{ ...parentMessage },
|
||||
{
|
||||
editedContent: {
|
||||
index,
|
||||
text: data.text,
|
||||
type: part.type,
|
||||
},
|
||||
editedContent,
|
||||
editedMessageId: messageId,
|
||||
isRegenerate: true,
|
||||
isEdited: true,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue