diff --git a/components/chat-message-display.tsx b/components/chat-message-display.tsx index 04bc1bd..d3b9243 100644 --- a/components/chat-message-display.tsx +++ b/components/chat-message-display.tsx @@ -47,7 +47,7 @@ function EditDiffDisplay({ edits }: { edits: EditPair[] }) {
{edits.map((edit, index) => (
@@ -177,7 +177,10 @@ export function ChatMessageDisplay({ const currentXml = xml || "" const convertedXml = convertToLegalXml(currentXml) if (convertedXml !== previousXML.current) { - const replacedXML = replaceNodes(chartXML, convertedXml) + // If chartXML is empty, use the converted XML directly + const replacedXML = chartXML + ? replaceNodes(chartXML, convertedXml) + : convertedXml const validationError = validateMxCellStructure(replacedXML) if (!validationError) { diff --git a/components/chat-panel.tsx b/components/chat-panel.tsx index f24c5e4..c2a3ce6 100644 --- a/components/chat-panel.tsx +++ b/components/chat-panel.tsx @@ -347,6 +347,7 @@ Please retry with an adjusted search pattern or use display_diagram if retries a }) // Now send the message after state is guaranteed to be updated + const accessCode = localStorage.getItem(STORAGE_ACCESS_CODE_KEY) || "" sendMessage( { parts: userParts }, { @@ -354,6 +355,9 @@ Please retry with an adjusted search pattern or use display_diagram if retries a xml: savedXml, sessionId, }, + headers: { + "x-access-code": accessCode, + }, }, ) } @@ -404,6 +408,7 @@ Please retry with an adjusted search pattern or use display_diagram if retries a }) // Now send the edited message after state is guaranteed to be updated + const accessCode = localStorage.getItem(STORAGE_ACCESS_CODE_KEY) || "" sendMessage( { parts: newParts }, { @@ -411,6 +416,9 @@ Please retry with an adjusted search pattern or use display_diagram if retries a xml: savedXml, sessionId, }, + headers: { + "x-access-code": accessCode, + }, }, ) }