File size: 1,436 Bytes
d162abc | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 | /**
* 平台适配器接口定义
*/
import { OCRResult } from '../services/ocr.service';
export interface PlatformAdapter {
readonly platform: string;
initialize(): Promise<boolean>;
checkNewMessages(): Promise<MessageContext[]>;
sendMessage(message: string, customerId?: string): Promise<SendMessageResult>;
transferToSubAccount(subAccountId: string): Promise<boolean>;
}
export interface MessageContext {
customerId: string;
customerName: string;
content: string;
attachments?: Attachment[];
timestamp: Date;
confidence?: number;
}
export interface Attachment {
type: 'image' | 'file' | 'link';
url?: string;
localPath?: string;
name?: string;
}
export interface SendMessageResult {
success: boolean;
error?: string;
duration?: number;
}
export interface PlatformConfig {
name: string;
displayName: string;
windowTitle: string;
layout: LayoutConfig;
credentials?: PlatformCredentials;
}
export interface LayoutConfig {
popupPosition: Position;
chatInputPosition: Position;
sendButtonPosition: Position;
customerListPosition: Position;
customerAreaRegion: Region;
subAccountButtonPosition: Position;
}
export interface Position {
x: number;
y: number;
}
export interface Region {
x: number;
y: number;
width: number;
height: number;
}
export interface PlatformCredentials {
cookies?: Record<string, string>;
token?: string;
accountId?: string;
}
|