feat(apps/chat): 新增 UI Schema 导航和路由导航工具

This commit is contained in:
zl-q
2026-03-19 00:51:57 +08:00
parent bfc3096199
commit 81cbc14219
8 changed files with 113 additions and 103 deletions
@@ -177,7 +177,7 @@ class TextMessageEndEvent extends AgUiEvent {
answer: _asString(json['answer']),
role: _asString(json['role'], fallback: 'assistant'),
status: _asString(json['status'], fallback: 'success'),
uiSchema: _asMap(json['ui_schema']) ?? _asMap(json['uiSchema']),
uiSchema: _asMap(json['ui_schema']),
);
}
@@ -238,17 +238,12 @@ class ToolCallResultEvent extends AgUiEvent {
factory ToolCallResultEvent.fromJson(Map<String, dynamic> json) =>
ToolCallResultEvent(
messageId: _asString(
json['messageId'],
fallback: 'tool-${_asString(json['tool_call_id'])}',
),
toolCallId: _asString(json['tool_call_id'] ?? json['toolCallId']),
toolName: _asString(json['tool_name'] ?? json['toolName']),
resultSummary: _asString(
json['result_summary'] ?? json['resultSummary'],
),
messageId: _asString(json['messageId']),
toolCallId: _asString(json['tool_call_id']),
toolName: _asString(json['tool_name']),
resultSummary: _asString(json['result']),
status: _asString(json['status'], fallback: 'success'),
uiSchema: _asMap(json['ui_schema']) ?? _asMap(json['uiSchema']),
uiSchema: _asMap(json['ui_schema']),
);
}
@@ -328,7 +323,7 @@ class HistoryMessage {
timestamp:
DateTime.tryParse(_asString(json['timestamp'])) ?? DateTime.now(),
attachments: _parseHistoryAttachments(json['attachments']),
uiSchema: _asMap(json['ui_schema']) ?? _asMap(json['uiSchema']),
uiSchema: _asMap(json['ui_schema']),
);
}