fix: 去除OCR语言限制

This commit is contained in:
ikechan8370 2023-03-05 17:40:39 +08:00
parent 55c5112d1c
commit 4e98882990

View file

@ -20,7 +20,7 @@ import { KeyvFile } from 'keyv-file'
import { OfficialChatGPTClient } from '../utils/message.js' import { OfficialChatGPTClient } from '../utils/message.js'
import fetch from 'node-fetch' import fetch from 'node-fetch'
import { deleteConversation, getConversations, getLatestMessageIdByConversationId } from '../utils/conversation.js' import { deleteConversation, getConversations, getLatestMessageIdByConversationId } from '../utils/conversation.js'
import {convertSpeaker, generateAudio, speakers} from '../utils/tts.js' import { convertSpeaker, generateAudio, speakers } from '../utils/tts.js'
import { segment } from 'oicq' import { segment } from 'oicq'
try { try {
await import('keyv') await import('keyv')
@ -456,11 +456,11 @@ export class chatgpt extends plugin {
let imgOcrText = '' let imgOcrText = ''
for (let i in e.img) { for (let i in e.img) {
const imgorc = await Bot.imageOcr(e.img[i]) const imgorc = await Bot.imageOcr(e.img[i])
if (imgorc.language === 'zh' || imgorc.language === 'en') { // if (imgorc.language === 'zh' || imgorc.language === 'en') {
for (let text of imgorc.wordslist) { for (let text of imgorc.wordslist) {
imgOcrText += `${text.words} \n` imgOcrText += `${text.words} \n`
} }
} // }
} }
prompt = imgOcrText + prompt prompt = imgOcrText + prompt
} catch (err) {} } catch (err) {}