mirror of
https://github.com/Jerryplusy/rc-plugin.git
synced 2025-10-14 08:09:19 +00:00
🔧 refactor: 移除 query.js
中不再使用的 rso
功能和 BING_SEARCH
常量
- 清理 `query.js` 文件,移除 `rso` 搜索功能相关代码,简化逻辑 - 删除 `constants/query.js` 中不再使用的 `BING_SEARCH` 常量,优化代码结构 - 确保代码清晰和功能正常运行,提升代码可维护性 - 优化搜索功能,提高应用性能和用户体验
This commit is contained in:
parent
0642f9d62a
commit
91e16c5815
@ -4,7 +4,6 @@ import fetch from "node-fetch";
|
||||
// 常量
|
||||
import { CAT_LIMIT, COMMON_USER_AGENT } from "../constants/constant.js";
|
||||
import {
|
||||
BING_SEARCH,
|
||||
LINUX_AI_PROMPT,
|
||||
LINUX_QUERY,
|
||||
RDOC_AI_PROMPT,
|
||||
@ -64,10 +63,6 @@ export class query extends plugin {
|
||||
{
|
||||
reg: "^#R文档(.*)",
|
||||
fnc: "intelligentDoc",
|
||||
},
|
||||
{
|
||||
ret: "^#(R|r)so(.*)",
|
||||
fnc: "rso",
|
||||
}
|
||||
],
|
||||
});
|
||||
@ -399,21 +394,6 @@ export class query extends plugin {
|
||||
return;
|
||||
}
|
||||
|
||||
async rso(e) {
|
||||
const question = e.msg.replace("#Rso", "").replace("#rso", "").trim();
|
||||
const resp = await fetch(BING_SEARCH.replace("{}", question), {
|
||||
headers: {
|
||||
"User-Agent": COMMON_USER_AGENT,
|
||||
}
|
||||
});
|
||||
const respJson = (await resp.json()).data;
|
||||
const constructSearchRes = textArrayToMakeForward(e, respJson.map(item =>
|
||||
`标题:《${ item.title }》\n📝 简要:${ item.abstract }\n➡️链接:${ item.href }`
|
||||
));
|
||||
await e.reply(Bot.makeForwardMsg(constructSearchRes));
|
||||
return;
|
||||
}
|
||||
|
||||
// 删除标签
|
||||
removeTag(title) {
|
||||
const titleRex = /<[^>]+>/g;
|
||||
|
@ -4,12 +4,6 @@
|
||||
*/
|
||||
export const LINUX_QUERY = "https://api.pearktrue.cn/api/linux/?keyword={}";
|
||||
|
||||
/**
|
||||
* 必应搜索
|
||||
* @type {string}
|
||||
*/
|
||||
export const BING_SEARCH = "https://api.pearktrue.cn/api/bingsearch/?search={}";
|
||||
|
||||
export const RDOC_LINK = "https://gitee.com/kyrzy0416/rconsole-plugin/raw/docs/posts/QA%E5%AE%98%E6%96%B9%E8%A7%A3%E7%AD%94.md";
|
||||
|
||||
export const LINUX_AI_PROMPT = "- Role: Linux命令专家\n" +
|
||||
|
Loading…
x
Reference in New Issue
Block a user