From 7b2779136d8b5759bf46c9da16338dbbe766fd33 Mon Sep 17 00:00:00 2001 From: LeoBorcherding Date: Mon, 8 Jun 2026 11:00:38 -0500 Subject: [PATCH] fix(export): preserve system role in ShareGPT exports System messages were being mapped to 'gpt' instead of 'system', corrupting training data. Both the single-thread and bulk export paths now correctly emit 'system' for system messages. --- .../features/chat/prompt-storage/prompt-storage-dialog.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/studio/frontend/src/features/chat/prompt-storage/prompt-storage-dialog.tsx b/studio/frontend/src/features/chat/prompt-storage/prompt-storage-dialog.tsx index 8ba6092d91..304247fcc8 100644 --- a/studio/frontend/src/features/chat/prompt-storage/prompt-storage-dialog.tsx +++ b/studio/frontend/src/features/chat/prompt-storage/prompt-storage-dialog.tsx @@ -379,7 +379,7 @@ export async function exportConversationShareGPT(threadId: string): Promise = []; for (const msg of messages) { const role = msg.role as string; - const from = role === "user" ? "human" : "gpt"; + const from = role === "user" ? "human" : role === "system" ? "system" : "gpt"; const value = messageToText(msg); if (value.trim()) conversations.push({ from, value }); } @@ -461,7 +461,7 @@ async function buildThreadContent( for (const msg of messages) { const role = msg.role as string; const value = messageToText(msg); - if (value.trim()) conversations.push({ from: role === "user" ? "human" : "gpt", value }); + if (value.trim()) conversations.push({ from: role === "user" ? "human" : role === "system" ? "system" : "gpt", value }); } if (conversations.length === 0) return null; return JSON.stringify({ conversations });