You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
42 lines
1.0 KiB
42 lines
1.0 KiB
import 'package:meta/meta.dart';
|
|
|
|
/// 语音交互事件基类
|
|
abstract class VoiceInteractionEvent {
|
|
final int timestamp;
|
|
|
|
VoiceInteractionEvent({required this.timestamp});
|
|
}
|
|
|
|
/// 聊天历史事件
|
|
class ChatHistoryEvent extends VoiceInteractionEvent {
|
|
final String agentId;
|
|
final String userMessage;
|
|
final String assistantMessage;
|
|
|
|
ChatHistoryEvent({
|
|
required this.agentId,
|
|
required this.userMessage,
|
|
required this.assistantMessage,
|
|
required int timestamp,
|
|
}) : super(timestamp: timestamp);
|
|
}
|
|
|
|
/// 语音识别开始事件
|
|
class RecognitionStartedEvent extends VoiceInteractionEvent {
|
|
RecognitionStartedEvent({
|
|
required int timestamp,
|
|
}) : super(timestamp: timestamp);
|
|
}
|
|
|
|
/// 通用语音交互事件
|
|
/// 用于处理其他类型的事件
|
|
class GenericVoiceInteractionEvent extends VoiceInteractionEvent {
|
|
final String type;
|
|
final Map<String, dynamic>? data;
|
|
|
|
GenericVoiceInteractionEvent({
|
|
required this.type,
|
|
this.data,
|
|
required int timestamp,
|
|
}) : super(timestamp: timestamp);
|
|
}
|