@@ -1983,7 +1983,10 @@ function isLocalUiCommand(text) {
19831983 // contain a UI keyword ("analyze this network and rank targets…").
19841984 const t = text . trim ( ) . toLowerCase ( ) ;
19851985 if ( t . length > 60 || t . includes ( "?" ) || t . split ( / \s + / ) . length > 8 ) return false ;
1986- return / ^ ( s h o w | t o p | s e t | u s e | p l a n | r o u t e | t r i p | g e n e r a t e | g e n e t e r r a i n | a n a l y z e | r e s c o r e | f i l t e r | l a y o u t | d e m a | f o r c e | o r g a n i c | w i p e r 1 | w i p e r 2 | r a w ) \b / . test ( t )
1986+ // "analyze", "geneterrain", "rescore" intentionally NOT here — those read as
1987+ // analysis / drug-target / cross-tool intent and belong to the copilot (which
1988+ // can also explain and rank). Only pure UI toggles / routing stay local.
1989+ return / ^ ( s h o w | t o p | s e t | u s e | p l a n | r o u t e | t r i p | g e n e r a t e | f i l t e r | l a y o u t | d e m a | f o r c e | o r g a n i c | w i p e r 1 | w i p e r 2 ) \b / . test ( t )
19871990 || / \b t o p \s + \d + \b / . test ( t ) || / \d + \s * % / . test ( t ) || / \d + \s + ( n o d e s ? | e d g e s ? | i t e r a t i o n s ? ) \b / . test ( t ) ;
19881991}
19891992
@@ -2001,11 +2004,17 @@ async function runCopilot(text) {
20012004 let bubble = null ;
20022005 let removedThinking = false ;
20032006 const dropThinking = ( ) => { if ( thinking && ! removedThinking ) { thinking . remove ( ) ; removedThinking = true ; } } ;
2007+ // Give the copilot the network currently loaded in the UI, so "analyze the
2008+ // network / this network / the current network" operates on what's on screen.
2009+ const edges = ( ( els . edgeText && els . edgeText . value ) || "" ) . trim ( ) ;
2010+ const message = edges
2011+ ? `[Currently loaded SPINNER network — when I refer to "the network", "this network", or "the current network", call spinner_analyze with exactly these edges:\n${ edges } \n]\n\n${ text } `
2012+ : text ;
20042013 try {
20052014 const resp = await fetch ( `${ AGENT_BASE } /agent/chat` , {
20062015 method : "POST" ,
20072016 headers : { "Content-Type" : "application/json" } ,
2008- body : JSON . stringify ( { session_id : AGENT_SESSION , message : text } ) ,
2017+ body : JSON . stringify ( { session_id : AGENT_SESSION , message } ) ,
20092018 } ) ;
20102019 if ( ! resp . ok || ! resp . body ) throw new Error ( "HTTP " + resp . status ) ;
20112020 const reader = resp . body . getReader ( ) ;
0 commit comments