File tree Expand file tree Collapse file tree 2 files changed +14
-1
lines changed
components/circuits/link-graph Expand file tree Collapse file tree 2 files changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -98,7 +98,7 @@ function topologicalSort(
9898}
9999
100100const LinkGraphComponent : React . FC < LinkGraphProps > = ( {
101- data,
101+ data : rawData ,
102102 visState,
103103 onNodeClick,
104104 onNodeHover,
@@ -112,6 +112,15 @@ const LinkGraphComponent: React.FC<LinkGraphProps> = ({
112112 } ,
113113 )
114114
115+ const data = useMemo ( ( ) => {
116+ const nodes = rawData . nodes . filter ( ( n ) => ! n . isFromQkTracing )
117+ const nodeIds = new Set ( nodes . map ( ( n ) => n . nodeId ) )
118+ const edges = rawData . edges . filter (
119+ ( e ) => nodeIds . has ( e . source ) && nodeIds . has ( e . target ) ,
120+ )
121+ return { ...rawData , nodes, edges }
122+ } , [ rawData ] )
123+
115124 // 1. Calculate stats about context counts and total units needed
116125 const { calculatedCtxCounts, totalUnits } = useMemo ( ( ) => {
117126 if ( ! data . nodes . length ) {
Original file line number Diff line number Diff line change @@ -19,6 +19,7 @@ export const FeatureNodeSchema = z.object({
1919 activation : z . number ( ) ,
2020 feature : FeatureSchema ,
2121 qkTracingResults : QKTracingResultsSchema . nullish ( ) ,
22+ isFromQkTracing : z . boolean ( ) . default ( false ) ,
2223} )
2324
2425export type FeatureNode = z . infer < typeof FeatureNodeSchema >
@@ -29,6 +30,7 @@ export const TokenNodeSchema = z.object({
2930 layer : z . number ( ) ,
3031 ctxIdx : z . number ( ) ,
3132 token : z . string ( ) ,
33+ isFromQkTracing : z . boolean ( ) . default ( false ) ,
3234} )
3335
3436export type TokenNode = z . infer < typeof TokenNodeSchema >
@@ -38,6 +40,7 @@ export const ErrorNodeSchema = z.object({
3840 nodeId : z . string ( ) ,
3941 layer : z . number ( ) ,
4042 ctxIdx : z . number ( ) ,
43+ isFromQkTracing : z . boolean ( ) . default ( false ) ,
4144} )
4245
4346export type ErrorNode = z . infer < typeof ErrorNodeSchema >
@@ -49,6 +52,7 @@ export const LogitNodeSchema = z.object({
4952 ctxIdx : z . number ( ) ,
5053 tokenProb : z . number ( ) ,
5154 token : z . string ( ) ,
55+ isFromQkTracing : z . boolean ( ) . default ( false ) ,
5256} )
5357
5458export type LogitNode = z . infer < typeof LogitNodeSchema >
You can’t perform that action at this time.
0 commit comments