mirror of
https://github.com/Jerryplusy/rc-plugin.git
synced 2025-10-14 16:19:18 +00:00
✨ feat: 识图增加固定prompt
This commit is contained in:
parent
6c2748f703
commit
bb32dbf66b
@ -7,7 +7,7 @@ import axios from "axios";
|
|||||||
// url库
|
// url库
|
||||||
import url from '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";
|
import config from "../model/index.js";
|
||||||
// 书库
|
// 书库
|
||||||
@ -387,12 +387,15 @@ export class query extends plugin {
|
|||||||
.setBaseURL(this.aiBaseURL)
|
.setBaseURL(this.aiBaseURL)
|
||||||
.setApiKey(this.aiApiKey)
|
.setApiKey(this.aiApiKey)
|
||||||
.setModel(this.aiModel)
|
.setModel(this.aiModel)
|
||||||
|
.setPrompt(OCR_PROMPT)
|
||||||
.setPath(imgPath)
|
.setPath(imgPath)
|
||||||
.build();
|
.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);
|
await checkAndRemoveFile(filenameWithExtension);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
e.reply("「R插件 x 月之暗面 Kimi」联合识别提醒你:无法找到图片路径!")
|
this.e.reply("「R插件 x 月之暗面 Kimi」联合识别提醒你:无法找到图片路径!")
|
||||||
logger.error(err);
|
logger.error(err);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
@ -83,4 +83,10 @@ export const TWITTER_BEARER_TOKEN = "";
|
|||||||
* 哔哩哔哩简介默认长度限制
|
* 哔哩哔哩简介默认长度限制
|
||||||
* @type {number}
|
* @type {number}
|
||||||
*/
|
*/
|
||||||
export const BILI_DEFAULT_INTRO_LEN_LIMIT = 50;
|
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);
|
||||||
|
`
|
Binary file not shown.
Before Width: | Height: | Size: 551 KiB After Width: | Height: | Size: 504 KiB |
Loading…
x
Reference in New Issue
Block a user