From 35447508d4de6187ddf8e69b0fdcdd33657b5ea6 Mon Sep 17 00:00:00 2001 From: ThinkStu <91378285+Bistutu@users.noreply.github.com> Date: Mon, 4 Mar 2024 16:33:54 +0800 Subject: [PATCH] fixbug --- FluentRead.js | 54 ++++++++++++++++++++++++++++++--------------------- README.md | 9 +++++---- 2 files changed, 37 insertions(+), 26 deletions(-) diff --git a/FluentRead.js b/FluentRead.js index 836261f..5b1ac23 100644 --- a/FluentRead.js +++ b/FluentRead.js @@ -2,7 +2,7 @@ // @name 流畅阅读 // @license GPL-3.0 license // @namespace https://fr.unmeta.cn/ -// @version 1.42 +// @version 1.30 // @description 基于上下文语境的人工智能翻译引擎,为部分网站提供精准翻译,让所有人都能够拥有基于母语般的阅读体验。程序Github开源:https://github.com/Bistutu/FluentRead,欢迎 star。 // @author ThinkStu // @match *://*/* @@ -235,12 +235,10 @@ let LLMFormat = { return JSON.stringify({ 'model': option, "stream": false, - "temperature": 0.3, + "temperature": 0.1, 'messages': [ {'role': 'system', 'content': chatMgs.getSystemMsg()}, - {'role': 'user', 'content': chatMgs.getUserMsg('hello')}, - {'role': "assistant", 'content': '你好'}, - {'role': 'user', 'content': origin} + {'role': 'user', 'content': chatMgs.getUserMsg(origin)}, ] }) } @@ -382,9 +380,7 @@ const shortcutManager = { // 自定义 GPT地址 const customGPT = { openai: "https://api.openai.com/v1/chat/completions", - setGPTUrl(url) { - const model = util.getValue('model'); - + setGPTUrl(model, url) { url = url.trim(); // 去除首尾空格 // 解析 url,确保为 cloudflare 代理或 openai 官方地址 let cloudflareReg = /https:\/\/gateway.ai.cloudflare.com\/v1\/\w+\/\w+\/openai\/chat\/completions/; @@ -400,8 +396,8 @@ const customGPT = { } return false }, - getGPTUrl() { - const model = util.getValue('model'); + getGPTUrl(model) { + if (!model) model = util.getValue('model'); return GM_getValue(model + '_url', this.openai) } } @@ -429,19 +425,28 @@ const settingManager = { - +