Skip to content

Commit

Permalink
增加自己填key的反代线路对gpt-3.5-turbo-16k-0613,gpt-3.5-turbo-16k,gpt-4-32k-0314的支持
Browse files Browse the repository at this point in the history
  • Loading branch information
akl7777777 committed Jun 17, 2023
1 parent 606f435 commit 8eaee66
Show file tree
Hide file tree
Showing 2 changed files with 62 additions and 6 deletions.
57 changes: 55 additions & 2 deletions src/info.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"identifier": "com.akl.bob-plugin-akl-chatgpt-free-translate",
"version": "1.2.1",
"version": "1.2.2",
"category": "translate",
"name": "Free ChatGPT",
"summary": "免秘钥免启动任何服务调用ChatGPT",
Expand Down Expand Up @@ -62,14 +62,67 @@
"title": "api_key",
"desc": "支持填写自己的key,记得下面线路选择填key的线路"
},
{
"identifier": "model",
"type": "menu",
"title": "模型",
"defaultValue": "gpt-3.5-turbo",
"menuValues": [
{
"title": "gpt-4",
"value": "gpt-4"
},
{
"title": "gpt-4-0314",
"value": "gpt-4-0314"
},
{
"title": "gpt-4-0613",
"value": "gpt-4-0613"
},
{
"title": "gpt-4-32k",
"value": "gpt-4-32k"
},
{
"title": "gpt-4-32k-0314",
"value": "gpt-4-32k-0314"
},
{
"title": "gpt-4-32k-0613",
"value": "gpt-4-32k-0613"
},
{
"title": "gpt-3.5-turbo",
"value": "gpt-3.5-turbo"
},
{
"title": "gpt-3.5-turbo-0301",
"value": "gpt-3.5-turbo-0301"
},
{
"title": "gpt-3.5-turbo-0613",
"value": "gpt-3.5-turbo-0613"
},
{
"title": "gpt-3.5-turbo-16k",
"value": "gpt-3.5-turbo-16k"
},
{
"title": "gpt-3.5-turbo-16k-0613",
"value": "gpt-3.5-turbo-16k-0613"
}
],
"desc": "版本切换(默认正式版无特殊情况不用修改)"
},
{
"identifier": "service",
"type": "menu",
"title": "版本",
"defaultValue": "default",
"menuValues": [
{
"title": "自己填key线路1(关掉梯子)",
"title": "自己填key反代线路1",
"value": "api_key_1"
},
{
Expand Down
11 changes: 7 additions & 4 deletions src/sc2e.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ async function translate(query, source_lang, target_lang, translate_text, comple
try {
let api_key = $option.api_key;
let mode = $option.mode;
let model = $option.model;
let prompt = $option.prompt;
const configValue = readFile();
if (configValue.mode) {
Expand All @@ -30,13 +31,15 @@ async function translate(query, source_lang, target_lang, translate_text, comple
const L = Date.now();
const resp = await $http.request({
method: "POST",
url: random_safe('aHR0cHM6Ly9haS5tZW5neGlucy5jbi9hcGkvZ2VuZXJhdGU='),
url: random_safe('aHR0cHM6Ly9haS5mYWtlb3Blbi5jb20vdjEvY2hhdC9jb21wbGV0aW9ucw=='),
body: {
messages: A,
apiKey:api_key,
"config":{"temperature":0.6,"top_p":1}
model:model,
"temperature":1,
"presence_penalty":0
},
header: {
'authorization' : 'Bearer ' + api_key,
'Content-Type': 'application/json',
'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/113.0.0.0 Safari/537.36'
}
Expand All @@ -55,7 +58,7 @@ async function translate(query, source_lang, target_lang, translate_text, comple
result: {
from: query.detectFrom,
to: query.detectTo,
toParagraphs: resp.data.split('\n'),
toParagraphs: resp.data.choices[0].message.content.split('\n'),
},
});
}
Expand Down

0 comments on commit 8eaee66

Please sign in to comment.