Spaces:
Runtime error
Runtime error
Stop deleteing messages in pairs automatically (#24)
Browse filesIf a user breaks chat template by deleting messages erroneously, then be
it
92 unmodified lines9394959697989910010110210310410592 unmodified linesfunction deleteMessage(idx: number) {conversations = conversations.map((conversation) => {const deletedMsg = deleteAndGetItem<ChatCompletionInputMessage>(conversation.messages, idx);// delete messages in user/assistant pairs. otherwise, the chat template will be brokenif (deletedMsg) {const { role } = deletedMsg;const pairIdx = role === 'user' ? idx : idx - 1;deleteAndGetItem<ChatCompletionInputMessage>(conversation.messages, pairIdx);}return conversation;});}92 unmodified lines9394959697989992 unmodified linesfunction deleteMessage(idx: number) {conversations = conversations.map((conversation) => {deleteAndGetItem<ChatCompletionInputMessage>(conversation.messages, idx);return conversation;});}
src/lib/components/InferencePlayground/InferencePlayground.svelte+1-7