From 0b1def9951ee3d0c1ef2696d44e36ce6c08b49aa Mon Sep 17 00:00:00 2001 From: jsbjfkbsjk <2504892220@qq.com> Date: Mon, 18 Aug 2025 16:20:26 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=BA=86readme?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 79dd6b420..acf1723f4 100644 --- a/README.md +++ b/README.md @@ -178,15 +178,15 @@ npm run start 在对话中使用大模型功能,需要对模型进行配置,包括大模型的地址和鉴权信息。 首先在首页的`应用市场`一栏中找到 `模型配置应用`,并点击该应用。点击右上角`创意灵感` 的`开始配置`,如下图所示: -![image-20250508203127410](doc\images\readme\model_config_inspiration.png) +![image-20250508203127410](doc/images/readme/model_config_inspiration.png) 然后点击回答的 `添加模型` 按钮,输入模型名称、API Key 和模型地址,并点击确认。此时模型添加成功。 **应用创建** 在首页的`应用开发`一栏中点击`创建空白应用`。如下所示: -![image-20250508204618312](doc\images\readme\app_create.png) +![image-20250508204618312](doc/images/readme/app_create.png) 输入所要创建的应用名称和简介,并点击 `创建`按钮,即可创建 AI 应用。接着在跳转后的应用配置页面上,在 `大模型` 一栏中选择自定义配置的模型。此时即可在对话框进行对话。如下所示: -![image-20250508205124203](doc\images\readme\app_chat.png) +![image-20250508205124203](doc/images/readme/app_chat.png) ## 文档 From 127c8eec81b85125e8632bd63de97e4ad5346a3b Mon Sep 17 00:00:00 2001 From: jsbjfkbsjk <2504892220@qq.com> Date: Thu, 21 Aug 2025 12:25:24 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E4=BA=86=E5=BA=94?= =?UTF-8?q?=E7=94=A8=E5=A4=8D=E5=88=B6=E5=90=8E=E5=A4=B4=E5=83=8F=E6=B2=A1?= =?UTF-8?q?=E6=9C=89=E8=A2=AB=E5=A4=8D=E5=88=B6=E7=9A=84issue?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/pages/appDev/components/copy-app.tsx | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/frontend/src/pages/appDev/components/copy-app.tsx b/frontend/src/pages/appDev/components/copy-app.tsx index 0eab5cd5a..54dec7889 100644 --- a/frontend/src/pages/appDev/components/copy-app.tsx +++ b/frontend/src/pages/appDev/components/copy-app.tsx @@ -36,17 +36,13 @@ const CopyApp = ({ copyRef }) => { openModal: (appInfo) => dataInit(appInfo), }; }); - // 初始化数据 const dataInit = (appInfo) => { setAppInfo(appInfo); form.setFieldsValue({ name: appInfo.name, - icon: appInfo.attributes?.icon, + icon: '', }); - if (appInfo.attributes?.icon) { - setFilePath(appInfo.attributes.icon); - } setOpen(true); } // 复制应用 @@ -58,7 +54,7 @@ const CopyApp = ({ copyRef }) => { const copyParam = { name: formParams.name, description: attributes.description, - icon: '', + icon: filePath, app_type: attributes.app_type, app_built_type: appBuiltType, type, @@ -98,9 +94,9 @@ const CopyApp = ({ copyRef }) => {
- setFilePath(path)} />
@@ -119,7 +115,7 @@ const CopyApp = ({ copyRef }) => { >
-
+ From 161f88c12f8aa11f2e6fea042cf95165547e5c7c Mon Sep 17 00:00:00 2001 From: jsbjfkbsjk <2504892220@qq.com> Date: Fri, 22 Aug 2025 16:34:04 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E4=BA=86=E5=BA=94?= =?UTF-8?q?=E7=94=A8=E5=A4=8D=E5=88=B6=E5=90=8E=E5=A4=B4=E5=83=8F=E6=B2=A1?= =?UTF-8?q?=E6=9C=89=E8=A2=AB=E5=A4=8D=E5=88=B6=E7=9A=84issue?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/components/file-upload/index.tsx | 2 +- .../src/pages/appDev/components/copy-app.tsx | 34 ++++++++++++++++--- frontend/src/pages/components/edit-modal.tsx | 6 ++-- 3 files changed, 35 insertions(+), 7 deletions(-) diff --git a/frontend/src/components/file-upload/index.tsx b/frontend/src/components/file-upload/index.tsx index 654bb0b2c..8bafa21a2 100644 --- a/frontend/src/components/file-upload/index.tsx +++ b/frontend/src/components/file-upload/index.tsx @@ -58,7 +58,7 @@ const UploadImg = ({ appId = '', icon = '', uploadSuccess }) => { let res: any = await uploadChatFile(TENANT_ID, appId, formData, headers); if (res.code === 0) { const path = `${AIPP_URL}/${TENANT_ID}/file?filePath=${res.data.file_path}&fileName=${res.data.file_name}`; - uploadSuccess(path); + uploadSuccess(res.data.file_path); getImgPath(path); } } catch (err) { diff --git a/frontend/src/pages/appDev/components/copy-app.tsx b/frontend/src/pages/appDev/components/copy-app.tsx index 54dec7889..9346683db 100644 --- a/frontend/src/pages/appDev/components/copy-app.tsx +++ b/frontend/src/pages/appDev/components/copy-app.tsx @@ -13,7 +13,8 @@ import { Message } from '@/shared/utils/message'; import { convertImgPath } from '@/common/util'; import { TENANT_ID } from '@/pages/chatPreview/components/send-editor/common/config'; import UploadImg from '@/components/file-upload'; - +import serviceConfig from "@/shared/http/httpConfig"; +import { uploadChatFile } from '@/shared/http/aipp'; /** * 复制应用 * @@ -21,7 +22,7 @@ import UploadImg from '@/components/file-upload'; * @return {JSX.Element} * @constructor */ - +const { AIPP_URL } = serviceConfig; const CopyApp = ({ copyRef }) => { const { t } = useTranslation(); const [form] = Form.useForm(); @@ -30,6 +31,7 @@ const CopyApp = ({ copyRef }) => { const [loading, setLoading] = useState(false); const [appInfo, setAppInfo] = useState({}); const navigate = useHistory().push; + const tenantId = TENANT_ID; useImperativeHandle(copyRef, () => { return { @@ -43,8 +45,29 @@ const CopyApp = ({ copyRef }) => { name: appInfo.name, icon: '', }); + + if (appInfo.attributes.icon) { + reuploadIcon(appInfo.attributes.icon) + } setOpen(true); + } + //重新上传图片 + const reuploadIcon = async (iconUrl) => { + const res = await fetch(iconUrl); + const blob = await res.blob(); + const file = new File([blob], "clone.png", { type: blob.type }); + const formData = new FormData(); + formData.append("file", file); + let uploadRes = await uploadChatFile(TENANT_ID, appInfo.id, formData, { + 'attachment-filename': encodeURI(file.name), + 'Content-Type': 'multipart/form-data', + }); + if (uploadRes.code === 0) { + const realPath = uploadRes.data.file_path.replace(/^.*[\\/]/, ""); + setFilePath(realPath); //存文件名 + } + }; // 复制应用 const handleCopyApp = async () => { try { @@ -96,8 +119,11 @@ const CopyApp = ({ copyRef }) => {
setFilePath(path)} + icon={`${AIPP_URL}/${tenantId}/file?filePath=/var/share/${filePath}&fileName=${filePath}`} + uploadSuccess={(path: string) =>{ + const realPath = path.replace(/^.*[\\/]/, ""); + setFilePath(realPath); + }} />
diff --git a/frontend/src/pages/components/edit-modal.tsx b/frontend/src/pages/components/edit-modal.tsx index eec55cd19..341af6ab0 100644 --- a/frontend/src/pages/components/edit-modal.tsx +++ b/frontend/src/pages/components/edit-modal.tsx @@ -298,8 +298,10 @@ const EditModal = (props) => { formData.append('file', file); let res: any = await uploadChatFile(tenantId, appId, formData, headers); if (res.code === 0) { - let path = `${AIPP_URL}/${tenantId}/file?filePath=${res.data.file_path}&fileName=${res.data.file_name}`; - setFilePath(path); + const realPath = res.data.file_path.replace(/^.*[\\/]/, ""); + setFilePath(realPath); + const realPath2 = `/var/share/${realPath}`; + let path = `${AIPP_URL}/${tenantId}/file?filePath=${realPath2}&fileName=${realPath}`; convertImgPath(path).then(res => { setImgPath(res); });