🛠️ 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:
Danny Avila 2025-08-20 13:21:47 -04:00 committed by GitHub
parent da4aa37493
commit 49cd3894aa
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 39 additions and 18 deletions

View file

@ -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}

View file

@ -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,