Skip to content

Commit

Permalink
Support any extension on another server
Browse files Browse the repository at this point in the history
  • Loading branch information
oeway committed Apr 11, 2024
1 parent ebfe2c9 commit 1e7998d
Showing 1 changed file with 24 additions and 1 deletion.
25 changes: 24 additions & 1 deletion public/chat/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -1385,7 +1385,30 @@ <h3 class="text-center">Welcome to BioImage.IO Chatbot</h3>
for (let ext of extension_services) {
try {
console.log("Getting extension service:", ext)
const extSvc = await server.getService(ext)
let svcId, extServer;
debugger
// format my_workspace/client:[email protected]
if(ext.includes("@")){
svcId = ext.split("@")[0]
const serverUrl = ext.split("@")[1]
try{
const server = await hyphaWebsocketClient.connectToServer({
"server_url": `https://${serverUrl}`,
"token": token,
})
extServer = server
}
catch(e){
console.error("Failed to connect to extension server:", serverUrl, e)
alert(`Failed to connect to extension server: ${serverUrl}, error: ${e}`)
break;
}
}
else{
svcId = ext
extServer = server
}
const extSvc = await extServer.getService(svcId)
console.log("Got extension service:", ext, extSvc)
extSvc._rintf = true
extSvc.id = extSvc.id.split(":")[1]
Expand Down

0 comments on commit 1e7998d

Please sign in to comment.