mirror of
https://wget.la/https://github.com/Wxw-Gu/WechatExplorer
synced 2026-11-30 16:02:58 +08:00
fix: 增加thinking disabled
修改退群监控模板 定时日报保存日报历史
This commit is contained in:
1 parent
25b72c3d76
commit
1c8bbae1f0
21 files changed
+343
-34
No files matched your search
@@ -8,6 +8,7 @@ export type AIProviderType =
|
||||
export type AIAuthType = 'bearer' | 'x-api-key' | 'custom-header' | 'none'
|
||||
|
||||
export type AIOpenAIProtocol = 'chat-completions' | 'responses'
|
||||
export type AIThinkingMode = 'default' | 'disabled'
|
||||
|
||||
export interface AIProviderAuth {
|
||||
type: AIAuthType
|
||||
@@ -38,6 +39,7 @@ export interface AIProviderAdvancedSettings {
|
||||
maxTokens?: number
|
||||
stream?: boolean
|
||||
apiProtocol?: AIOpenAIProtocol
|
||||
thinking?: AIThinkingMode
|
||||
extraHeaders: Record<string, string>
|
||||
}
|
||||
|
||||
|
||||
@@ -27,8 +27,7 @@ export interface GroupExitMonitorEvent {
|
||||
detectedAt: number
|
||||
}
|
||||
|
||||
/** 管理页预览和自动通知共用的模板。 */
|
||||
export const GROUP_EXIT_NOTIFICATION_TEMPLATE = [
|
||||
const LEGACY_GROUP_EXIT_NOTIFICATION_TEMPLATE = [
|
||||
'[退群监测]',
|
||||
'',
|
||||
'用户: {user}',
|
||||
@@ -40,11 +39,28 @@ export const GROUP_EXIT_NOTIFICATION_TEMPLATE = [
|
||||
'退群时间: {time}'
|
||||
].join('\n')
|
||||
|
||||
/** 管理页预览和自动通知共用的模板。 */
|
||||
export const GROUP_EXIT_NOTIFICATION_TEMPLATE = [
|
||||
'[退群监测]',
|
||||
'',
|
||||
'用户: {user}',
|
||||
'',
|
||||
'群备注: {groupRemark}',
|
||||
'',
|
||||
'微信号: {wxid}',
|
||||
'',
|
||||
'人数: {previousCount} -> {currentCount}',
|
||||
'',
|
||||
'退群时间: {time}'
|
||||
].join('\n')
|
||||
|
||||
export const GROUP_EXIT_NOTIFICATION_TEMPLATE_MAX_LENGTH = 2_000
|
||||
export const GROUP_EXIT_NOTIFICATION_TEMPLATE_PLACEHOLDERS = [
|
||||
'user',
|
||||
'groupRemark',
|
||||
'wxid',
|
||||
'previousCount',
|
||||
'currentCount',
|
||||
'time'
|
||||
] as const
|
||||
|
||||
@@ -79,6 +95,10 @@ export function validateGroupExitNotificationTemplate(
|
||||
}
|
||||
|
||||
export function normalizeGroupExitNotificationTemplate(value: unknown): string {
|
||||
const template = typeof value === 'string' ? value.replace(/\r\n?/g, '\n').trim() : ''
|
||||
if (template === LEGACY_GROUP_EXIT_NOTIFICATION_TEMPLATE) {
|
||||
return GROUP_EXIT_NOTIFICATION_TEMPLATE
|
||||
}
|
||||
const result = validateGroupExitNotificationTemplate(value)
|
||||
return result.valid && result.template ? result.template : GROUP_EXIT_NOTIFICATION_TEMPLATE
|
||||
}
|
||||
@@ -105,14 +125,18 @@ export function renderGroupExitMonitorNotification(
|
||||
user,
|
||||
groupRemark,
|
||||
wxid,
|
||||
previousCount: String(event.previousCount),
|
||||
currentCount: String(event.currentCount),
|
||||
time: formatGroupExitMonitorTime(event.detectedAt)
|
||||
}
|
||||
return normalizeGroupExitNotificationTemplate(template).replace(
|
||||
/\{(user|groupRemark|wxid|time)\}/g,
|
||||
/\{(user|groupRemark|wxid|previousCount|currentCount|time)\}/g,
|
||||
(placeholder) => {
|
||||
if (placeholder === '{user}') return values.user
|
||||
if (placeholder === '{groupRemark}') return values.groupRemark
|
||||
if (placeholder === '{wxid}') return values.wxid
|
||||
if (placeholder === '{previousCount}') return values.previousCount
|
||||
if (placeholder === '{currentCount}') return values.currentCount
|
||||
return values.time
|
||||
}
|
||||
)
|
||||
|
||||
@@ -62,6 +62,8 @@ export interface SaveGeneratedReportRequest {
|
||||
dateRange: string
|
||||
messageCount: number
|
||||
generatedAt: string
|
||||
/** 实际覆盖的本地日期;缺省时由 generatedAt 推导。 */
|
||||
reportDate?: string
|
||||
generatedImage?: string
|
||||
htmlPath?: string
|
||||
pngPath?: string
|
||||
|
||||
Reference in new issue
Block a user