mirror of
https://wget.la/https://github.com/Wxw-Gu/WechatExplorer
synced 2026-10-05 12:34:35 +08:00
chore: 统一日报时间逻辑
This commit is contained in:
@@ -1614,7 +1614,7 @@ function App(): React.ReactElement {
|
||||
? '昨日'
|
||||
: summaryDateRange === '7days'
|
||||
? '近 7 天'
|
||||
: '今天',
|
||||
: '今日',
|
||||
reportDate: reportMetadata.reportDate,
|
||||
messageCount: reportGeneration.reportMessages.length,
|
||||
generatedAt: new Date().toISOString(),
|
||||
|
||||
@@ -58,7 +58,7 @@ interface AiReportWorkspaceProps {
|
||||
const rangeLabel = (range: SummaryDateRange): string => {
|
||||
if (range === 'yesterday') return '昨日'
|
||||
if (range === '7days') return '近 7 天'
|
||||
return '今天'
|
||||
return '今日'
|
||||
}
|
||||
|
||||
const modelLabel = (model: string): string => {
|
||||
|
||||
@@ -69,8 +69,8 @@ const groupLabelFor = (value: string): string => {
|
||||
const time = new Date(date)
|
||||
time.setHours(0, 0, 0, 0)
|
||||
|
||||
if (time.getTime() >= startOfToday.getTime()) return '今天'
|
||||
if (time.getTime() >= startOfYesterday.getTime()) return '昨天'
|
||||
if (time.getTime() >= startOfToday.getTime()) return '今日'
|
||||
if (time.getTime() >= startOfYesterday.getTime()) return '昨日'
|
||||
if (date.getFullYear() === now.getFullYear()) return `${date.getMonth() + 1}月${date.getDate()}日`
|
||||
return `${date.getFullYear()}年${date.getMonth() + 1}月${date.getDate()}日`
|
||||
}
|
||||
|
||||
@@ -66,8 +66,8 @@ const rangeLabel = (range: ScheduledReportRange): string =>
|
||||
: range === '7days'
|
||||
? '近 7 天'
|
||||
: range === 'today'
|
||||
? '今天'
|
||||
: '昨天'
|
||||
? '今日'
|
||||
: '昨日'
|
||||
|
||||
const isScheduledReportRange = (value: unknown): value is ScheduledReportRange =>
|
||||
value === 'today' || value === 'yesterday' || value === '7days' || value === 'recent24h'
|
||||
@@ -99,7 +99,7 @@ const formatDateTime = (value?: string): string => {
|
||||
if (Number.isNaN(date.getTime())) return '时间未知'
|
||||
const now = new Date()
|
||||
const dayLabel =
|
||||
date.toDateString() === now.toDateString() ? '今天' : date.toLocaleDateString('zh-CN')
|
||||
date.toDateString() === now.toDateString() ? '今日' : date.toLocaleDateString('zh-CN')
|
||||
return `${dayLabel} ${date.toLocaleTimeString('zh-CN', { hour: '2-digit', minute: '2-digit' })}`
|
||||
}
|
||||
|
||||
@@ -386,7 +386,7 @@ function ScheduledReportDialog({
|
||||
</span>
|
||||
</div>
|
||||
<SegmentedControl
|
||||
className="w-full"
|
||||
className="grid w-full grid-cols-2 gap-1 sm:grid-cols-5"
|
||||
aria-label="总结范围"
|
||||
value={reportRange}
|
||||
onValueChange={(value) => setReportRange(value as ScheduledReportRange)}
|
||||
@@ -395,20 +395,24 @@ function ScheduledReportDialog({
|
||||
<SegmentedControlItem
|
||||
key={option.value}
|
||||
value={option.value}
|
||||
className="min-h-9 flex-1"
|
||||
className="min-h-9 w-full min-w-0 whitespace-nowrap"
|
||||
>
|
||||
{option.label}
|
||||
</SegmentedControlItem>
|
||||
))}
|
||||
<SegmentedControlItem value="recent24h" className="min-h-9 flex-1">
|
||||
<SegmentedControlItem
|
||||
value="recent24h"
|
||||
className="min-h-9 w-full min-w-0 whitespace-nowrap"
|
||||
>
|
||||
最近24小时
|
||||
</SegmentedControlItem>
|
||||
<span
|
||||
aria-disabled="true"
|
||||
title="当前业务尚未支持自定义时间"
|
||||
className="inline-flex min-h-8 min-w-0 flex-1 cursor-not-allowed items-center justify-center rounded-sm px-3 text-xs font-medium text-disabled-foreground opacity-100"
|
||||
className="inline-flex min-h-9 w-full min-w-0 cursor-not-allowed flex-col items-center justify-center gap-0 rounded-sm px-2 py-1 text-xs font-medium leading-4 text-disabled-foreground opacity-100"
|
||||
>
|
||||
自定义 <small>即将支持</small>
|
||||
<span className="whitespace-nowrap">自定义</span>
|
||||
<small className="whitespace-nowrap text-[11px] leading-[14px]">即将支持</small>
|
||||
</span>
|
||||
</SegmentedControl>
|
||||
</div>
|
||||
|
||||
@@ -69,7 +69,7 @@ export const API_ENDPOINTS: ApiEndpoint[] = [
|
||||
}),
|
||||
endpoint('agent-group-report', {
|
||||
name: '生成群聊总结图片',
|
||||
description: '读取指定群聊并生成今天、昨天或近 7 天的总结长图。',
|
||||
description: '读取指定群聊并生成今日、昨日或近 7 天的总结长图。',
|
||||
body: true
|
||||
}),
|
||||
endpoint('agent-send', {
|
||||
|
||||
@@ -586,7 +586,7 @@ const buildMediaSection = async (
|
||||
funBadges.push({
|
||||
title: '高能输出王',
|
||||
owner: topSpeaker[0],
|
||||
note: `今天一共发了 ${topSpeaker[1]} 条消息。`
|
||||
note: `今日一共发了 ${topSpeaker[1]} 条消息。`
|
||||
})
|
||||
}
|
||||
if (visionGallery[0]) {
|
||||
|
||||
@@ -43,7 +43,7 @@ JSON 结构必须为:
|
||||
"overview": "1至2句整体讨论风格与氛围",
|
||||
"hero": {
|
||||
"headline": "一句抓重点的日报标题",
|
||||
"summary": "一句总结今天发生了什么,最多3行",
|
||||
"summary": "一句总结今日发生了什么,最多3行",
|
||||
"keyTakeaway": "最重要结论,没有可空",
|
||||
"pendingNote": "最值得跟进的一项,没有可空",
|
||||
"statusLine": "例如:今日形成 3 个结论 · 2 个待办 · 1 个问题尚未解决"
|
||||
@@ -645,7 +645,7 @@ const postProcessReport = (
|
||||
topics[0]?.title ||
|
||||
`${metadata.groupName}${mode === 'compact' ? '速览' : '日报'}`,
|
||||
summary: truncate(
|
||||
report.hero?.summary || report.overview || '今天群里有新的讨论进展。',
|
||||
report.hero?.summary || report.overview || '今日群里有新的讨论进展。',
|
||||
mode === 'compact' ? 84 : 120
|
||||
),
|
||||
keyTakeaway: report.hero?.keyTakeaway
|
||||
@@ -814,7 +814,7 @@ export const parseGroupDailyReport = (
|
||||
? {
|
||||
headline: asString(heroRoot.headline) || topics[0]?.title || '今日群聊速览',
|
||||
summary:
|
||||
asString(heroRoot.summary) || asString(root.overview) || '今天群里有新的讨论进展。',
|
||||
asString(heroRoot.summary) || asString(root.overview) || '今日群里有新的讨论进展。',
|
||||
keyTakeaway: asString(heroRoot.keyTakeaway),
|
||||
pendingNote: asString(heroRoot.pendingNote),
|
||||
statusLine: asString(heroRoot.statusLine)
|
||||
@@ -864,7 +864,7 @@ export type SummaryMessageType =
|
||||
| 'system'
|
||||
|
||||
export const SUMMARY_DATE_OPTIONS: { value: SummaryDateRange; label: string }[] = [
|
||||
{ value: 'today', label: '今天' },
|
||||
{ value: 'today', label: '今日' },
|
||||
{ value: 'yesterday', label: '昨日' },
|
||||
{ value: '7days', label: '近 7 天' }
|
||||
]
|
||||
@@ -923,6 +923,8 @@ export const getSummaryDateRangeAt = (
|
||||
range: SummaryDateRange,
|
||||
now = new Date()
|
||||
): { startTime: number; endTime: number } => {
|
||||
// These ranges are local calendar dates. Only the separate recent24h mode
|
||||
// uses a rolling 24-hour window in the scheduled-report service.
|
||||
const startOfToday = new Date(now)
|
||||
startOfToday.setHours(0, 0, 0, 0)
|
||||
const startOfYesterday = new Date(startOfToday)
|
||||
|
||||
Reference in New Issue
Block a user