From 64616c3589ee3a443dd8f659a578067ed3852548 Mon Sep 17 00:00:00 2001 From: Riceball LEE Date: Mon, 16 Sep 2024 16:17:38 +0800 Subject: [PATCH] refactor!: freeze the lib folder, move lib to plugin-core --- lib/json.ai.yaml | 1 + lib/translator.ai.yaml | 7 +++++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/json.ai.yaml b/lib/json.ai.yaml index 3064724..f1a8365 100644 --- a/lib/json.ai.yaml +++ b/lib/json.ai.yaml @@ -71,6 +71,7 @@ system: |- Accurately Extract THE CONTENT input by the user as a JSON object according to THE OUTPUT JSON CONTENT FIELDS REQUIREMENTS specified by the user: user: |- THE OUTPUT JSON CONTENT FIELDS REQUIREMENTS: + json-schema: {{output}} --- THE CONTENT: diff --git a/lib/translator.ai.yaml b/lib/translator.ai.yaml index 93b5803..de7135a 100644 --- a/lib/translator.ai.yaml +++ b/lib/translator.ai.yaml @@ -58,16 +58,18 @@ parameters: $set: content: "@file({{file}})" - system: |- - You are the best translator in the world. + You are the best master of translation in the world. - $if: "this.content" then: # For API mode. + - $set: + source: "?=content" - $if: "!this.lang || this.lang === 'auto'" then: $set: lang: "?=this.$detectLang(content.slice(0, 120))" - user: |- - Output high-quality translation result before the completion delimiter "{{completion_delimiter}}". + Think carefully. Output very high-quality translation result before the completion delimiter "{{completion_delimiter}}". {% if terms %} Translation according to terms: {{terms}} @@ -83,6 +85,7 @@ parameters: {%- endif -%} - --- # First dialogue start and this will hide the above messages from output - assistant: "[[trans]]" # Return the last instruction's result always. So no need to `$ret: "?=this.prompt.trans"` + # - -> json(output=output, content='source_lang:'+lang +'\nsource_text:' + source + '\ntarget_lang:'+target + '\ntarget_text:' + content) else: # For multi-turn conversation in interactive mode. - ---