import 'package:electronic_assistant/data/bean/chat_item.dart';
import 'package:get/get.dart';
import '../../widget/gradually_md_text.dart';

class ProgressingChatItem extends ChatItem {
  final GraduallyController graduallyController;

  final RxBool isFinished = false.obs;

  final RxBool isFailed = false.obs;

  final RxString error = "".obs;

  final RxBool isGradually = false.obs;

  ProgressingChatItem(
      {required super.id,
      required this.graduallyController,
      required super.conversationId,
      required super.role,
      required super.content,
      required super.createTime});

  void setAppendDone() {
    graduallyController.appendDone();
  }

  void setGraduallyFinishedListener() {
    graduallyController.setGraduallyFinishedListener(() {
      isFinished.value = true;
    });
  }

  void append(String content) {
    graduallyController.append(content);
    isGradually.value = true;
  }
}
