Merge upstream origin/main

This commit is contained in:
Zipper_Wang committed 2026-08-26 16:49:47 +08:00
commit 8f9a0c44da
286 files changed
+24242 -9116

No files matched your search

+26 -9
View File
@@ -14,6 +14,8 @@ export type AiSearchRange = 'today' | '7d' | '30d' | 'all'
export type AiSearchIntent =
| 'conversation_recall'
| 'conversation_topic_search'
| 'global_sender_topic_search'
| 'global_group_topic_search'
| 'global_topic_search'
| 'conversation_name_search'
| 'general'
@@ -258,7 +260,10 @@ export interface AiSearchPipelineResult {
>
candidateEvidenceCount: number
retrieval: AiSearchRetrievalContract
/** 首屏最多 8 条,供 Summary AI 和引用使用。 */
evidence: AiSearchFinalEvidence[]
/** 本次请求经过安全过滤、去重后的浏览集合;不会发送给 Summary AI。 */
evidenceCollection: AiSearchFinalEvidence[]
contextEvidenceCount: number
aggregation: AiSearchAggregation
agent: AiSearchAgentRun
@@ -453,6 +458,8 @@ export const inferAiSearchTimeRange = (
export const aiSearchIntentLabel = (intent: AiSearchIntent): string => {
if (intent === 'conversation_recall') return '回顾最近聊天'
if (intent === 'conversation_topic_search') return '在指定聊天中查找话题'
if (intent === 'global_sender_topic_search') return '按人物查找'
if (intent === 'global_group_topic_search') return '按群聊查找'
if (intent === 'global_topic_search') return '按话题查找'
if (intent === 'conversation_name_search') return '查找聊天'
return '综合查找'
@@ -532,6 +539,9 @@ export const buildLocalAiSearchPlan = (
const conversationTopic = normalized.match(
/(?:我和|我跟|我与)\s*(.+?)\s*(?:最近|这几天|本周|这个月|本月|今年|上个月)?\s*(?:聊过|提过|说过|讨论过)\s*(.+?)(?:吗|么|沒有|没有)?[??。!!]*$/
)
const globalGroupTopic = normalized.match(
/(?:最近|这几天|本周|这个月|本月|今年)?\s*(?:哪个群聊过|哪些群聊过|哪些群讨论过|哪个群说过)\s*(.+?)[??。!!]*$/
)
const globalTopic = normalized.match(
/(?:最近|这几天|本周|这个月|本月|今年)?\s*(?:谁|哪些人|大家)\s*(?:聊过|提过|说过|讨论过)\s*(.+?)[??。!!]*$/
)
@@ -541,6 +551,7 @@ export const buildLocalAiSearchPlan = (
!conversationTopic &&
!namedConversationRecall &&
!bareNamedConversationRecall &&
!globalGroupTopic &&
!globalTopic &&
/^[^,,。!?!?]{2,32}(?:群|群聊|交流群)$/.test(normalized)
? normalized
@@ -554,7 +565,7 @@ export const buildLocalAiSearchPlan = (
)
?.replace(/^(?:和|跟|与)\s*/, '')
.trim()
const topicQuery = (conversationTopic?.[2] || globalTopic?.[1])
const topicQuery = (conversationTopic?.[2] || globalGroupTopic?.[1] || globalTopic?.[1])
?.replace(/^(?:关于|一下|吗|么)\s*/, '')
.trim()
const intent: AiSearchIntent = conversationTopic
@@ -563,13 +574,15 @@ export const buildLocalAiSearchPlan = (
? 'conversation_recall'
: namedConversationRecall || bareNamedConversationRecall
? 'conversation_name_search'
: globalTopic
? 'global_topic_search'
: conversationName
? 'conversation_name_search'
: keywords.length
? 'global_topic_search'
: 'general'
: globalGroupTopic
? 'global_group_topic_search'
: globalTopic
? 'global_sender_topic_search'
: conversationName
? 'conversation_name_search'
: keywords.length
? 'global_topic_search'
: 'general'
const effectiveKeywords = topicQuery ? [topicQuery] : keywords
return {
intent,
@@ -592,6 +605,8 @@ export const parseAiSearchPlan = (
'general',
'conversation_recall',
'conversation_topic_search',
'global_sender_topic_search',
'global_group_topic_search',
'global_topic_search',
'conversation_name_search'
].includes(String(parsed.intent))
@@ -633,7 +648,9 @@ export const mergeAiSearchPlans = (
const lockedIntent =
local.intent === 'conversation_recall' ||
local.intent === 'conversation_topic_search' ||
local.intent === 'conversation_name_search'
local.intent === 'conversation_name_search' ||
local.intent === 'global_sender_topic_search' ||
local.intent === 'global_group_topic_search'
return {
intent: lockedIntent ? local.intent : ai.intent || local.intent,
keywords,
+23 -1
View File
@@ -1,25 +1,47 @@
export const APP_UPDATE_RELEASES_URL = 'https://github.com/Wxw-Gu/TraceMemo/releases/latest'
export type AppUpdateStatus =
| 'idle'
| 'checking'
| 'available'
| 'not-available'
| 'up-to-date'
| 'downloading'
| 'downloaded'
| 'installing'
| 'error'
| 'unsupported'
export type AppUpdateCheckSource = 'startup' | 'manual'
export type AppUpdateDelivery = 'automatic' | 'release-page'
export interface AppUpdateState {
status: AppUpdateStatus
currentVersion: string
delivery: AppUpdateDelivery
version?: string
percent?: number
transferred?: number
total?: number
bytesPerSecond?: number
message?: string
error?: string
source?: AppUpdateCheckSource
isSimulation?: boolean
}
export interface AppUpdateCheckResult {
success: boolean
state: AppUpdateState
}
export interface AppUpdateInstallResult {
success: boolean
simulated?: boolean
message?: string
error?: string
}
export interface AppUpdateOpenDownloadPageResult {
success: boolean
error?: string
}
+29
View File
@@ -0,0 +1,29 @@
export type PersonalWechatRuntimeState =
| 'missing'
| 'downloading'
| 'ready'
| 'invalid'
| 'error'
| 'unsupported'
export interface PersonalWechatRuntimeStatus {
version: string
state: PersonalWechatRuntimeState
downloadedBytes: number
totalBytes: number
progress: number
platform: NodeJS.Platform
architecture: string
supported: boolean
removable: boolean
directory?: string
error?: string
}
export interface PersonalWechatRuntimeDownloadResult {
success: boolean
status: PersonalWechatRuntimeStatus
error?: string
}
export interface PersonalWechatRuntimeProgressEvent extends PersonalWechatRuntimeStatus {}
+84
View File
@@ -0,0 +1,84 @@
export type PersonalWechatSenderState =
| 'checking'
| 'unsupported_platform'
| 'wechat_not_running'
| 'sip_enabled'
| 'unsupported_version'
| 'runtime_missing'
| 'hook_not_ready'
| 'stopped'
| 'starting'
| 'rebinding'
| 'online'
| 'error'
export interface PersonalWechatSenderStatus {
state: PersonalWechatSenderState
platform: string
arch: string
sipDisabled: boolean
wechatRunning: boolean
wechatPid?: number
boundWechatPid?: number
oneBotPid?: number
endpoint: string
endpointReady: boolean
wechatVersion?: string
runtimeReady: boolean
executablePath?: string
configPath?: string
imagePath?: string
attachReady: boolean
baseAddress?: string
baseAddressReady: boolean
textHookInstalled: boolean
textHookReady: boolean
imageHookInstalled: boolean
imageHookReady: boolean
messageListenerReady: boolean
canSend: boolean
canSendText: boolean
canSendImage: boolean
canSendVoice: boolean
message: string
error?: string
}
interface PersonalWechatSendBaseRequest {
to: string
isGroup: boolean
}
export interface PersonalWechatSendTextRequest extends PersonalWechatSendBaseRequest {
type: 'text'
text: string
}
export interface PersonalWechatSendImageRequest extends PersonalWechatSendBaseRequest {
type: 'image'
filePath: string
}
export interface PersonalWechatSendVoiceRequest extends PersonalWechatSendBaseRequest {
type: 'voice'
filePath: string
}
export type PersonalWechatSendRequest =
| PersonalWechatSendTextRequest
| PersonalWechatSendImageRequest
| PersonalWechatSendVoiceRequest
export interface PersonalWechatSendResult {
success: boolean
status: PersonalWechatSenderStatus
error?: string
}
export interface PersonalWechatImageSelectionResult {
canceled: boolean
path?: string
name?: string
}
export type PersonalWechatVoiceSelectionResult = PersonalWechatImageSelectionResult
+75
View File
@@ -0,0 +1,75 @@
export type TextToSpeechKeySource = 'secure-storage' | 'environment' | 'missing'
export type TextToSpeechModel = 's2.1-pro-free' | 's2.1-pro'
export interface TextToSpeechVoice {
id: string
name: string
description: string
tags: string[]
languages: string[]
source: 'fish-audio'
coverImage?: string
previewUrl?: string
previewText?: string
authorName?: string
taskCount?: number
likeCount?: number
markCount?: number
}
export interface TextToSpeechSettings {
provider: 'fish-audio'
hasApiKey: boolean
hasStoredApiKey: boolean
hasEnvironmentApiKey: boolean
keySource: TextToSpeechKeySource
encryptionAvailable: boolean
selectedVoiceId: string
outputFormat: 'mp3'
model: TextToSpeechModel
phase: 'ready'
}
export interface TextToSpeechSettingsResult {
success: boolean
settings: TextToSpeechSettings
voices: TextToSpeechVoice[]
error?: string
}
export interface SaveTextToSpeechSettingsRequest {
apiKey?: string
clearApiKey?: boolean
selectedVoiceId?: string
model?: TextToSpeechModel
}
export interface ListTextToSpeechVoicesRequest {
pageNumber?: number
pageSize?: number
title?: string
language?: string
tags?: string[]
}
export interface ListTextToSpeechVoicesResult {
success: boolean
items: TextToSpeechVoice[]
total: number
pageNumber: number
pageSize: number
hasMore: boolean
error?: string
}
export interface SynthesizeTextToSpeechRequest {
text: string
referenceId: string
}
export interface SynthesizeTextToSpeechResult {
success: boolean
filePath?: string
audioDataUrl?: string
error?: string
}
+5
View File
@@ -24,6 +24,11 @@ export interface Message {
name?: string
senderId?: string
contentData?: ParsedContent
media?: {
type: 'image'
available: boolean
url: string
}
voiceDataUrl?: string
voiceDuration?: number
voiceTranscript?: string