refactor: 重构 Tool Result 契约,移除 ui_hints 统一使用 result 字段
- ToolAgentOutput 移除 result_summary 和 ui_hints,统一使用 result 字段 - 日历/用户查找工具移除 ui_hints 输出,改为机器可读的结构化结果 - Agent History 移除 tool 消息的 ui_hints 处理逻辑 - App 版本检查改为 manifest.json 方式,支持多渠道发布 - 更新 settings 配置和测试用例适配新结构
This commit is contained in:
@@ -264,24 +264,10 @@ class ChatBloc extends Cubit<ChatState> {
|
||||
}
|
||||
|
||||
void _handleToolCallResult(ToolCallResultEvent event) {
|
||||
final timestamp = DateTime.now();
|
||||
final items = state.items.where((item) {
|
||||
return !(item is ToolCallItem && item.id == event.toolCallId);
|
||||
}).toList();
|
||||
|
||||
if (event.uiSchema != null) {
|
||||
_upsertById(
|
||||
items,
|
||||
ToolResultItem(
|
||||
id: event.messageId,
|
||||
callId: event.toolCallId,
|
||||
uiSchema: event.uiSchema!,
|
||||
timestamp: timestamp,
|
||||
sender: MessageSender.ai,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
emit(state.copyWith(items: items));
|
||||
}
|
||||
|
||||
@@ -326,7 +312,7 @@ class ChatBloc extends Cubit<ChatState> {
|
||||
);
|
||||
}
|
||||
|
||||
if (msg.uiSchema != null) {
|
||||
if (!isTool && msg.uiSchema != null) {
|
||||
converted.add(
|
||||
ToolResultItem(
|
||||
id: '${msg.id}-ui',
|
||||
@@ -444,15 +430,6 @@ class ChatBloc extends Cubit<ChatState> {
|
||||
}
|
||||
}
|
||||
|
||||
void _upsertById(List<ChatListItem> items, ChatListItem nextItem) {
|
||||
final index = items.indexWhere((item) => item.id == nextItem.id);
|
||||
if (index >= 0) {
|
||||
items[index] = nextItem;
|
||||
return;
|
||||
}
|
||||
items.add(nextItem);
|
||||
}
|
||||
|
||||
Future<String> transcribeAudioFile(String filePath) {
|
||||
return _service.transcribeAudio(filePath);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user