mirror of
https://github.com/Jerryplusy/rc-plugin.git
synced 2025-10-14 16:19:18 +00:00
🦄 refactor: 保留OCR结果
This commit is contained in:
parent
9cbc3f72ed
commit
7385898f97
@ -163,16 +163,16 @@ export class tools extends plugin {
|
|||||||
const ocrRst = await Bot.imageOcr(`${defaultPath}/temp.jpg`);
|
const ocrRst = await Bot.imageOcr(`${defaultPath}/temp.jpg`);
|
||||||
const wordList = ocrRst.wordslist;
|
const wordList = ocrRst.wordslist;
|
||||||
// OCR结果
|
// OCR结果
|
||||||
let prompt = wordList.map(item => item.words).join(" ");
|
let OCRInfo = wordList.map(item => item.words).join(" ");
|
||||||
if (this.openaiAccessToken) {
|
if (this.openaiAccessToken) {
|
||||||
// 构造输入
|
// 构造输入
|
||||||
const func = preMsg.msg.replace("#ocr", "").trim();
|
const func = preMsg.msg.replace("#ocr", "").trim();
|
||||||
prompt = PROMPT_MAP[func] + prompt;
|
const prompt = PROMPT_MAP[func] + OCRInfo;
|
||||||
// 得到结果
|
// 得到结果
|
||||||
const response = await this.chatGptClient.sendMessage(prompt);
|
const response = await this.chatGptClient.sendMessage(prompt);
|
||||||
prompt = response.response;
|
OCRInfo = `${OCRInfo}\n-----------------\n${response.response}`;
|
||||||
}
|
}
|
||||||
curMsg.reply(prompt);
|
curMsg.reply(OCRInfo);
|
||||||
});
|
});
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
curMsg.reply(" ❌OCR失败,或者存在多账号竞争回答问题!");
|
curMsg.reply(" ❌OCR失败,或者存在多账号竞争回答问题!");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user