mirror of
https://github.com/hellodigua/ChatLab.git
synced 2026-10-25 17:54:34 +08:00
feat(insight): connect relationship galaxy across runtimes
This commit is contained in:
1 parent
051203027a
commit
2148eaffdc
18 files changed
+193
-21
No files matched your search
@@ -38,6 +38,7 @@ import {
|
||||
getLanguagePreferenceAnalysis,
|
||||
getMentionAnalysis,
|
||||
getMentionGraph,
|
||||
getGroupRelationshipGalaxy,
|
||||
getLaughAnalysis,
|
||||
getClusterGraph,
|
||||
getRelationshipStats,
|
||||
@@ -211,6 +212,7 @@ const syncHandlers: Record<string, (payload: any) => any> = {
|
||||
getLanguagePreferenceAnalysis: (p) => getLanguagePreferenceAnalysis(p),
|
||||
getMentionAnalysis: (p) => getMentionAnalysis(p.sessionId, p.filter),
|
||||
getMentionGraph: (p) => getMentionGraph(p.sessionId, p.filter),
|
||||
getGroupRelationshipGalaxy: (p) => getGroupRelationshipGalaxy(p.sessionId, p.filter),
|
||||
getLaughAnalysis: (p) => getLaughAnalysis(p.sessionId, p.filter, p.keywords),
|
||||
getClusterGraph: (p) => getClusterGraph(p.sessionId, p.filter, p.options),
|
||||
getRelationshipStats: (p) => getRelationshipStats(p.sessionId, p.filter, p.options),
|
||||
|
||||
@@ -5,7 +5,13 @@
|
||||
|
||||
export { getCatchphraseAnalysis } from './repeat'
|
||||
|
||||
export { getMentionAnalysis, getMentionGraph, getLaughAnalysis, getClusterGraph } from './social'
|
||||
export {
|
||||
getMentionAnalysis,
|
||||
getMentionGraph,
|
||||
getGroupRelationshipGalaxy,
|
||||
getLaughAnalysis,
|
||||
getClusterGraph,
|
||||
} from './social'
|
||||
export type {
|
||||
MentionGraphData,
|
||||
MentionGraphNode,
|
||||
|
||||
@@ -6,9 +6,12 @@ import { openDatabaseAdapter, type TimeFilter } from '../../core'
|
||||
import {
|
||||
getMentionAnalysis as coreGetMentionAnalysis,
|
||||
getMentionGraph as coreGetMentionGraph,
|
||||
getGroupRelationshipGalaxy as coreGetGroupRelationshipGalaxy,
|
||||
GROUP_RELATIONSHIP_GALAXY_ALGORITHM_VERSION,
|
||||
getLaughAnalysis as coreGetLaughAnalysis,
|
||||
getClusterGraph as coreGetClusterGraph,
|
||||
} from '@openchatlab/core'
|
||||
import type { GroupRelationshipGalaxyData } from '@openchatlab/shared-types'
|
||||
import type {
|
||||
MentionGraphData,
|
||||
MentionGraphNode,
|
||||
@@ -41,6 +44,20 @@ export function getMentionGraph(sessionId: string, filter?: TimeFilter): Mention
|
||||
return coreGetMentionGraph(db, filter)
|
||||
}
|
||||
|
||||
export function getGroupRelationshipGalaxy(sessionId: string, filter?: TimeFilter): GroupRelationshipGalaxyData {
|
||||
const db = openDatabaseAdapter(sessionId)
|
||||
if (!db) {
|
||||
return {
|
||||
graph: { nodes: [], edges: [], communities: [] },
|
||||
members: [],
|
||||
edges: [],
|
||||
stats: { totalMembers: 0, activeMembers: 0, displayedMembers: 0, displayedEdges: 0, communityCount: 0 },
|
||||
algorithmVersion: GROUP_RELATIONSHIP_GALAXY_ALGORITHM_VERSION,
|
||||
}
|
||||
}
|
||||
return coreGetGroupRelationshipGalaxy(db, filter)
|
||||
}
|
||||
|
||||
export function getLaughAnalysis(sessionId: string, filter?: TimeFilter, keywords?: string[]): any {
|
||||
const db = openDatabaseAdapter(sessionId)
|
||||
if (!db)
|
||||
|
||||
@@ -36,6 +36,7 @@ export {
|
||||
getLanguagePreferenceAnalysis,
|
||||
getMentionAnalysis,
|
||||
getMentionGraph,
|
||||
getGroupRelationshipGalaxy,
|
||||
getLaughAnalysis,
|
||||
getClusterGraph,
|
||||
getRelationshipStats,
|
||||
|
||||
@@ -406,6 +406,10 @@ export async function getMentionGraph(sessionId: string, filter?: any): Promise<
|
||||
return sendToWorker('getMentionGraph', { sessionId, filter })
|
||||
}
|
||||
|
||||
export async function getGroupRelationshipGalaxy(sessionId: string, filter?: any): Promise<any> {
|
||||
return sendToWorker('getGroupRelationshipGalaxy', { sessionId, filter })
|
||||
}
|
||||
|
||||
export async function getLaughAnalysis(sessionId: string, filter?: any, keywords?: string[]): Promise<any> {
|
||||
return sendToWorker('getLaughAnalysis', { sessionId, filter, keywords })
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@ describe('worker timeout policy', () => {
|
||||
assert.equal(isRestartableReadOnlyRequestType('executeRawSQL'), true)
|
||||
assert.equal(isRestartableReadOnlyRequestType('getSchema'), true)
|
||||
assert.equal(isRestartableReadOnlyRequestType('getChatOverview'), true)
|
||||
assert.equal(isRestartableReadOnlyRequestType('getGroupRelationshipGalaxy'), true)
|
||||
assert.equal(isRestartableReadOnlyRequestType('searchMessages'), true)
|
||||
assert.equal(isRestartableReadOnlyRequestType('getSegmentSummaries'), true)
|
||||
assert.equal(isRestartableReadOnlyRequestType('analyzePushImport'), true)
|
||||
|
||||
@@ -17,6 +17,7 @@ const RESTARTABLE_READ_ONLY_REQUEST_TYPES = new Set([
|
||||
'getLanguagePreferenceAnalysis',
|
||||
'getMentionAnalysis',
|
||||
'getMentionGraph',
|
||||
'getGroupRelationshipGalaxy',
|
||||
'getLaughAnalysis',
|
||||
'getClusterGraph',
|
||||
'getRelationshipStats',
|
||||
|
||||
Reference in new issue
Block a user