mirror of
https://github.com/hellodigua/ChatLab.git
synced 2026-05-19 21:00:25 +08:00
refactor: 重构部分图表为插件形式
This commit is contained in:
@@ -10,15 +10,9 @@ import type {
|
||||
DailyActivity,
|
||||
WeekdayActivity,
|
||||
MonthlyActivity,
|
||||
RepeatAnalysis,
|
||||
CatchphraseAnalysis,
|
||||
NightOwlAnalysis,
|
||||
DragonKingAnalysis,
|
||||
DivingAnalysis,
|
||||
MentionAnalysis,
|
||||
LaughAnalysis,
|
||||
CheckInAnalysis,
|
||||
MemeBattleAnalysis,
|
||||
MemberWithStats,
|
||||
ClusterGraphData,
|
||||
ClusterGraphOptions,
|
||||
@@ -248,13 +242,6 @@ export const chatApi = {
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* 获取复读分析数据
|
||||
*/
|
||||
getRepeatAnalysis: (sessionId: string, filter?: { startTs?: number; endTs?: number }): Promise<RepeatAnalysis> => {
|
||||
return ipcRenderer.invoke('chat:getRepeatAnalysis', sessionId, filter)
|
||||
},
|
||||
|
||||
/**
|
||||
* 获取口头禅分析数据
|
||||
*/
|
||||
@@ -265,33 +252,6 @@ export const chatApi = {
|
||||
return ipcRenderer.invoke('chat:getCatchphraseAnalysis', sessionId, filter)
|
||||
},
|
||||
|
||||
/**
|
||||
* 获取夜猫分析数据
|
||||
*/
|
||||
getNightOwlAnalysis: (
|
||||
sessionId: string,
|
||||
filter?: { startTs?: number; endTs?: number }
|
||||
): Promise<NightOwlAnalysis> => {
|
||||
return ipcRenderer.invoke('chat:getNightOwlAnalysis', sessionId, filter)
|
||||
},
|
||||
|
||||
/**
|
||||
* 获取龙王分析数据
|
||||
*/
|
||||
getDragonKingAnalysis: (
|
||||
sessionId: string,
|
||||
filter?: { startTs?: number; endTs?: number }
|
||||
): Promise<DragonKingAnalysis> => {
|
||||
return ipcRenderer.invoke('chat:getDragonKingAnalysis', sessionId, filter)
|
||||
},
|
||||
|
||||
/**
|
||||
* 获取潜水分析数据
|
||||
*/
|
||||
getDivingAnalysis: (sessionId: string, filter?: { startTs?: number; endTs?: number }): Promise<DivingAnalysis> => {
|
||||
return ipcRenderer.invoke('chat:getDivingAnalysis', sessionId, filter)
|
||||
},
|
||||
|
||||
/**
|
||||
* 获取 @ 互动分析数据
|
||||
*/
|
||||
@@ -335,23 +295,6 @@ export const chatApi = {
|
||||
return ipcRenderer.invoke('chat:getLaughAnalysis', sessionId, filter, keywords)
|
||||
},
|
||||
|
||||
/**
|
||||
* 获取斗图分析数据
|
||||
*/
|
||||
getMemeBattleAnalysis: (
|
||||
sessionId: string,
|
||||
filter?: { startTs?: number; endTs?: number }
|
||||
): Promise<MemeBattleAnalysis> => {
|
||||
return ipcRenderer.invoke('chat:getMemeBattleAnalysis', sessionId, filter)
|
||||
},
|
||||
|
||||
/**
|
||||
* 获取打卡分析数据(火花榜 + 忠臣榜)
|
||||
*/
|
||||
getCheckInAnalysis: (sessionId: string, filter?: { startTs?: number; endTs?: number }): Promise<CheckInAnalysis> => {
|
||||
return ipcRenderer.invoke('chat:getCheckInAnalysis', sessionId, filter)
|
||||
},
|
||||
|
||||
// ==================== 成员管理 ====================
|
||||
|
||||
/**
|
||||
@@ -399,6 +342,22 @@ export const chatApi = {
|
||||
return ipcRenderer.invoke('chat:updateSessionOwnerId', sessionId, ownerId)
|
||||
},
|
||||
|
||||
// ==================== 插件系统 ====================
|
||||
|
||||
/**
|
||||
* 插件参数化只读 SQL 查询
|
||||
*/
|
||||
pluginQuery: <T = Record<string, any>>(sessionId: string, sql: string, params: any[] = []): Promise<T[]> => {
|
||||
return ipcRenderer.invoke('chat:pluginQuery', sessionId, sql, params)
|
||||
},
|
||||
|
||||
/**
|
||||
* 插件计算卸载(纯函数在 Worker 中执行)
|
||||
*/
|
||||
pluginCompute: <T = any>(fnString: string, input: any): Promise<T> => {
|
||||
return ipcRenderer.invoke('chat:pluginCompute', fnString, input)
|
||||
},
|
||||
|
||||
// ==================== SQL 实验室 ====================
|
||||
|
||||
/**
|
||||
|
||||
Vendored
+3
-12
@@ -7,15 +7,9 @@ import type {
|
||||
DailyActivity,
|
||||
WeekdayActivity,
|
||||
MonthlyActivity,
|
||||
RepeatAnalysis,
|
||||
CatchphraseAnalysis,
|
||||
NightOwlAnalysis,
|
||||
DragonKingAnalysis,
|
||||
DivingAnalysis,
|
||||
MentionAnalysis,
|
||||
LaughAnalysis,
|
||||
MemeBattleAnalysis,
|
||||
CheckInAnalysis,
|
||||
MemberWithStats,
|
||||
ClusterGraphData,
|
||||
ClusterGraphOptions,
|
||||
@@ -141,17 +135,11 @@ interface ChatApi {
|
||||
getDbDirectory: () => Promise<string | null>
|
||||
getSupportedFormats: () => Promise<Array<{ name: string; platform: string }>>
|
||||
onImportProgress: (callback: (progress: ImportProgress) => void) => () => void
|
||||
getRepeatAnalysis: (sessionId: string, filter?: TimeFilter) => Promise<RepeatAnalysis>
|
||||
getCatchphraseAnalysis: (sessionId: string, filter?: TimeFilter) => Promise<CatchphraseAnalysis>
|
||||
getNightOwlAnalysis: (sessionId: string, filter?: TimeFilter) => Promise<NightOwlAnalysis>
|
||||
getDragonKingAnalysis: (sessionId: string, filter?: TimeFilter) => Promise<DragonKingAnalysis>
|
||||
getDivingAnalysis: (sessionId: string, filter?: TimeFilter) => Promise<DivingAnalysis>
|
||||
getMentionAnalysis: (sessionId: string, filter?: TimeFilter) => Promise<MentionAnalysis>
|
||||
getMentionGraph: (sessionId: string, filter?: TimeFilter) => Promise<MentionGraphData>
|
||||
getClusterGraph: (sessionId: string, filter?: TimeFilter, options?: ClusterGraphOptions) => Promise<ClusterGraphData>
|
||||
getLaughAnalysis: (sessionId: string, filter?: TimeFilter, keywords?: string[]) => Promise<LaughAnalysis>
|
||||
getMemeBattleAnalysis: (sessionId: string, filter?: TimeFilter) => Promise<MemeBattleAnalysis>
|
||||
getCheckInAnalysis: (sessionId: string, filter?: TimeFilter) => Promise<CheckInAnalysis>
|
||||
// 成员管理
|
||||
getMembers: (sessionId: string) => Promise<MemberWithStats[]>
|
||||
getMembersPaginated: (
|
||||
@@ -166,6 +154,9 @@ interface ChatApi {
|
||||
}>
|
||||
updateMemberAliases: (sessionId: string, memberId: number, aliases: string[]) => Promise<boolean>
|
||||
deleteMember: (sessionId: string, memberId: number) => Promise<boolean>
|
||||
// 插件系统
|
||||
pluginQuery: <T = Record<string, any>>(sessionId: string, sql: string, params?: any[]) => Promise<T[]>
|
||||
pluginCompute: <T = any>(fnString: string, input: any) => Promise<T>
|
||||
// SQL 实验室
|
||||
getSchema: (sessionId: string) => Promise<TableSchema[]>
|
||||
executeSQL: (sessionId: string, sql: string) => Promise<SQLResult>
|
||||
|
||||
Reference in New Issue
Block a user