22 lines
611 B
Dart
22 lines
611 B
Dart
import 'easy_bloc.dart';
|
|
import 'command_state.dart';
|
|
|
|
class AIChatCommandCubit extends EasyCubit<AIChatCommandState> {
|
|
AIChatCommandCubit() : super(const AIChatCommandState());
|
|
|
|
// 重置状态
|
|
void reset() {
|
|
emit(const AIChatCommandState());
|
|
}
|
|
|
|
// 生成唯一命令ID
|
|
String _generateCommandId() {
|
|
return '${DateTime.now().millisecondsSinceEpoch}_${state.commandType?.name ?? 'unknown'}';
|
|
}
|
|
|
|
// 检查当前是否有命令在执行
|
|
bool get isExecuting => state.status == AIChatCommandStatus.executing;
|
|
|
|
// 获取当前命令ID
|
|
String? get currentCommandId => state.commandId;
|
|
} |