Skip to content

Commit

Permalink
fix: only render sources with metadata
Browse files Browse the repository at this point in the history
  • Loading branch information
marcusschiesser committed Apr 24, 2024
1 parent f1c3e8d commit 8b81b17
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ export function ChatSources({ data }: { data: SourceData }) {
const sources = useMemo(() => {
return (
data.nodes
?.filter((node) => Object.keys(node.metadata).length > 0)
?.filter((node) => (node.score ?? 1) > SCORE_THRESHOLD)
.sort((a, b) => (b.score ?? 1) - (a.score ?? 1)) || []
);
Expand Down Expand Up @@ -84,5 +85,10 @@ function NodeInfo({ node }: { node: SourceNode }) {

// node generated by unknown loader, implement renderer by analyzing logged out metadata
console.log("Node metadata", node.metadata);
return <p>Sorry, unknown node type. Please add a new renderer.</p>;
return (
<p>
Sorry, unknown node type. Please add a new renderer in the NodeInfo
component.
</p>
);
}

0 comments on commit 8b81b17

Please sign in to comment.