talks.dart 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  1. import 'package:get/get.dart';
  2. import 'package:json_annotation/json_annotation.dart';
  3. part 'talks.g.dart';
  4. @JsonSerializable()
  5. class TalkBean {
  6. @JsonKey(name: 'id')
  7. late final String id;
  8. @JsonKey(name: 'taskId')
  9. String? taskId;
  10. @JsonKey(name: 'ssid')
  11. String? ssid;
  12. @JsonKey(name: 'audioUrl')
  13. String? audioUrl;
  14. @JsonKey(name: 'duration')
  15. double? duration;
  16. @JsonKey(name: 'characters')
  17. int? characters;
  18. @JsonKey(name: 'requestId')
  19. String? requestId;
  20. @JsonKey(name: 'localAudioUrl')
  21. String? localAudioUrl;
  22. @JsonKey(name: 'status', fromJson: _intFromJson, includeToJson: false)
  23. Rxn<int> status;
  24. @JsonKey(name: 'title', fromJson: _stringFromJson, includeToJson: false)
  25. Rxn<String> title;
  26. @JsonKey(name: 'summary', fromJson: _stringFromJson, includeToJson: false)
  27. Rxn<String> summary;
  28. @JsonKey(name: 'createTime')
  29. String? createTime;
  30. @JsonKey(name: 'templateId')
  31. int? templateId;
  32. @JsonKey(name: 'example')
  33. bool? isExample;
  34. @JsonKey(name: 'oversizeFile')
  35. bool? oversizeFile;
  36. @JsonKey(name: 'uploadType')
  37. int? uploadType;
  38. @JsonKey(name: 'progress', fromJson: _intFromJson, includeToJson: false)
  39. Rxn<int> progress = Rxn(0);
  40. @JsonKey(
  41. name: 'progressContent', fromJson: _stringFromJson, includeToJson: false)
  42. Rxn<String> progressContent = Rxn('');
  43. TalkBean({
  44. required this.id,
  45. this.taskId,
  46. this.ssid,
  47. this.audioUrl,
  48. this.duration,
  49. this.templateId,
  50. this.characters,
  51. required this.status,
  52. required this.title,
  53. required this.summary,
  54. this.createTime,
  55. this.isExample,
  56. this.oversizeFile,
  57. this.requestId,
  58. this.uploadType,
  59. this.localAudioUrl,
  60. required this.progress,
  61. required this.progressContent,
  62. });
  63. factory TalkBean.fromJson(Map<String, dynamic> json) =>
  64. _$TalkBeanFromJson(json);
  65. static _stringFromJson(String? txt) => Rxn(txt);
  66. static _intFromJson(int? txt) => Rxn(txt);
  67. void updateBean(TalkBean talkBean) {
  68. taskId = talkBean.taskId;
  69. ssid = talkBean.ssid;
  70. audioUrl = talkBean.audioUrl;
  71. duration = talkBean.duration;
  72. characters = talkBean.characters;
  73. status.value = talkBean.status.value;
  74. title.value = talkBean.title.value;
  75. summary.value = talkBean.summary.value;
  76. templateId = talkBean.templateId;
  77. createTime = talkBean.createTime;
  78. requestId = talkBean.requestId;
  79. isExample = talkBean.isExample;
  80. oversizeFile = talkBean.oversizeFile;
  81. uploadType = talkBean.uploadType;
  82. localAudioUrl = talkBean.localAudioUrl;
  83. progress.value = talkBean.progress.value;
  84. progressContent.value = talkBean.progressContent.value;
  85. }
  86. @override
  87. String toString() {
  88. return 'TalkBean{id: $id, taskId: $taskId, requestId:$requestId , ssid: $ssid, audioUrl: $audioUrl, duration: $duration, characters: $characters, localAudioUrl: $localAudioUrl, status: $status, title: $title, summary: $summary, createTime: $createTime, templateId: $templateId, isExample: $isExample, oversizeFile: $oversizeFile, uploadType: $uploadType, progress: $progress, progressContent: $progressContent}';
  89. }
  90. }
  91. class TalkStatus {
  92. TalkStatus._();
  93. //(0等待生成 1生成中,都处于生成中) 2成功 3失败 4未分析
  94. static int analysing = 0;
  95. static int waitAnalysis = 1;
  96. static int analysisSuccess = 2;
  97. static int analysisFail = 3;
  98. static int notAnalysis = 4;
  99. }
  100. class TalkUploadType {
  101. TalkUploadType._();
  102. static int record = 0;
  103. static int localUpload = 1;
  104. }