docs: 更新协议文档,删除废弃计划文档
- 更新 http-error-codes, user-points-chat-data-protocol - 更新 divination-run-protocol, profile-protocol - 删除废弃的后端和前端设计计划文档
This commit is contained in:
@@ -52,6 +52,7 @@ class RunAcceptedData {
|
||||
|
||||
class DivinationRunAggregate {
|
||||
const DivinationRunAggregate({
|
||||
this.threadId,
|
||||
required this.derived,
|
||||
required this.signLevel,
|
||||
required this.conclusion,
|
||||
@@ -62,6 +63,7 @@ class DivinationRunAggregate {
|
||||
});
|
||||
|
||||
final DerivedDivinationData derived;
|
||||
final String? threadId;
|
||||
final String signLevel;
|
||||
final List<String> conclusion;
|
||||
final List<String> focusPoints;
|
||||
@@ -72,6 +74,7 @@ class DivinationRunAggregate {
|
||||
DivinationResultData toViewData(DivinationParams params) {
|
||||
return DivinationResultData(
|
||||
params: params,
|
||||
threadId: threadId,
|
||||
binaryCode: derived.binaryCode,
|
||||
changedBinaryCode: derived.changedBinaryCode,
|
||||
guaName: derived.guaName,
|
||||
|
||||
@@ -2,6 +2,7 @@ import 'divination_params.dart';
|
||||
|
||||
class DivinationResultData {
|
||||
const DivinationResultData({
|
||||
this.threadId,
|
||||
required this.params,
|
||||
required this.binaryCode,
|
||||
required this.changedBinaryCode,
|
||||
@@ -22,6 +23,7 @@ class DivinationResultData {
|
||||
});
|
||||
|
||||
final DivinationParams params;
|
||||
final String? threadId;
|
||||
final String binaryCode;
|
||||
final String changedBinaryCode;
|
||||
final String guaName;
|
||||
@@ -44,6 +46,7 @@ class DivinationResultData {
|
||||
Map<String, dynamic> toJson() {
|
||||
return <String, dynamic>{
|
||||
'params': params.toPayload(),
|
||||
'threadId': threadId,
|
||||
'binaryCode': binaryCode,
|
||||
'changedBinaryCode': changedBinaryCode,
|
||||
'guaName': guaName,
|
||||
@@ -81,6 +84,7 @@ class DivinationResultData {
|
||||
|
||||
return DivinationResultData(
|
||||
params: DivinationParams.fromPayload(paramsRaw),
|
||||
threadId: json['threadId'] as String?,
|
||||
binaryCode: _requiredString(json, 'binaryCode'),
|
||||
changedBinaryCode: _requiredString(json, 'changedBinaryCode'),
|
||||
guaName: _requiredString(json, 'guaName'),
|
||||
|
||||
@@ -0,0 +1,52 @@
|
||||
class FollowUpMessage {
|
||||
const FollowUpMessage({
|
||||
required this.id,
|
||||
required this.seq,
|
||||
required this.role,
|
||||
required this.content,
|
||||
required this.timestamp,
|
||||
});
|
||||
|
||||
final String id;
|
||||
final int seq;
|
||||
final String role;
|
||||
final String content;
|
||||
final DateTime timestamp;
|
||||
|
||||
factory FollowUpMessage.fromJson(Map<String, dynamic> json) {
|
||||
return FollowUpMessage(
|
||||
id: _requiredString(json, 'id'),
|
||||
seq: _requiredInt(json, 'seq'),
|
||||
role: _requiredString(json, 'role'),
|
||||
content: _requiredStringAllowEmpty(json, 'content'),
|
||||
timestamp: DateTime.parse(_requiredString(json, 'timestamp')).toLocal(),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
String _requiredString(Map<String, dynamic> json, String key) {
|
||||
final value = json[key];
|
||||
if (value is! String || value.isEmpty) {
|
||||
throw FormatException('Missing required string: $key');
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
String _requiredStringAllowEmpty(Map<String, dynamic> json, String key) {
|
||||
final value = json[key];
|
||||
if (value is! String) {
|
||||
throw FormatException('Missing required string: $key');
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
int _requiredInt(Map<String, dynamic> json, String key) {
|
||||
final value = json[key];
|
||||
if (value is int) {
|
||||
return value;
|
||||
}
|
||||
if (value is num) {
|
||||
return value.toInt();
|
||||
}
|
||||
throw FormatException('Missing required int: $key');
|
||||
}
|
||||
Reference in New Issue
Block a user