Browse Source

修复一些bug

Pchen 1 year ago
parent
commit
d942a9f931
4 changed files with 9 additions and 12 deletions
  1. 1 1
      API/xunfei.js
  2. BIN
      db/data.db
  3. 4 4
      router.js
  4. 4 7
      wechat/main.js

+ 1 - 1
API/xunfei.js

@@ -25,7 +25,7 @@ function getConfigValue(configName) {
 // 读取配置信息并设置相应的变量
 // 读取配置信息并设置相应的变量
 async function loadConfigValues() {
 async function loadConfigValues() {
     try {
     try {
-        url = await getConfigValue('apiUrl')
+        url = await getConfigValue('APIUrl')
         APIKey = await getConfigValue('APIKey')
         APIKey = await getConfigValue('APIKey')
         APISecret = await getConfigValue('APISecret')
         APISecret = await getConfigValue('APISecret')
         app_id = await getConfigValue('app_id')
         app_id = await getConfigValue('app_id')

BIN
db/data.db


+ 4 - 4
router.js

@@ -200,14 +200,14 @@ router.post('/gptconfig',async(req,res) => {
 })
 })
 
 
 router.post('/xfconfig', async (req, res) => {
 router.post('/xfconfig', async (req, res) => {
-    const { temperature, max_tokens, app_id, APIKey, APISecret, apiUrl, domain } = req.body
+    const { temperature, max_tokens, app_id, APIKey, APISecret, APIUrl, domain } = req.body
     try {
     try {
         updateXunfeiConfig("temperature", temperature)
         updateXunfeiConfig("temperature", temperature)
         updateXunfeiConfig("max_tokens", max_tokens)
         updateXunfeiConfig("max_tokens", max_tokens)
         updateXunfeiConfig("app_id", app_id)
         updateXunfeiConfig("app_id", app_id)
         updateXunfeiConfig("APIKey", APIKey)
         updateXunfeiConfig("APIKey", APIKey)
         updateXunfeiConfig("APISecret", APISecret)
         updateXunfeiConfig("APISecret", APISecret)
-        updateXunfeiConfig("apiUrl", apiUrl)
+        updateXunfeiConfig("APIUrl", APIUrl)
         updateXunfeiConfig("domain", domain)
         updateXunfeiConfig("domain", domain)
         res.send({ status: 200, msg: '设置成功!' })
         res.send({ status: 200, msg: '设置成功!' })
     } catch (error) {
     } catch (error) {
@@ -228,7 +228,7 @@ router.post('/getwxconfig', async (req, res) => {
 
 
 //设置微信机器人
 //设置微信机器人
 router.post('/wxconfig', async (req, res) => {
 router.post('/wxconfig', async (req, res) => {
-    const { autoReplySingle, suffix, prefix, atReply, keyWords, blackName, whiteRoom ,model} = req.body
+    const { autoReplySingle, suffix, prefix, atReply, keyWords, blackName, whiteRoom ,usemodel} = req.body
     try {
     try {
         setWx('autoReplySingle', autoReplySingle)
         setWx('autoReplySingle', autoReplySingle)
         setWx('suffix', suffix)
         setWx('suffix', suffix)
@@ -237,7 +237,7 @@ router.post('/wxconfig', async (req, res) => {
         setWx('atReply', atReply)
         setWx('atReply', atReply)
         setWx('keyWords', keyWords)
         setWx('keyWords', keyWords)
         setWx('blackName', blackName)
         setWx('blackName', blackName)
-        setWx('model', model)
+        setWx('usemodel', usemodel)
         loadConfigValues()
         loadConfigValues()
         res.send({ status: 200, msg: '设置成功!' })
         res.send({ status: 200, msg: '设置成功!' })
     } catch (error) {
     } catch (error) {

+ 4 - 7
wechat/main.js

@@ -31,7 +31,7 @@ async function loadConfigValues() {
         autoReplySingle = await getConfigValue('autoReplySingle') === 'true'
         autoReplySingle = await getConfigValue('autoReplySingle') === 'true'
         prefix = await getConfigValue('prefix')
         prefix = await getConfigValue('prefix')
         suffix = await getConfigValue('suffix')
         suffix = await getConfigValue('suffix')
-        model = await getConfigValue('model')
+        usemodel = await getConfigValue('usemodel')
         whiteRoomString = await getConfigValue('whiteRoom')
         whiteRoomString = await getConfigValue('whiteRoom')
         keyWordsString = await getConfigValue('keyWords')
         keyWordsString = await getConfigValue('keyWords')
         blackNameString = await getConfigValue('blackName')
         blackNameString = await getConfigValue('blackName')
@@ -56,16 +56,13 @@ loadConfigValues()
 
 
 //选择模型
 //选择模型
 async function sendMessageToAPI(message) {
 async function sendMessageToAPI(message) {
-    if (model==='xunfei'){
+    if (usemodel==='xunfei'){
         const content = await getXunfeiMessage(message)
         const content = await getXunfeiMessage(message)
         return content
         return content
-    }   else if (model==='chatgpt') {
+    }   else  {
         const content = await getGPTMessage(message)
         const content = await getGPTMessage(message)
         return content
         return content
-    }   else {
-        const content = '请在设置页面中选择语言模型'
-        return content
-    }
+    }  
 }
 }
 
 
 //获取时间
 //获取时间