diff --git a/apps/query.js b/apps/query.js index 885e24d..59c43f9 100644 --- a/apps/query.js +++ b/apps/query.js @@ -7,7 +7,7 @@ import axios from "axios"; // url库 import url from 'url'; // 常量 -import { CAT_LIMIT } from "../constants/constant.js"; +import { CAT_LIMIT, OCR_PROMPT } from "../constants/constant.js"; // 配置文件 import config from "../model/index.js"; // 书库 @@ -387,12 +387,15 @@ export class query extends plugin { .setBaseURL(this.aiBaseURL) .setApiKey(this.aiApiKey) .setModel(this.aiModel) + .setPrompt(OCR_PROMPT) .setPath(imgPath) .build(); - this.e.reply(`「R插件 x ${ model }」联合识别:\n${ ans }`); + const ocrAns = ans.split("▲"); + logger.info(ocrAns) + this.e.reply(`「R插件 x ${ model }」联合识别:\n描述:${ ocrAns[1] } \nOCR识别结果:${ ocrAns[2] }`); await checkAndRemoveFile(filenameWithExtension); } catch (err) { - e.reply("「R插件 x 月之暗面 Kimi」联合识别提醒你:无法找到图片路径!") + this.e.reply("「R插件 x 月之暗面 Kimi」联合识别提醒你:无法找到图片路径!") logger.error(err); } return true; diff --git a/constants/constant.js b/constants/constant.js index 6e58ee0..b519c1f 100644 --- a/constants/constant.js +++ b/constants/constant.js @@ -83,4 +83,10 @@ export const TWITTER_BEARER_TOKEN = ""; * 哔哩哔哩简介默认长度限制 * @type {number} */ -export const BILI_DEFAULT_INTRO_LEN_LIMIT = 50; \ No newline at end of file +export const BILI_DEFAULT_INTRO_LEN_LIMIT = 50; + +export const OCR_PROMPT = ` +▲ 首先,对将要用作替代文本的图像进行简短描述。不要在描述中描述或提取文本。 +▲ 图片中提取的文本,在适当的地方使用换行符。如果文本被某物遮挡,请使其不受阻隔,以便阅读。如果图像中没有文本,只需回复描述。不要包含任何其他信息。 +示例:▲ 文本编辑器中的代码行。▲ const x = 5; const y = 10; const z = x + y; console.log(z); +` \ No newline at end of file diff --git a/img/imageRecognition.webp b/img/imageRecognition.webp index 15071d2..0a7753b 100644 Binary files a/img/imageRecognition.webp and b/img/imageRecognition.webp differ