From e9e930018f789b209a3945666e707ccc504b5713 Mon Sep 17 00:00:00 2001 From: dolphin Date: Tue, 20 Aug 2024 15:39:53 +0800 Subject: [PATCH 1/4] fix: spark default url --- src/frontend/src/pages/ModelPage/manage/CustomForm.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/frontend/src/pages/ModelPage/manage/CustomForm.tsx b/src/frontend/src/pages/ModelPage/manage/CustomForm.tsx index b4d7587b7..ab9249c8a 100644 --- a/src/frontend/src/pages/ModelPage/manage/CustomForm.tsx +++ b/src/frontend/src/pages/ModelPage/manage/CustomForm.tsx @@ -196,7 +196,7 @@ const modelProviders = { label: "Base Url", type: "text", placeholder: "", - default: "https://open.bigmodel.cn/api/paas/v4/", + default: "https://spark-api-open.xf-yun.com/v1", required: true, key: "openai_api_base", } From c1c98443963aa5de800651bea889b8b1d3010efa Mon Sep 17 00:00:00 2001 From: dolphin Date: Tue, 20 Aug 2024 19:51:51 +0800 Subject: [PATCH 2/4] fix: get default api_key in tools --- src/frontend/src/pages/SkillPage/components/ToolSet.tsx | 5 +++-- src/frontend/vite.config.ts | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/frontend/src/pages/SkillPage/components/ToolSet.tsx b/src/frontend/src/pages/SkillPage/components/ToolSet.tsx index 351d184a6..fa54577e5 100644 --- a/src/frontend/src/pages/SkillPage/components/ToolSet.tsx +++ b/src/frontend/src/pages/SkillPage/components/ToolSet.tsx @@ -51,12 +51,13 @@ const ToolSet = forwardRef(function ToolSet({ onChange }, ref) { if (configStr) { const config = JSON.parse(configStr); config.provider = config.azure_deployment ? 'azure' : 'openai'; + const apiKey = config.openai_api_key if (config.provider === 'openai') { - config.openai_api_key = config.openai_api_key; + config.openai_api_key = apiKey; config.azure_api_key = '' } else { config.openai_api_key = ''; - config.azure_api_key = config.openai_api_key; + config.azure_api_key = apiKey; } setFormData(config); } else { diff --git a/src/frontend/vite.config.ts b/src/frontend/vite.config.ts index 1e1b27c25..e4961c47a 100644 --- a/src/frontend/vite.config.ts +++ b/src/frontend/vite.config.ts @@ -6,7 +6,7 @@ import { viteStaticCopy } from 'vite-plugin-static-copy'; import svgr from "vite-plugin-svgr"; // Use environment variable to determine the target. -const target = process.env.VITE_PROXY_TARGET || "https://bisheng.dataelem.com/"; +const target = process.env.VITE_PROXY_TARGET || "http://192.168.106.120:3002"; const apiRoutes = ["^/api/", "/health"]; const proxyTargets = apiRoutes.reduce((proxyObj, route) => { From 6305b5d2290ba1c57c412fa456a58c43972ded75 Mon Sep 17 00:00:00 2001 From: GuoQing Zhang Date: Tue, 20 Aug 2024 22:29:19 +0800 Subject: [PATCH 3/4] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=E8=A7=A3=E9=87=8A=E5=99=A8=E5=B7=A5=E5=85=B7=E6=9B=BF=E6=8D=A2?= =?UTF-8?q?=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/backend/bisheng/chat/client.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/backend/bisheng/chat/client.py b/src/backend/bisheng/chat/client.py index 4909a247d..c02fa262f 100644 --- a/src/backend/bisheng/chat/client.py +++ b/src/backend/bisheng/chat/client.py @@ -268,9 +268,10 @@ async def handle_gpts_message(self, message: Dict[any, any]): # todo: 后续优化代码解释器的实现方案,保证输出的文件可以公开访问 ugly solve # 获取minio的share地址,把share域名去掉, 为毕昇的部署方案特殊处理下 - if gpts_tool_conf := self.gpts_conf.get('tools'): - if bisheng_code_conf := gpts_tool_conf.get("bisheng_code_interpreter"): - answer = answer.replace(f"http://{bisheng_code_conf['minio']['MINIO_SHAREPOIN']}", "") + for one in self.gpts_agent.tools: + if one.name == "bisheng_code_interpreter": + minio_share = settings.get_knowledge().get('minio', {}).get('MINIO_SHAREPOIN', '') + answer = answer.replace(f"http://{minio_share}", "") answer_end_type = 'end' # 如果是流式的llm则用end_cover结束, 覆盖之前流式的输出 if getattr(self.gpts_agent.llm, 'streaming', False): From b1e0d66db17c3052f28a298ef6f8aa68b52ce607 Mon Sep 17 00:00:00 2001 From: GuoQing Zhang Date: Tue, 20 Aug 2024 22:59:13 +0800 Subject: [PATCH 4/4] =?UTF-8?q?ci:=20=E4=BF=AE=E6=94=B9cicd=E6=8B=B7?= =?UTF-8?q?=E8=B4=9Dnltk=E7=9A=84=E6=95=B0=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/ci.yml | 2 +- src/backend/Dockerfile | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3ee788f25..ea3a390e3 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -99,7 +99,7 @@ jobs: # 安装 nltk pip install nltk python -c "import nltk; nltk.download('punkt'); nltk.download('averaged_perceptron_tagger')" - mv /home/runner/nltk_data/taggers ./ + mv /home/runner/nltk_data ./ cd ../../ - name: Build backend and push diff --git a/src/backend/Dockerfile b/src/backend/Dockerfile index 9207973b7..6b79e7b41 100644 --- a/src/backend/Dockerfile +++ b/src/backend/Dockerfile @@ -18,7 +18,7 @@ ENV PATH="${PATH}:/root/.local/bin" COPY ./ ./ # Install NLTK data -RUN mv -f ./taggers /root/nltk_data/ +RUN mv -f ./nltk_data /root/nltk_data/ RUN python -m pip install --upgrade pip && \ pip install shapely==2.0.1