mirror of
https://github.com/Jerryplusy/rc-plugin.git
synced 2025-10-14 08:09:19 +00:00
✨ feat: 增强网页内容摘要功能
- 增加对以“#总结一下”开头的内容进行摘要的支持 - 从摘要内容中提取标题 - 更新SUMMARY_PROMPT,提供详细的指令和网页内容摘要助手的配置文件
This commit is contained in:
parent
ffafc6aa26
commit
b4af116ad6
@ -191,7 +191,7 @@ export class tools extends plugin {
|
|||||||
fnc: "freyr"
|
fnc: "freyr"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
reg: "(mp.weixin|arxiv.org|sspai.com|chinadaily.com.cn|zhihu.com)",
|
reg: "(^#总结一下(http|https):\/\/.*|mp.weixin|arxiv.org|sspai.com|chinadaily.com.cn|zhihu.com)",
|
||||||
fnc: "linkShareSummary"
|
fnc: "linkShareSummary"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -1728,7 +1728,15 @@ export class tools extends plugin {
|
|||||||
|
|
||||||
// 链接总结
|
// 链接总结
|
||||||
async linkShareSummary(e) {
|
async linkShareSummary(e) {
|
||||||
const { name, summaryLink } = contentEstimator(e.msg);
|
let name, summaryLink;
|
||||||
|
|
||||||
|
if (e.msg.startsWith("#总结一下")) {
|
||||||
|
name = "网页总结";
|
||||||
|
summaryLink = e.msg.replace("#总结一下", ""); // 如果需要进一步处理 summaryLink,可以在这里添加相关逻辑
|
||||||
|
} else {
|
||||||
|
({ name: name, summaryLink: summaryLink } = contentEstimator(e.msg));
|
||||||
|
}
|
||||||
|
|
||||||
// 判断是否有总结的条件
|
// 判断是否有总结的条件
|
||||||
if (_.isEmpty(this.aiApiKey) || _.isEmpty(this.aiApiKey)) {
|
if (_.isEmpty(this.aiApiKey) || _.isEmpty(this.aiApiKey)) {
|
||||||
// e.reply(`没有配置 Kimi,无法为您总结!${ HELP_DOC }`)
|
// e.reply(`没有配置 Kimi,无法为您总结!${ HELP_DOC }`)
|
||||||
@ -1745,7 +1753,8 @@ export class tools extends plugin {
|
|||||||
const { ans: kimiAns, model } = await builder.kimi(summaryLink);
|
const { ans: kimiAns, model } = await builder.kimi(summaryLink);
|
||||||
// 计算阅读时间
|
// 计算阅读时间
|
||||||
const stats = estimateReadingTime(kimiAns);
|
const stats = estimateReadingTime(kimiAns);
|
||||||
e.reply(`当前 ${ name } 预计阅读时间: ${ stats.minutes } 分钟,总字数: ${ stats.words }`)
|
const titleMatch = kimiAns.match(/(Title|标题)([::])\s*(.*?)\n/)?.[3];
|
||||||
|
e.reply(`《${ titleMatch }》 预计阅读时间: ${ stats.minutes } 分钟,总字数: ${ stats.words }`)
|
||||||
const Msg = await Bot.makeForwardMsg(textArrayToMakeForward(e, [`「R插件 x ${ model }」联合为您总结内容:`, kimiAns]));
|
const Msg = await Bot.makeForwardMsg(textArrayToMakeForward(e, [`「R插件 x ${ model }」联合为您总结内容:`, kimiAns]));
|
||||||
await e.reply(Msg);
|
await e.reply(Msg);
|
||||||
return true;
|
return true;
|
||||||
@ -1760,7 +1769,7 @@ export class tools extends plugin {
|
|||||||
*/
|
*/
|
||||||
async tempSummary(name, summaryLink, e) {
|
async tempSummary(name, summaryLink, e) {
|
||||||
const llmCrawler = await fetch(PearAPI_CRAWLER.replace("{}", summaryLink));
|
const llmCrawler = await fetch(PearAPI_CRAWLER.replace("{}", summaryLink));
|
||||||
const content = (await llmCrawler.json())?.data;
|
const content = await (await llmCrawler.json())?.data;
|
||||||
const titleMatch = content.match(/Title:\s*(.*?)\n/)?.[1];
|
const titleMatch = content.match(/Title:\s*(.*?)\n/)?.[1];
|
||||||
e.reply(`${ this.identifyPrefix } 识别:${ name } - ${titleMatch},正在为您总结,请稍等...`, true);
|
e.reply(`${ this.identifyPrefix } 识别:${ name } - ${titleMatch},正在为您总结,请稍等...`, true);
|
||||||
const deepseekFreeSummary = await fetch(PearAPI_DEEPSEEK, {
|
const deepseekFreeSummary = await fetch(PearAPI_DEEPSEEK, {
|
||||||
|
@ -104,7 +104,36 @@ export const BILI_DEFAULT_INTRO_LEN_LIMIT = 50;
|
|||||||
* 总结的prompt
|
* 总结的prompt
|
||||||
* @type {string}
|
* @type {string}
|
||||||
*/
|
*/
|
||||||
export const SUMMARY_PROMPT = `请返回您仔细阅读正文后精心写成的详尽笔记,如果是ArXiv论文就简要介绍下内容和创新点即可`
|
export const SUMMARY_PROMPT = `# Role: Web Content Summarization Assistant
|
||||||
|
|
||||||
|
## Profile
|
||||||
|
- author: R-plugin
|
||||||
|
- version: 1.0
|
||||||
|
- language: 中文
|
||||||
|
- description: An AI assistant specialized in summarizing web content, capable of extracting key points, summarizing articles, and providing concise overviews of complex topics.
|
||||||
|
|
||||||
|
## Skills
|
||||||
|
1. Proficient in natural language understanding and summarization techniques.
|
||||||
|
2. Ability to extract key information from a variety of web content formats (articles, blogs, reports).
|
||||||
|
3. Capable of summarizing both short and long-form content.
|
||||||
|
4. Adaptive to different writing styles and tones.
|
||||||
|
|
||||||
|
## Rules
|
||||||
|
1. Ensure the summary captures the main ideas and key points of the webpage.
|
||||||
|
2. The summary should be concise, clear, and accurate, avoiding unnecessary details.
|
||||||
|
3. Adapt the summary length and detail based on the complexity and length of the original content.
|
||||||
|
4. Preserve the context and intent of the original content without adding personal interpretation.
|
||||||
|
|
||||||
|
## Workflows
|
||||||
|
1. Analyze the structure and main sections of the webpage.
|
||||||
|
2. Identify and extract key points, arguments, or information from the content.
|
||||||
|
3. Firstly, generate a title with the format constraint: "title: {title}".
|
||||||
|
4. Then, Generate a concise summary that includes the most important details.
|
||||||
|
5. Next, create a "Key Paragraph" that includes what you consider to be some of the critical information points from the article, each key point preceded by an emoji.
|
||||||
|
6. Finally, Review the summary for accuracy and completeness. Don't include the URL of the current webpage in the summary review.
|
||||||
|
|
||||||
|
## Init
|
||||||
|
在第一次对话中,请直接输出以下:您好!我将联合R插件为您提供简洁明了的网页内容。`
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 图片翻译 prompt
|
* 图片翻译 prompt
|
||||||
|
Loading…
x
Reference in New Issue
Block a user