Files
ShowenV2/clients/flutter/lib/models/chat_models.dart
XiuchengWu 6f7e24db63 feat: M2.1 客户端骨架、BLE 修复、仓库整理与现状板
- BLE: 修复 BlueZ LocalName 与 Includes 冲突,串行注册与退避
- HTTP: 语音对话补 Live2D talking 标志与 session;Web 补 X-Session-Id
- Flutter: 角色/对话/模型页 + API,Gradle/依赖升级,麦克风权限
- 文档: 新增 docs/STATUS.md,校准 CLAUDE/PROGRESS/README
- 清理: 移除根目录截图与临时模型,运维脚本迁入 scripts/device
2026-07-09 12:41:34 +08:00

46 lines
1.1 KiB
Dart

class ChatTurnResponse {
const ChatTurnResponse({
required this.sessionId,
required this.replyText,
this.transcription,
this.replyAudioPath,
this.error,
});
final String sessionId;
final String replyText;
final String? transcription;
final String? replyAudioPath;
final String? error;
bool get isOk => error == null || error!.isEmpty;
factory ChatTurnResponse.fromJson(Map<String, dynamic> json) {
return ChatTurnResponse(
sessionId: json['session_id']?.toString() ?? '',
replyText: json['reply_text']?.toString() ?? '',
transcription: json['transcription']?.toString(),
replyAudioPath: json['reply_audio_path']?.toString(),
error: json['error']?.toString(),
);
}
}
enum ChatBubbleRole { user, assistant, system }
class ChatBubble {
ChatBubble({
required this.role,
required this.text,
this.audioPath,
this.isPending = false,
DateTime? createdAt,
}) : createdAt = createdAt ?? DateTime.now();
final ChatBubbleRole role;
String text;
String? audioPath;
bool isPending;
final DateTime createdAt;
}