0812
This commit is contained in:
@@ -1,11 +1,17 @@
|
||||
import '../enums/message_status.dart';
|
||||
|
||||
class ChatMessage {
|
||||
final String id;
|
||||
final String text;
|
||||
final bool isUser;
|
||||
final DateTime timestamp;
|
||||
MessageStatus status;
|
||||
|
||||
ChatMessage({
|
||||
required this.id,
|
||||
required this.text,
|
||||
required this.isUser,
|
||||
required this.timestamp,
|
||||
this.status = MessageStatus.normal,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,13 +0,0 @@
|
||||
class Message {
|
||||
final String role; // 'user' 或 'assistant'
|
||||
final String message;
|
||||
|
||||
Message({required this.role, required this.message});
|
||||
|
||||
Map<String, dynamic> toMap() {
|
||||
return {
|
||||
'role': role,
|
||||
'message': message,
|
||||
};
|
||||
}
|
||||
}
|
||||
36
lib/models/vehicle_cmd.dart
Normal file
36
lib/models/vehicle_cmd.dart
Normal file
@@ -0,0 +1,36 @@
|
||||
import '../enums/vehicle_command_type.dart';
|
||||
|
||||
class VehicleCommand {
|
||||
final VehicleCommandType type;
|
||||
final Map<String, dynamic>? params;
|
||||
final String error;
|
||||
|
||||
VehicleCommand({required this.type, this.params, this.error = ''});
|
||||
|
||||
// 从字符串创建命令(用于从API响应解析)
|
||||
factory VehicleCommand.fromString(
|
||||
String commandStr, Map<String, dynamic>? params, String error) {
|
||||
// 将字符串转换为枚举值
|
||||
VehicleCommandType type;
|
||||
try {
|
||||
type = VehicleCommandType.values.firstWhere(
|
||||
(e) => e.name == commandStr,
|
||||
orElse: () => VehicleCommandType.unknown,
|
||||
);
|
||||
} catch (e) {
|
||||
print('Error parsing command string: $e');
|
||||
// 默认为搜车指令,或者你可以选择抛出异常
|
||||
type = VehicleCommandType.unknown;
|
||||
}
|
||||
|
||||
return VehicleCommand(type: type, params: params, error: error);
|
||||
}
|
||||
|
||||
// 将命令转换为字符串(用于API请求)
|
||||
String get commandString => type.name;
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'VehicleCommand(command: ${type.name}, params: $params)';
|
||||
}
|
||||
}
|
||||
11
lib/models/vehicle_cmd_response.dart
Normal file
11
lib/models/vehicle_cmd_response.dart
Normal file
@@ -0,0 +1,11 @@
|
||||
import 'package:ai_chat_assistant/models/vehicle_cmd.dart';
|
||||
|
||||
class VehicleCommandResponse {
|
||||
final String? tips;
|
||||
final List<VehicleCommand> commands;
|
||||
|
||||
VehicleCommandResponse({
|
||||
this.tips,
|
||||
required this.commands,
|
||||
});
|
||||
}
|
||||
90
lib/models/vehicle_status_info.dart
Normal file
90
lib/models/vehicle_status_info.dart
Normal file
@@ -0,0 +1,90 @@
|
||||
class VehicleStatusInfo {
|
||||
/// 对应车架号
|
||||
String vin = "";
|
||||
|
||||
/// 剩余里程
|
||||
double remainingMileage = 0;
|
||||
|
||||
/// 空调开关状态 开启true,false关闭
|
||||
bool acState = false;
|
||||
|
||||
/// 空调温度 未拿到、不支持都返回0;原始值
|
||||
double acTemp = 0;
|
||||
|
||||
/// AC开关 true打开,false关闭
|
||||
bool acSwitch = false;
|
||||
|
||||
/// 左前锁状态 true解锁,false闭锁
|
||||
bool leftFrontLockState = false;
|
||||
|
||||
/// 右前锁状态 true解锁,false闭锁
|
||||
bool rightFrontLockState = false;
|
||||
|
||||
/// 左后锁状态 true解锁,false闭锁
|
||||
bool leftRearLockState = false;
|
||||
|
||||
/// 右后锁状态 true解锁,false闭锁
|
||||
bool rightRearLockState = false;
|
||||
|
||||
/// 左前门状态 true打开,false关闭
|
||||
bool leftFrontDoorState = false;
|
||||
|
||||
/// 右前门状态 true打开,false关闭
|
||||
bool rightFrontDoorState = false;
|
||||
|
||||
/// 左后门状态 true打开,false关闭
|
||||
bool leftRearDoorState = false;
|
||||
|
||||
/// 右后门状态 true打开,false关闭
|
||||
bool rightRearDoorState = false;
|
||||
|
||||
/// 左前窗状态 true打开,false关闭
|
||||
bool leftFrontWindowState = false;
|
||||
|
||||
/// 右前窗状态 true打开,false关闭
|
||||
bool rightFrontWindowState = false;
|
||||
|
||||
/// 左后窗状态 true打开,false关闭
|
||||
bool leftRearWindowState = false;
|
||||
|
||||
/// 右后窗状态 true打开,false关闭
|
||||
bool rightRearWindowState = false;
|
||||
|
||||
/// 后备箱状态 true打开,false关闭
|
||||
bool trunkState = false;
|
||||
|
||||
/// 电量百分比
|
||||
int soc = 0;
|
||||
|
||||
/// 车内温度
|
||||
double temperatureInside = 0;
|
||||
|
||||
/// 方向盘加热状态 false:未加热 true:加热中
|
||||
bool wheelHeat = false;
|
||||
|
||||
/// 主座椅加热状态 false:未加热 true:加热中
|
||||
bool mainSeatHeat = false;
|
||||
|
||||
/// 副座椅加热档位 false:未加热 true:加热中
|
||||
bool minorSeatHeat = false;
|
||||
|
||||
/// 是否行驶中,仅用于车控前置条件判断
|
||||
bool isDriving = false;
|
||||
|
||||
/// 会员是否过期 true过期,false不过期
|
||||
bool vipExpired = false;
|
||||
|
||||
/// 会员有效期,时间戳,单位毫秒
|
||||
int vipTime = 0;
|
||||
|
||||
/// 距离过期还剩多少天
|
||||
int vipRemainCount = 0;
|
||||
|
||||
/// 车况更新时间 ms
|
||||
int statusUpdateTime = 0;
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'IGKVehicleStatusInfo{vin:$vin, LockState:($leftFrontLockState,$rightFrontLockState,$leftRearLockState,$rightRearLockState), DoorState:($leftFrontDoorState,$rightFrontDoorState,$leftRearDoorState,$rightRearDoorState), WindowState: ($leftFrontWindowState,$rightFrontWindowState,$leftRearWindowState,$rightRearWindowState), trunkState: $trunkState, soc: $soc, remainingMileage: $remainingMileage, acState: $acState, acTemp: $acTemp, acSwitch:$acSwitch, isDriving:$isDriving, vipExpired: $vipExpired, vipTime: $vipTime, vipRemainCount: $vipRemainCount}';
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user