Merge branch 'master' of http://192.168.0.200/knowledge-base-bj/deerflow-code into master-nj
This commit is contained in:
commit
c4d244881f
14 files changed
+1194
-107
No files matched your search
+19
-5
@@ -55,6 +55,23 @@ function postThemeToFrame(frame: HTMLIFrameElement | null) {
|
||||
frame.contentWindow.postMessage(collectThemePayload(), targetOrigin);
|
||||
}
|
||||
|
||||
const WEKNORA_BACKEND_PREFIX = "/deerflow";
|
||||
|
||||
function buildFrameUrl(framePath: string) {
|
||||
const backendBase = getBackendBaseURL().replace(/\/+$/, "");
|
||||
const backendOrigin = backendBase
|
||||
? new URL(backendBase, window.location.origin).origin
|
||||
: window.location.origin;
|
||||
if (/^https?:\/\//i.test(framePath)) return new URL(framePath);
|
||||
if (framePath.startsWith("/")) {
|
||||
const path = !framePath.startsWith(`${WEKNORA_BACKEND_PREFIX}/`)
|
||||
? `${WEKNORA_BACKEND_PREFIX}${framePath}`
|
||||
: framePath;
|
||||
return new URL(path, backendOrigin);
|
||||
}
|
||||
return new URL(`${backendBase || backendOrigin}/${framePath.replace(/^\/+/, "")}`);
|
||||
}
|
||||
|
||||
export function WeKnoraKnowledgeDetailPage() {
|
||||
const {
|
||||
knowledge_base_id: strategyKnowledgeBaseId,
|
||||
@@ -87,11 +104,8 @@ 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 nextUrl = buildFrameUrl(framePath);
|
||||
nextUrl.searchParams.set("theme", collectThemePayload().theme);
|
||||
setFrameSrc(nextUrl.toString());
|
||||
})
|
||||
|
||||
Reference in new issue
Block a user