Files
ai_chat_assistant/lib/bloc/command_state.dart
guangfei.zhao a7ed838c92 feat: 新增ai_chat_core,将core 和 widget 分离(未完成)
迁移了 models enums, utils, http 封装,还有一些extensions;service 只迁移了 sse service
2025-09-29 18:33:46 +08:00

69 lines
1.6 KiB
Dart

// AI Chat Command States
import 'package:ai_chat_core/ai_chat_core.dart';
enum AIChatCommandStatus {
idle,
executing,
success,
failure,
cancelled,
}
class AIChatCommandState {
final String? commandId;
final VehicleCommandType? commandType;
final Map<String, dynamic>? params;
final AIChatCommandStatus status;
final String? errorMessage;
final Map<String, dynamic>? result;
final DateTime? timestamp;
const AIChatCommandState({
this.commandId,
this.commandType,
this.params,
this.status = AIChatCommandStatus.idle,
this.errorMessage,
this.result,
this.timestamp,
});
AIChatCommandState copyWith({
String? commandId,
VehicleCommandType? commandType,
Map<String, dynamic>? params,
AIChatCommandStatus? status,
String? errorMessage,
Map<String, dynamic>? result,
DateTime? timestamp,
}) {
return AIChatCommandState(
commandId: commandId ?? this.commandId,
commandType: commandType ?? this.commandType,
params: params ?? this.params,
status: status ?? this.status,
errorMessage: errorMessage ?? this.errorMessage,
result: result ?? this.result,
timestamp: timestamp ?? this.timestamp,
);
}
@override
bool operator ==(Object other) {
if (identical(this, other)) return true;
return other is AIChatCommandState &&
other.commandId == commandId &&
other.commandType == commandType &&
other.status == status &&
other.errorMessage == errorMessage;
}
@override
int get hashCode {
return commandId.hashCode ^
commandType.hashCode ^
status.hashCode ^
errorMessage.hashCode;
}
}