From be136e8c13b9fca3322937d271f29c9734ed6118 Mon Sep 17 00:00:00 2001 From: zhaoyingbo Date: Wed, 5 Feb 2025 10:45:13 +0000 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=B7=BB=E5=8A=A0=E9=94=99=E8=AF=AF?= =?UTF-8?q?=E6=98=A0=E5=B0=84=E4=BB=A5=E5=A2=9E=E5=BC=BAMIFY=E7=88=AC?= =?UTF-8?q?=E8=99=AB=E7=9A=84=E9=94=99=E8=AF=AF=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- services/attach/index.ts | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/services/attach/index.ts b/services/attach/index.ts index 978edd3..74864d8 100644 --- a/services/attach/index.ts +++ b/services/attach/index.ts @@ -106,6 +106,11 @@ class AttachService extends NetToolBase { */ async mifyCrawler(link: string, userDescription: string) { const URL = "https://mify-be.pt.xiaomi.com/api/v1/workflows/run" + const errMap: Record = { + crawlerErr: "网页抓取失败", + larkErr: "文档获取失败或者文档为空", + authErr: "请确保小煎蛋有对文档的读取权限,可以私发小煎蛋设置权限", + } return this.post( URL, { @@ -124,11 +129,14 @@ class AttachService extends NetToolBase { .then((res) => { const llmRes = res.data.outputs.content if (!llmRes) throw new Error("模型总结失败") - if (llmRes === "crawlerErr") throw new Error("网页抓取失败") + if (errMap[llmRes]) throw new Error(errMap[llmRes]) return llmRes as string }) .catch((error) => { - if (["网页抓取失败", "模型总结失败"].includes(error.message)) { + if ( + Object.values(errMap).includes(error.message) || + error.message === "模型总结失败" + ) { throw error } throw new Error("MIFY爬虫请求失败")