fix: 修复bot-activity两个致命BUG + 添加3个passerby bot补充板块覆盖 + 减少GoogleNews超时
This commit is contained in:
@@ -153,7 +153,7 @@ async function fetchGoogleNewsRSS(query, lang = "zh-CN", country = "CN") {
|
||||
const url = `https://news.google.com/rss/search?q=${encodeURIComponent(query)}&hl=${lang}&gl=${country}&ceid=${country}:${lang === "zh-CN" ? "zh-Hans" : "en"}`;
|
||||
const response = await fetch(url, {
|
||||
headers: { "User-Agent": "Mozilla/5.0 (compatible; PasserbyBot/1.0)" },
|
||||
signal: AbortSignal.timeout(8000),
|
||||
signal: AbortSignal.timeout(3000),
|
||||
});
|
||||
if (!response.ok) return [];
|
||||
const xml = await response.text();
|
||||
@@ -195,11 +195,11 @@ async function fetchRecentNewsForCategory(forumSlug) {
|
||||
|
||||
function buildPasserbyTopicPrompt(bot, forumName, forumDescription, newsItems) {
|
||||
const p = bot.personality;
|
||||
const today = new Date().toLocaleDateString("zh-CN", { year: "numeric", month: "long", day: "numeric" });
|
||||
|
||||
const newsText = newsItems.length > 0
|
||||
? newsItems.map((n, i) => `${i + 1}. [${n.pubDate || "近期"}] ${n.title}`).join("\n")
|
||||
: `(搜索不到实时新闻,请充分利用DeepSeek知识库中截至2025年6月的最新行业信息。今天是${today},你必须让话题看起来像是今天或最近几天发生的。可以提及:今年发生的重大事件、近几个月出台的新政策、当前季节性的行业趋势、最近热门的讨论。在你的发言中自然地加入时间锚点,比如"上个月刚出来的…"、"最近大家都在说…"、"这个月的数据显示…"等,让读者第一眼就感受到这是当前的话题而不是老帖)`;
|
||||
|
||||
const today = new Date().toLocaleDateString("zh-CN", { year: "numeric", month: "long", day: "numeric" });
|
||||
const passerbyType = p.passerbyType || "observer";
|
||||
|
||||
const typeInstructions = {
|
||||
@@ -491,7 +491,12 @@ async function processForum(forumSlug, botCharacters, forceNewTopic = false) {
|
||||
existingTopics[0] && (Date.now() - existingTopics[0].createdAt.getTime()) > 24 * 60 * 60 * 1000;
|
||||
|
||||
if (needsNewTopic) {
|
||||
const topicAuthor = pick(forumBots.filter(c => c.activityLevel === "high" || c.activityLevel === "medium"));
|
||||
const activeBots = forumBots.filter(c => c.activityLevel === "high" || c.activityLevel === "medium");
|
||||
const topicAuthor = pick(activeBots.length > 0 ? activeBots : forumBots);
|
||||
if (!topicAuthor) {
|
||||
console.log(`${ts()} No suitable bot to create topic.`);
|
||||
return;
|
||||
}
|
||||
const botConf = await getBotWithConfig(topicAuthor.key);
|
||||
if (!botConf) {
|
||||
console.log(`${ts()} Bot "${topicAuthor.key}" not found in DB.`);
|
||||
|
||||
Reference in New Issue
Block a user