Skip to content

Commit

Permalink
fix(toolbox): 忘了 Claude 不认识全角引号了
Browse files Browse the repository at this point in the history
  • Loading branch information
mark9804 committed Jun 22, 2024
1 parent d788b18 commit 20825de
Showing 1 changed file with 4 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand All @@ -56,7 +53,7 @@ const rag_request = {
temperature: 0,
system:
/* eslint-disable-next-line max-len */
"你是一名日语语言学专家。你需要解析用户给出的句子成分,并将句子成分以json格式返回。将原句中的'\n'解析为'未定義語'。",
"你是一名日语语言学专家。你需要解析用户给出的句子成分,并将句子成分以json格式返回。将原句中的'\n'解析为'未定義語',并转义原文中的引号。",
messages: [
{
role: "user",
Expand All @@ -81,7 +78,7 @@ const rag_request = {
content: [
{
type: "text",
text: "\\n",
text: '"\\n',
},
],
},
Expand All @@ -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": "*"}]',
},
],
},
Expand Down

0 comments on commit 20825de

Please sign in to comment.