* ChatApi — 导入、迁移、Demo(数据查询/分析/成员/SQL 已迁移到 HTTP)
| 42 | * ChatApi — 导入、迁移、Demo(数据查询/分析/成员/SQL 已迁移到 HTTP) |
| 43 | */ |
| 44 | interface ChatApi { |
| 45 | selectFile: () => Promise<{ filePath?: string; format?: string; error?: string } | null> |
| 46 | detectFormat: (filePath: string) => Promise<{ id: string; name: string; platform: string; multiChat: boolean } | null> |
| 47 | import: (filePath: string) => Promise<{ success: boolean; sessionId?: string; error?: string }> |
| 48 | importDirectory: (dirPath: string) => Promise<{ success: boolean; sessionId?: string; error?: string }> |
| 49 | importWithOptions: ( |
| 50 | filePath: string, |
| 51 | formatOptions: Record<string, unknown> |
| 52 | ) => Promise<{ success: boolean; sessionId?: string; error?: string }> |
| 53 | scanMultiChatFile: (filePath: string) => Promise<{ |
| 54 | success: boolean |
| 55 | chats: Array<{ index: number; name: string; type: string; id: number; messageCount: number }> |
| 56 | error?: string |
| 57 | }> |
| 58 | prepareImportSource: (filePath: string) => Promise<{ |
| 59 | success: boolean |
| 60 | source?: { |
| 61 | sourceId: string |
| 62 | formatId: string |
| 63 | platform: string |
| 64 | chats: Array<{ |
| 65 | chatId: string |
| 66 | name: string |
| 67 | type: 'private' | 'group' |
| 68 | messageCount: number |
| 69 | memberCount: number |
| 70 | }> |
| 71 | expiresAt: number |
| 72 | } |
| 73 | error?: string |
| 74 | }> |
| 75 | importPreparedChat: ( |
| 76 | sourceId: string, |
| 77 | chatId: string |
| 78 | ) => Promise<{ success: boolean; sessionId?: string; error?: string; diagnostics?: ImportDiagnosticsInfo }> |
| 79 | releaseImportSource: (sourceId: string) => Promise<{ success: boolean }> |
| 80 | checkMigration: () => Promise<MigrationCheckResult> |
| 81 | runMigration: () => Promise<{ success: boolean; error?: string }> |
| 82 | getSupportedFormats: () => Promise<Array<{ id: string; name: string; platform: string; extensions: string[] }>> |
| 83 | onImportProgress: (callback: (progress: ImportProgress) => void) => () => void |
| 84 | analyzeIncrementalImport: ( |
| 85 | sessionId: string, |
| 86 | filePath: string |
| 87 | ) => Promise<{ |
| 88 | newMessageCount: number |
| 89 | duplicateCount: number |
| 90 | totalInFile: number |
| 91 | error?: string |
| 92 | diagnosis?: { suggestion?: string } |
| 93 | }> |
| 94 | incrementalImport: ( |
| 95 | sessionId: string, |
| 96 | filePath: string |
| 97 | ) => Promise<{ success: boolean; newMessageCount: number; error?: string }> |
| 98 | importDemo: (locale: string) => Promise<{ |
| 99 | success: boolean |
| 100 | groupSessionId?: string |
| 101 | privateSessionIds?: string[] |
nothing calls this directly
no outgoing calls
no test coverage detected