-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
12 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1386,14 +1386,19 @@ <h3 class="text-center">Welcome to BioImage.IO Chatbot</h3> | |
try { | ||
console.log("Getting extension service:", ext) | ||
let svcId, extServer; | ||
debugger | ||
// format my_workspace/client:[email protected] | ||
if(ext.includes("@")){ | ||
svcId = ext.split("@")[0] | ||
const serverUrl = ext.split("@")[1] | ||
// Full service url format: https://ai.imjoy.io/<workspace>/services/<service_id> | ||
if(ext.startsWith("http")){ | ||
// service id should be resolved to "<workspace>/<service_id>" (remove services) | ||
let url = new URL(ext); | ||
let pathParts = url.pathname.split('/'); | ||
let workspace = pathParts[1]; // assuming the workspace is the first part of the path | ||
let serviceId = pathParts[3]; // assuming the service ID is the third part of the path | ||
svcId = `${workspace}/${serviceId}`; | ||
|
||
const serverUrl = url.origin; | ||
try{ | ||
const server = await hyphaWebsocketClient.connectToServer({ | ||
"server_url": `https://${serverUrl}`, | ||
"server_url": serverUrl, | ||
"token": token, | ||
}) | ||
extServer = server | ||
|
@@ -1409,7 +1414,7 @@ <h3 class="text-center">Welcome to BioImage.IO Chatbot</h3> | |
extServer = server | ||
} | ||
const extSvc = await extServer.getService(svcId) | ||
console.log("Got extension service:", ext, extSvc) | ||
console.log("Got extension service:", svcId, extSvc) | ||
extSvc._rintf = true | ||
extSvc.id = extSvc.id.split(":")[1] | ||
await _registerExtension(extSvc) | ||
|