From b90a7c4180fb27fa47be66d0f700b43c1af8691c Mon Sep 17 00:00:00 2001 From: y00916259 Date: Sat, 10 May 2025 20:06:11 +0800 Subject: [PATCH] fix: resource paths error when rewrite basePath (#19068) --- .../model-provider-page/provider-icon/index.tsx | 3 +-- .../nodes/_base/components/editor/code-editor/index.tsx | 3 ++- web/app/routePrefixHandle.tsx | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/web/app/components/header/account-setting/model-provider-page/provider-icon/index.tsx b/web/app/components/header/account-setting/model-provider-page/provider-icon/index.tsx index 9dd4af468d..253269d920 100644 --- a/web/app/components/header/account-setting/model-provider-page/provider-icon/index.tsx +++ b/web/app/components/header/account-setting/model-provider-page/provider-icon/index.tsx @@ -1,6 +1,5 @@ import type { FC } from 'react' import type { ModelProvider } from '../declarations' -import { basePath } from '@/utils/var' import { useLanguage } from '../hooks' import { Openai } from '@/app/components/base/icons/src/vender/other' import { AnthropicDark, AnthropicLight } from '@/app/components/base/icons/src/public/llm' @@ -41,7 +40,7 @@ const ProviderIcon: FC = ({
provider-icon
diff --git a/web/app/components/workflow/nodes/_base/components/editor/code-editor/index.tsx b/web/app/components/workflow/nodes/_base/components/editor/code-editor/index.tsx index a185f16e2e..a6568efa89 100644 --- a/web/app/components/workflow/nodes/_base/components/editor/code-editor/index.tsx +++ b/web/app/components/workflow/nodes/_base/components/editor/code-editor/index.tsx @@ -4,6 +4,7 @@ import Editor, { loader } from '@monaco-editor/react' import React, { useEffect, useMemo, useRef, useState } from 'react' import Base from '../base' import cn from '@/utils/classnames' +import { basePath } from '@/utils/var' import { CodeLanguage } from '@/app/components/workflow/nodes/code/types' import { getFilesInLogs, @@ -14,7 +15,7 @@ import './style.css' import { noop } from 'lodash-es' // load file from local instead of cdn https://github.com/suren-atoyan/monaco-react/issues/482 -loader.config({ paths: { vs: '/vs' } }) +loader.config({ paths: { vs: `${basePath}/vs` } }) const CODE_EDITOR_LINE_HEIGHT = 18 diff --git a/web/app/routePrefixHandle.tsx b/web/app/routePrefixHandle.tsx index 16ed480000..26777e5c37 100644 --- a/web/app/routePrefixHandle.tsx +++ b/web/app/routePrefixHandle.tsx @@ -10,7 +10,7 @@ export default function RoutePrefixHandle() { const addPrefixToImg = (e: HTMLImageElement) => { const url = new URL(e.src) const prefix = url.pathname.substr(0, basePath.length) - if (prefix !== basePath) { + if (prefix !== basePath && !url.pathname.includes('/console/api')) { url.pathname = basePath + url.pathname e.src = url.toString() }