mirror of
https://github.com/StanGirard/quivr.git
synced 2024-11-23 04:17:48 +03:00
Fix: citation handling in ChatItem component (#2524)
This pull request fixes the citation handling in the ChatItem component. Previously, if the citation did not contain the word "Content:", the component would throw an error. This PR adds a check for the presence of "Content:" in the citation and handles it accordingly.
This commit is contained in:
parent
d2cab9332f
commit
365ac1ab87
@ -11,8 +11,14 @@ export const Citation = ({ citation }: CitationProps): JSX.Element => {
|
||||
const [isExpanded, setIsExpanded] = useState<boolean>(false);
|
||||
|
||||
const contentIndex = citation.indexOf("Content:");
|
||||
const cleanedCitation = citation.substring(contentIndex);
|
||||
const [, content] = cleanedCitation.split("Content:");
|
||||
let cleanedCitation, content;
|
||||
|
||||
if (contentIndex !== -1) {
|
||||
cleanedCitation = citation.substring(contentIndex);
|
||||
[, content] = cleanedCitation.split("Content:");
|
||||
} else {
|
||||
content = citation;
|
||||
}
|
||||
|
||||
const handleIconClick = (event: React.MouseEvent) => {
|
||||
event.stopPropagation();
|
||||
|
Loading…
Reference in New Issue
Block a user