diff --git a/src/info.json b/src/info.json index c747332..b59448b 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数 (max ~4000)", } ] } 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,