42 lines
852 B
TypeScript
42 lines
852 B
TypeScript
// types/chat.ts
|
|
// types/chat.ts (更新)
|
|
export interface VoiceMessage {
|
|
id: string;
|
|
type: "voice";
|
|
content: {
|
|
duration: number;
|
|
url?: string;
|
|
localId?: string;
|
|
blob?: Blob;
|
|
waveform?: number[];
|
|
// 新增上传相关字段
|
|
fileId?: string;
|
|
fileName?: string;
|
|
serverUrl?: string;
|
|
uploadStatus?: "uploading" | "success" | "error";
|
|
uploadProgress?: number;
|
|
};
|
|
sender: "user" | "pet";
|
|
timestamp: number;
|
|
isPlaying?: boolean;
|
|
translation?: string;
|
|
translating?: boolean;
|
|
}
|
|
|
|
export interface TextMessage {
|
|
id: string;
|
|
type: "text";
|
|
content: string;
|
|
sender: "user" | "pet";
|
|
timestamp: number;
|
|
}
|
|
|
|
export type ChatMessage = VoiceMessage | TextMessage;
|
|
|
|
export interface PetProfile {
|
|
name: string;
|
|
avatar: string;
|
|
species: "dog" | "cat" | "bird" | "other";
|
|
personality: string;
|
|
}
|