fix: preserve WeKnora embed proxy prefix
This commit is contained in:
1 parent
3aeb6ac5ce
commit
6dbaf40f99
3 files changed
+180
-17
No files matched your search
+10
-5
@@ -87,11 +87,16 @@ export function WeKnoraKnowledgeDetailPage() {
|
||||
void createLlmWikiWeKnoraEmbedSession(knowledgeBaseId, preferredTab)
|
||||
.then((session) => {
|
||||
if (cancelled) return;
|
||||
const base = getBackendBaseURL().replace(/\/+$/, "");
|
||||
const path = session.frame_path.startsWith("/")
|
||||
? session.frame_path
|
||||
: `/${session.frame_path}`;
|
||||
const nextUrl = new URL(`${base}${path}`);
|
||||
const framePath = session.frame_path || "";
|
||||
const backendBase = getBackendBaseURL().replace(/\/+$/, "");
|
||||
const backendOrigin = backendBase
|
||||
? new URL(backendBase, window.location.origin).origin
|
||||
: window.location.origin;
|
||||
const nextUrl = /^https?:\/\//i.test(framePath)
|
||||
? new URL(framePath)
|
||||
: framePath.startsWith("/")
|
||||
? new URL(framePath, backendOrigin)
|
||||
: new URL(`${backendBase || backendOrigin}/${framePath.replace(/^\/+/, "")}`);
|
||||
nextUrl.searchParams.set("theme", collectThemePayload().theme);
|
||||
setFrameSrc(nextUrl.toString());
|
||||
})
|
||||
|
||||
Reference in new issue
Block a user