File tree Expand file tree Collapse file tree 1 file changed +17
-0
lines changed
Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -7,6 +7,7 @@ export class ExtensionScope {
77 constructor ( ctx , id ) {
88 /**@type {AppContext } */
99 this . ctx = ctx
10+ this . router = ctx . router
1011 this . id = id
1112 this . baseUrl = `${ ctx . ai . base } /ext/${ this . id } `
1213 this . storageKey = `llms.${ this . id } `
@@ -97,6 +98,22 @@ export class ExtensionScope {
9798 toast ( msg ) {
9899 this . ctx . toast ( msg )
99100 }
101+ to ( route ) {
102+ if ( typeof route == 'string' ) {
103+ route = route . startsWith ( this . baseUrl )
104+ ? route
105+ : combinePaths ( this . baseUrl , route )
106+ const path = { path : route }
107+ console . log ( `to/${ this . id } ` , path )
108+ this . router . push ( path )
109+ } else {
110+ route . path = route . path . startsWith ( this . baseUrl )
111+ ? route . path
112+ : combinePaths ( this . baseUrl , route . path )
113+ console . log ( `to/${ this . id } ` , route )
114+ this . router . push ( route )
115+ }
116+ }
100117}
101118
102119export class AppContext {
You can’t perform that action at this time.
0 commit comments