diff --git a/langserve/playground/src/utils/url.ts b/langserve/playground/src/utils/url.ts index 88f40a4d..c72c7932 100644 --- a/langserve/playground/src/utils/url.ts +++ b/langserve/playground/src/utils/url.ts @@ -7,8 +7,9 @@ export function getStateFromUrl(path: string) { basePath = basePath.slice(0, -1); } - if (basePath.endsWith("/playground")) { - basePath = basePath.slice(0, -"/playground".length); + const newBasePath = basePath.replace(/\/playground(\/index.html)?$/, ""); + if (newBasePath !== basePath) { + basePath = newBasePath; } // check if we can omit the last segment