feat: 修复了插件需要外部Provider的问题;加上了一个简易的车控状态返回
This commit is contained in:
24
lib/bloc/ai_chat_cubit.dart
Normal file
24
lib/bloc/ai_chat_cubit.dart
Normal file
@@ -0,0 +1,24 @@
|
||||
import '../enums/vehicle_command_type.dart';
|
||||
import '../services/command_service.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;
|
||||
}
|
||||
Reference in New Issue
Block a user