improve(daily-briefing): 優化文案與無待辦時的提示

This commit is contained in:
2026-03-16 09:04:16 +08:00
parent 9a7801ffdc
commit baa75d4e07

View File

@@ -76,6 +76,9 @@ export async function handler(ctx: any) {
const now = new Date(); const now = new Date();
const dateStr = formatDate(now); const dateStr = formatDate(now);
const weekday = getWeekday(now); const weekday = getWeekday(now);
const yesterday = new Date(now);
yesterday.setDate(yesterday.getDate() - 1);
const yesterdayStr = formatDate(yesterday);
// 讀取設定 // 讀取設定
const userMd = readWorkspaceFile(workspace, 'USER.md'); const userMd = readWorkspaceFile(workspace, 'USER.md');
@@ -87,7 +90,7 @@ export async function handler(ctx: any) {
// 讀取待辦與行程 // 讀取待辦與行程
const todoContent = readWorkspaceFile(workspace, 'TODO.md'); const todoContent = readWorkspaceFile(workspace, 'TODO.md');
const scheduleContent = readWorkspaceFile(workspace, 'SCHEDULE.md'); const scheduleContent = readWorkspaceFile(workspace, 'SCHEDULE.md');
const memoryContent = readWorkspaceFile(workspace, `memory/${dateStr}.md`); const memoryContent = readWorkspaceFile(workspace, `memory/${yesterdayStr}.md`);
const todos = parseTodos(todoContent); const todos = parseTodos(todoContent);
const schedule = parseTodaySchedule(scheduleContent, dateStr); const schedule = parseTodaySchedule(scheduleContent, dateStr);
@@ -103,20 +106,20 @@ export async function handler(ctx: any) {
if (schedule.length > 0) { if (schedule.length > 0) {
sections.push(`📅 **今日行程**\n${schedule.map(s => `${s}`).join('\n')}`); sections.push(`📅 **今日行程**\n${schedule.map(s => `${s}`).join('\n')}`);
} else { } else {
sections.push(`📅 **今日行程**\n• 無排程`); sections.push(`📅 **今日行程**\n• 今日無排程,享受自由時光!`);
} }
if (todos.length > 0) { if (todos.length > 0) {
sections.push(`✅ **待辦事項(${todos.length} 項)**\n${todos.map(t => `${t}`).join('\n')}`); sections.push(`✅ **待辦事項(${todos.length} 項)**\n${todos.map(t => `${t}`).join('\n')}`);
} else { } else {
sections.push(`✅ **待辦事項**\n• 今日無待辦,保持輕鬆`); sections.push(`✅ **待辦事項**\n• 目前無待辦,繼續保持!`);
} }
if (memoryContent) { if (memoryContent) {
sections.push(`📝 **昨日記錄**\n${memoryContent.slice(0, 200)}...`); sections.push(`📝 **昨日回顧**\n${memoryContent.slice(0, 200)}...`);
} }
sections.push(`\n有什麼想先處理的嗎`); sections.push(`\n💡 *有什麼想先處理的嗎?我隨時為您服務。*`);
return { return {
reply: sections.join('\n\n'), reply: sections.join('\n\n'),