@@ -242,7 +242,7 @@ const useBuild = () => {
let validationResults = [];
let finished = false;
let buildEnd = false
- const apiUrl = `/api/v1/build/stream/${flowId}?chat_id=${chatId}`;
+ const apiUrl = `${__APP_ENV__.BASE_URL}/api/v1/build/stream/${flowId}?chat_id=${chatId}`;
const eventSource = new EventSource(apiUrl);
eventSource.onmessage = (event) => {
diff --git a/src/frontend/src/pages/ChatAppPage/components/FileView.tsx b/src/frontend/src/pages/ChatAppPage/components/FileView.tsx
index d82289cad..d21769a28 100644
--- a/src/frontend/src/pages/ChatAppPage/components/FileView.tsx
+++ b/src/frontend/src/pages/ChatAppPage/components/FileView.tsx
@@ -144,7 +144,7 @@ export default function FileView({ data }) {
// sass环境使用sass地址
const pdfUrl = checkSassUrl(data.fileUrl); // '/doc.pdf';
- pdfjsLib.GlobalWorkerOptions.workerSrc = '/pdf.worker.min.js';
+ pdfjsLib.GlobalWorkerOptions.workerSrc = __APP_ENV__.BASE_URL + '/pdf.worker.min.js';
pdfjsLib.getDocument(pdfUrl).promise.then((pdfDocument) => {
setLoading(false)
setPdf(pdfDocument)
diff --git a/src/frontend/src/pages/DiffFlowPage/components/RunTest.tsx b/src/frontend/src/pages/DiffFlowPage/components/RunTest.tsx
index 5e8118598..e8d27511c 100644
--- a/src/frontend/src/pages/DiffFlowPage/components/RunTest.tsx
+++ b/src/frontend/src/pages/DiffFlowPage/components/RunTest.tsx
@@ -260,7 +260,7 @@ const useBuild = () => {
let finished = false;
let buildEnd = false
const qstr = flow.id ? `?version_id=${flow.id}` : ''
- const apiUrl = `/api/v1/build/stream/${flowId}${qstr}`;
+ const apiUrl = `${__APP_ENV__.BASE_URL}/api/v1/build/stream/${flowId}${qstr}`;
const eventSource = new EventSource(apiUrl);
eventSource.onmessage = (event) => {
diff --git a/src/frontend/src/pages/EvaluationPage/EvaluationCreate.tsx b/src/frontend/src/pages/EvaluationPage/EvaluationCreate.tsx
index f89aed713..c17237abc 100644
--- a/src/frontend/src/pages/EvaluationPage/EvaluationCreate.tsx
+++ b/src/frontend/src/pages/EvaluationPage/EvaluationCreate.tsx
@@ -62,12 +62,12 @@ export default function EvaluatingCreate() {
const errorlist = [];
// 限制文件最大为 10M
- if(size > 10 * 1024 * 1024){
+ if (size > 10 * 1024 * 1024) {
errorlist.push(t("evaluation.fileSizeLimit"));
fileRef.current = null
return handleError(errorlist);
}
-
+
const names = acceptedFiles[0].name;
setFileName(names);
};
@@ -131,7 +131,7 @@ export default function EvaluatingCreate() {
const handleDownloadTemplate = () => {
const link = document.createElement("a");
- link.href = "/template.csv"; // 文件路径
+ link.href = __APP_ENV__.BASE_URL + "/template.csv"; // 文件路径
link.download = "template.csv"; // 下载时的文件名
document.body.appendChild(link);
link.click();
@@ -140,15 +140,15 @@ export default function EvaluatingCreate() {
const handleSearch = useCallback(debounce((value) => {
if (selectedType === "flow") {
- readFlowsFromDatabase(1, 100, value).then((_flow) => {
- setDataSource(_flow.data);
- });
- } else if (selectedType === "assistant") {
- getAssistantsApi(1, 100, value).then((data) => {
- setDataSource((data as any).data as AssistantItemDB[]);
- });
- }
- }, 300),[selectedType])
+ readFlowsFromDatabase(1, 100, value).then((_flow) => {
+ setDataSource(_flow.data);
+ });
+ } else if (selectedType === "assistant") {
+ getAssistantsApi(1, 100, value).then((data) => {
+ setDataSource((data as any).data as AssistantItemDB[]);
+ });
+ }
+ }, 300), [selectedType])
const handleInputChange = (event) => {
setQuery(event.target.value);
@@ -157,7 +157,7 @@ export default function EvaluatingCreate() {
useEffect(() => {
return () => {
- handleSearch.cancel();
+ handleSearch.cancel();
};
}, [handleSearch]);
diff --git a/src/frontend/src/pages/LoginPage/login.tsx b/src/frontend/src/pages/LoginPage/login.tsx
index fdf725515..abe9311b3 100644
--- a/src/frontend/src/pages/LoginPage/login.tsx
+++ b/src/frontend/src/pages/LoginPage/login.tsx
@@ -62,7 +62,7 @@ export const LoginPage = () => {
// setUser(res.data)
localStorage.setItem('ws_token', res.access_token)
localStorage.setItem('isLogin', '1')
- location.href = '/'
+ location.href = __APP_ENV__.BASE_URL + '/'
}), (error) => {
if (error.indexOf('过期') !== -1) { // 有时间改为 code 判断
localStorage.setItem('account', mail)
@@ -119,13 +119,13 @@ export const LoginPage = () => {
return
-
+
{t('login.slogen')}
diff --git a/src/frontend/src/pages/LoginPage/resetPwd.tsx b/src/frontend/src/pages/LoginPage/resetPwd.tsx
index eaee5a54c..ce9c90f88 100644
--- a/src/frontend/src/pages/LoginPage/resetPwd.tsx
+++ b/src/frontend/src/pages/LoginPage/resetPwd.tsx
@@ -84,7 +84,7 @@ export const ResetPwdPage = () => {
>
}
-
+
{t('resetPassword.slogen')}
diff --git a/src/frontend/src/pages/ModelPage/doc.tsx b/src/frontend/src/pages/ModelPage/doc.tsx
index 24b587de5..bc02bea03 100644
--- a/src/frontend/src/pages/ModelPage/doc.tsx
+++ b/src/frontend/src/pages/ModelPage/doc.tsx
@@ -201,7 +201,7 @@ export default function Doc() {
// const [loading, setLoading] = useState(true)
useEffect(() => {
- var link = '/doc.pdf'
+ var link = __APP_ENV__.BASE_URL + '/doc.pdf'
var iframe: any = document.getElementById('iframe')
diff --git a/src/frontend/src/pages/Page403.tsx b/src/frontend/src/pages/Page403.tsx
index 44e08fef4..79206f642 100644
--- a/src/frontend/src/pages/Page403.tsx
+++ b/src/frontend/src/pages/Page403.tsx
@@ -13,7 +13,7 @@ export default function Page403() {
diff --git a/src/frontend/src/pages/Report/components/Word.tsx b/src/frontend/src/pages/Report/components/Word.tsx
index 97e712eb7..9e93026ab 100644
--- a/src/frontend/src/pages/Report/components/Word.tsx
+++ b/src/frontend/src/pages/Report/components/Word.tsx
@@ -6,7 +6,7 @@ export default function Word({ data }) {
const { appConfig } = useContext(locationContext)
const wordUrl = appConfig.officeUrl
- const backUrl = location.origin + '/api/v1/report/callback' // 后端服务地址
+ const backUrl = `${location.origin}${__APP_ENV__.BASE_URL}/api/v1/report/callback` // 后端服务地址
const editorConfig = {
// 编辑器宽度
@@ -55,8 +55,8 @@ export default function Word({ data }) {
unit: "cm",
uiTheme: "theme-dark",
logo: {
- "image": location.origin + "/logo.jpeg",
- "imageDark": location.origin + "/logo.jpeg",
+ "image": location.origin + __APP_ENV__.BASE_URL + "/logo.jpeg",
+ "imageDark": location.origin + __APP_ENV__.BASE_URL + "/logo.jpeg",
"url": "https://example.com"
}
},
diff --git a/src/frontend/src/pages/Report/index.tsx b/src/frontend/src/pages/Report/index.tsx
index 2a22ad30a..5a4d63cbe 100644
--- a/src/frontend/src/pages/Report/index.tsx
+++ b/src/frontend/src/pages/Report/index.tsx
@@ -88,7 +88,7 @@ const useReport = () => {
setDocx({
...docx,
// path: 'http://192.168.106.120:3002/empty.docx'
- path: location.origin + '/empty.docx' // 文档服务能访问到的文件地址
+ path: location.origin + __APP_ENV__.BASE_URL + '/empty.docx' // 文档服务能访问到的文件地址
})
}
diff --git a/src/frontend/src/pages/SkillPage/components/editAssistant/AutoPromptDialog.tsx b/src/frontend/src/pages/SkillPage/components/editAssistant/AutoPromptDialog.tsx
index 9dfb6720d..ce594cd63 100644
--- a/src/frontend/src/pages/SkillPage/components/editAssistant/AutoPromptDialog.tsx
+++ b/src/frontend/src/pages/SkillPage/components/editAssistant/AutoPromptDialog.tsx
@@ -27,7 +27,7 @@ export default function AutoPromptDialog({ onOpenChange }) {
const init = () => {
const prompt = areaRef.current.value
- const apiUrl = `/api/v1/assistant/auto?assistant_id=${id}&prompt=${encodeURIComponent(prompt)}`;
+ const apiUrl = `${__APP_ENV__.BASE_URL}/api/v1/assistant/auto?assistant_id=${id}&prompt=${encodeURIComponent(prompt)}`;
const eventSource = new EventSource(apiUrl);
areaRef.current.value = ''
let queue = LoadType.Prompt
diff --git a/src/frontend/src/pages/SkillPage/components/editAssistant/TestChat.tsx b/src/frontend/src/pages/SkillPage/components/editAssistant/TestChat.tsx
index e74335a33..ffd703a15 100644
--- a/src/frontend/src/pages/SkillPage/components/editAssistant/TestChat.tsx
+++ b/src/frontend/src/pages/SkillPage/components/editAssistant/TestChat.tsx
@@ -8,7 +8,7 @@ import { useTranslation } from "react-i18next";
export default function TestChat({ assisId, guideQuestion }) {
const token = localStorage.getItem("ws_token") || '';
- const wsUrl = `${location.host}/api/v1/assistant/chat/${assisId}?t=${token}`
+ const wsUrl = `${location.host}${__APP_ENV__.BASE_URL}/api/v1/assistant/chat/${assisId}?t=${token}`
const { messages, changeChatId } = useMessageStore()
const { assistantState } = useAssistantStore()
@@ -38,7 +38,7 @@ export default function TestChat({ assisId, guideQuestion }) {
return [msgData, inputKey]
}
- return
+ return
{t('build.debugPreview')}
diff --git a/src/frontend/src/routes.tsx b/src/frontend/src/routes.tsx
index ff8a6abd9..7939310a3 100755
--- a/src/frontend/src/routes.tsx
+++ b/src/frontend/src/routes.tsx
@@ -46,7 +46,7 @@ const ErrorHoc = ({ Comp }) => {
}
const baseConfig = {
- // basename: "/pro"
+ basename: __APP_ENV__.BASE_URL
}
diff --git a/src/frontend/src/store/diffFlowStore.tsx b/src/frontend/src/store/diffFlowStore.tsx
index f4e6c8035..5043b4d59 100644
--- a/src/frontend/src/store/diffFlowStore.tsx
+++ b/src/frontend/src/store/diffFlowStore.tsx
@@ -220,7 +220,7 @@ const runTest = ({ questions, questionIndexs, nodeId, versionIds, inputs, refs }
})
return new Promise((resolve, reject) => {
- const apiUrl = `/api/v1/flows/compare/stream?data=${encodeURIComponent(data)}`;
+ const apiUrl = `${__APP_ENV__.BASE_URL}/api/v1/flows/compare/stream?data=${encodeURIComponent(data)}`;
const eventSource = new EventSource(apiUrl);
eventSource.onmessage = (event) => {