feat: 优化 Agent 运行时与聊天设置体验
This commit is contained in:
@@ -87,5 +87,32 @@ void main() {
|
||||
expect(snapshot.messages, hasLength(1));
|
||||
expect(snapshot.messages.first.uiSchema, isNotNull);
|
||||
});
|
||||
|
||||
test('parses history user attachments list', () {
|
||||
final snapshot = HistorySnapshot.fromJson({
|
||||
'scope': 'history_day',
|
||||
'threadId': 'thread_1',
|
||||
'day': '2026-03-16',
|
||||
'hasMore': false,
|
||||
'messages': [
|
||||
{
|
||||
'id': 'm1',
|
||||
'seq': 1,
|
||||
'role': 'user',
|
||||
'content': '请看图',
|
||||
'attachments': [
|
||||
{'url': 'https://signed.example/a.png', 'mimeType': 'image/png'},
|
||||
{'url': 'https://signed.example/b.jpg', 'mimeType': 'image/jpeg'},
|
||||
],
|
||||
'timestamp': '2026-03-16T10:00:00Z',
|
||||
},
|
||||
],
|
||||
});
|
||||
|
||||
final userMessage = snapshot.messages.first;
|
||||
expect(userMessage.attachments, hasLength(2));
|
||||
expect(userMessage.attachments.first.url, 'https://signed.example/a.png');
|
||||
expect(userMessage.attachments.last.mimeType, 'image/jpeg');
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:social_app/features/chat/presentation/bloc/agent_stage.dart';
|
||||
|
||||
void main() {
|
||||
group('agent stage mapping', () {
|
||||
test('maps protocol step router to intent stage label', () {
|
||||
final stage = stageFromStepName('router');
|
||||
|
||||
expect(stage, AgentStage.intent);
|
||||
expect(stageLabel(stage), '意图识别中');
|
||||
});
|
||||
|
||||
test('maps protocol step worker to execution stage label', () {
|
||||
final stage = stageFromStepName('worker');
|
||||
|
||||
expect(stage, AgentStage.execution);
|
||||
expect(stageLabel(stage), '任务执行中');
|
||||
});
|
||||
|
||||
test('uses processing label when step is unknown', () {
|
||||
final stage = stageFromStepName('unexpected');
|
||||
|
||||
expect(stage, isNull);
|
||||
expect(stageLabel(stage), '任务处理中');
|
||||
});
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user