🛠️ 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

@ -267,13 +267,13 @@ export default function useChatFunctions({
if (editedContent && latestMessage?.content) {
initialResponse.content = cloneDeep(latestMessage.content);
const { index, text, type } = editedContent;
const { index, type, ...part } = editedContent;
if (initialResponse.content && index >= 0 && index < initialResponse.content.length) {
const contentPart = initialResponse.content[index];
if (type === ContentTypes.THINK && contentPart.type === ContentTypes.THINK) {
contentPart[ContentTypes.THINK] = text;
contentPart[ContentTypes.THINK] = part[ContentTypes.THINK];
} else if (type === ContentTypes.TEXT && contentPart.type === ContentTypes.TEXT) {
contentPart[ContentTypes.TEXT] = text;
contentPart[ContentTypes.TEXT] = part[ContentTypes.TEXT];
}
}
} else {