Skip to content

Commit

Permalink
[HOTFIX] Fix bug in script loading in AgentScope Studio (#371)
Browse files Browse the repository at this point in the history
  • Loading branch information
pan-x-c authored Jul 30, 2024
1 parent fc1f670 commit 9f01064
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions src/agentscope/studio/static/js/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,18 @@ let activeExpanded = false;

// Check if the script is already loaded
function isScriptLoaded(src) {
let curURL = new URL(src, window.location.href).pathname;
return Array.from(document.scripts).some((script) => {
return (
new URL(script.src).pathname ===
new URL(src, window.location.href).pathname
);
try {
let existURL = new URL(script.src).pathname;
return existURL === curURL;
} catch (error) {
console.warn(
"Error occurred when checking if the script is loaded: ",
error
);
return false;
}
});
}

Expand Down

0 comments on commit 9f01064

Please sign in to comment.