From 20825def5c6d6b0f7b777800d163823558b9ee78 Mon Sep 17 00:00:00 2001 From: Mark Chen <9006264+Mark9804@users.noreply.github.com> Date: Sun, 23 Jun 2024 00:00:07 +0900 Subject: [PATCH] =?UTF-8?q?fix(toolbox):=20=E5=BF=98=E4=BA=86=20Claude=20?= =?UTF-8?q?=E4=B8=8D=E8=AE=A4=E8=AF=86=E5=85=A8=E8=A7=92=E5=BC=95=E5=8F=B7?= =?UTF-8?q?=E4=BA=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../tools/public/helper/AnthropicSemanticParser.ts | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/apps/ba-online-toolbox/src/tools/public/helper/AnthropicSemanticParser.ts b/apps/ba-online-toolbox/src/tools/public/helper/AnthropicSemanticParser.ts index d5d7e219..d3fb9688 100644 --- a/apps/ba-online-toolbox/src/tools/public/helper/AnthropicSemanticParser.ts +++ b/apps/ba-online-toolbox/src/tools/public/helper/AnthropicSemanticParser.ts @@ -44,10 +44,7 @@ const instance = axios.create({ function distillText(text: string) { // replace all square brackets and contents inside, "\\"" with "" const regexp = /\[.*?\]|\\"|\s/g; - return text - .replaceAll(regexp, "") - .replaceAll("#n", "\n") - .replaceAll(""", ""); + return text.replaceAll(regexp, "").replaceAll("#n", "\n"); } const rag_request = { @@ -56,7 +53,7 @@ const rag_request = { temperature: 0, system: /* eslint-disable-next-line max-len */ - "你是一名日语语言学专家。你需要解析用户给出的句子成分,并将句子成分以json格式返回。将原句中的'\n'解析为'未定義語'。", + "你是一名日语语言学专家。你需要解析用户给出的句子成分,并将句子成分以json格式返回。将原句中的'\n'解析为'未定義語',并转义原文中的引号。", messages: [ { role: "user", @@ -81,7 +78,7 @@ const rag_request = { content: [ { type: "text", - text: "\\n", + text: '"\\n', }, ], }, @@ -90,7 +87,7 @@ const rag_request = { content: [ { type: "text", - text: '[{"word": "\\n","furigana": "\\n","basic_form": "\\n","word_type": "未定義語","word_sub_type": "その他","conjungation_type": "*","conjungation_form": "*"}]', + text: '[{"word": "\\"","furigana": "\\"","basic_form": "\\"","word_type": "未定義語","word_sub_type": "その他","conjungation_type": "*","conjungation_form": "*"}{"word": "\\n","furigana": "\\n","basic_form": "\\n","word_type": "未定義語","word_sub_type": "その他","conjungation_type": "*","conjungation_form": "*"}]', }, ], },