From e075a48516c42101641fca707ae3cde8e06a0efe Mon Sep 17 00:00:00 2001 From: Penghui Guo Date: Tue, 28 Mar 2023 13:35:14 +0800 Subject: [PATCH] feat: add an option to customize prompt (#18) --- src/info.json | 7 +++++++ src/main.js | 3 +-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/info.json b/src/info.json index 75517bd..3abef97 100644 --- a/src/info.json +++ b/src/info.json @@ -47,6 +47,13 @@ } ] }, + { + "identifier": "prompt", + "type": "text", + "title": "Prompt", + "defaultValue": "Revise the following sentences to make them more clear, concise, and coherent", + "desc": "通过自定义 prompt 获取不同的润色结果" + }, { "identifier": "polishing_mode", "type": "menu", diff --git a/src/main.js b/src/main.js index 86d928f..f6658d5 100644 --- a/src/main.js +++ b/src/main.js @@ -13,8 +13,7 @@ function translate(query, completion) { Authorization: `Bearer ${api_key}`, }; const detailedPolishingMode = $option.polishing_mode === "detailed"; - let prompt = - "Revise the following sentences to make them more clear, concise, and coherent"; + let prompt = $option.prompt; if (detailedPolishingMode) { prompt = `${prompt}. Please note that you need to list the changes and briefly explain why`; }