Skip to content

Commit 2b5b6fd

Browse files
authored
feat: add proxy API config and zh-Hant prompt (#7)
1 parent c2c371c commit 2b5b6fd

File tree

2 files changed

+15
-3
lines changed

2 files changed

+15
-3
lines changed

src/info.json

+8-1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,13 @@
1010
"appcast": "https://raw.githubusercontent.com/yetone/bob-plugin-openai-polisher/main/appcast.json",
1111
"minBobVersion": "0.5.0",
1212
"options": [
13+
{
14+
"identifier": "api_url",
15+
"type": "text",
16+
"title": "API URL",
17+
"defaultValue": "https://api.openai.com",
18+
"desc": "如果您的网络环境需要代理才能访问 OpenAI API, 可在这里修改为反代 API 的地址 默认为 https://api.openai.com"
19+
},
1320
{
1421
"identifier": "api_keys",
1522
"type": "text",
@@ -57,4 +64,4 @@
5764
]
5865
}
5966
]
60-
}
67+
}

src/main.js

+7-2
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,11 @@ function translate(query, completion) {
2020
}
2121
switch (query.detectFrom) {
2222
case "zh-Hant":
23+
prompt = "潤色此句";
24+
if (detailedPolishingMode) {
25+
prompt = `${prompt}。請列出修改項目,並簡述修改原因`;
26+
}
27+
break;
2328
case "zh-Hans":
2429
prompt = "润色此句";
2530
if (detailedPolishingMode) {
@@ -73,8 +78,8 @@ function translate(query, completion) {
7378
const resp = await $http.request({
7479
method: "POST",
7580
url:
76-
"https://api.openai.com/v1" +
77-
(isChatGPTModel ? "/chat/completions" : "/completions"),
81+
$option.api_url +
82+
(isChatGPTModel ? "/v1/chat/completions" : "/v1/completions"),
7883
header,
7984
body,
8085
});

0 commit comments

Comments
 (0)