From a97227743bb8b764aebdfc0dfc53e03eb5c854a9 Mon Sep 17 00:00:00 2001 From: Nasy Date: Mon, 13 Mar 2023 14:35:03 -0500 Subject: [PATCH 1/2] Add polish prompt and max tokens. --- src/info.json | 21 +++++++++++++++++++++ src/main.js | 6 +++--- 2 files changed, 24 insertions(+), 3 deletions(-) diff --git a/src/info.json b/src/info.json index c747332..3c34510 100644 --- a/src/info.json +++ b/src/info.json @@ -46,6 +46,27 @@ "value": "text-davinci-002" } ] + }, + { + "identifier": "prompt_zh", + "type": "text", + "title": "Prompt", + "defaultValue": "润色此句", + "desc": "中文润色Prompt (比如:润色此句,更学术化)", + }, + { + "identifier": "prompt_en", + "type": "text", + "title": "Prompt", + "defaultValue": "polish this sentence", + "desc": "英文润色Prompt (比如:polish this sentence, make it more academic)", + }, + { + "identifier": "max_tokens", + "type": "text", + "title": "Max tokens", + "defaultValue": "1000", + "desc": "最大Token数", } ] } diff --git a/src/main.js b/src/main.js index 2223f71..1c64b9e 100644 --- a/src/main.js +++ b/src/main.js @@ -36,15 +36,15 @@ function translate(query, completion) { systemPrompt = "You are a text embellisher, you can only embellish the text, don't interpret it."; if (query.detectTo === "zh-Hant" || query.detectTo === "zh-Hans") { - userPrompt = "润色此句"; + userPrompt = $option.prompt_zh || "润色此句"; } else { - userPrompt = "polish this sentence"; + userPrompt = $option.prompt_en ||"polish this sentence"; } } const body = { model: $option.model, temperature: 0, - max_tokens: 1000, + max_tokens: Number($option.max_tokens), top_p: 1, frequency_penalty: 1, presence_penalty: 1, From 1282dec2f16098d65b878fdba88bb2bff731680a Mon Sep 17 00:00:00 2001 From: Nasy Date: Mon, 13 Mar 2023 14:57:45 -0500 Subject: [PATCH 2/2] set maxtoken limit. --- src/info.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/info.json b/src/info.json index 3c34510..b59448b 100644 --- a/src/info.json +++ b/src/info.json @@ -66,7 +66,7 @@ "type": "text", "title": "Max tokens", "defaultValue": "1000", - "desc": "最大Token数", + "desc": "最大Token数 (max ~4000)", } ] }