Skip to content

Commit

Permalink
Fix chatbot bug where unexpected AI response could lead to link butto…
Browse files Browse the repository at this point in the history
…n to contain unexpected label and overflow its container.
  • Loading branch information
felixarntz committed Nov 18, 2024
1 parent a349274 commit 66f3578
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/chatbot/components/ChatbotApp/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,10 +89,13 @@ const ResponseRenderer = ( { text } ) => {
linkText: '',
};
}

// If the response includes something after the link text, remove it.
const cleanLinkText = parts[ 2 ].split( '\n' )[ 0 ];
return {
text: parts[ 0 ].trim(),
linkUrl: parts[ 1 ].trim(),
linkText: parts[ 2 ].trim(),
linkText: cleanLinkText.trim(),
};
}, [ text ] );

Expand Down

0 comments on commit 66f3578

Please sign in to comment.