omnics / apps /api /src /modules /automation /interfaces /adapter.interface.ts
qf46578's picture
🦞 龙虾自动同步 - OmniCS 企业级电商智能客服系统完整代码
d162abc verified
Raw History Blame Contribute Delete
1.44 kB
/**
* 平台适配器接口定义
*/
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;
}