MCPcopy Create free account
hub / github.com/TeleBoxOrg/TeleBox_Plugins / scheduleTask

Function scheduleTask

sum/sum.ts:790–826  ·  view source on GitHub ↗
(task: SummaryTask)

Source from the content-addressed store, hash-verified

788 : `[文件: ${fileName}]`;
789 }
790
791 if (textContent) {
792 messageData.push({
793 text: `[${time}] ${sender}: ${textContent}`,
794 content: message.message || "",
795 telegramLink: link,
796 urls,
797 fileName: fileName || undefined,
798 });
799 }
800 }
801
802 return messageData.reverse();
803}
804
805// 格式化消息数据为文本
806function formatMessagesForAI(messageData: MessageData[]): string {
807 // 消息正文,每条消息附带 Telegram 链接
808 const messageTexts = messageData.map(
809 (m) => `${m.text} [来源](${m.telegramLink})`,
810 );
811
812 // 提取所有外部 URL 及其对应的 Telegram 消息链接
813 // 优先使用 entities 中提取的 URL,其次使用文本中的 URL
814 const urlMappings: { url: string; telegramLink: string }[] = [];
815 for (const m of messageData) {
816 // 合并两种来源的 URL
817 const allUrls = [...m.urls, ...extractUrlsFromText(m.content)];
818 for (const url of allUrls) {
819 // 去重:检查是否已存在相同 URL
820 if (!urlMappings.some((u) => u.url === url)) {
821 urlMappings.push({ url, telegramLink: m.telegramLink });
822 }
823 }
824 }
825
826 // 提取所有附件文件
827 const fileMappings: { fileName: string; telegramLink: string }[] = [];
828 for (const m of messageData) {
829 if (m.fileName) {

Callers 2

bootstrapTasksFunction · 0.70
SummaryPluginClass · 0.70

Calls 6

executeSummaryFunction · 0.85
writeMethod · 0.80
errorMethod · 0.80
makeCronKeyFunction · 0.70
getDBFunction · 0.70
setMethod · 0.45

Tested by

no test coverage detected