feat: 添加 Agent 步骤事件与图片附件功能
- 新增 stepStarted/stepFinished 事件类型支持 - 前端实现图片附件上传和预览功能 - 后端增强工具结果存储和事件处理 - 完善相关单元测试和集成测试
This commit is contained in:
@@ -50,7 +50,6 @@ class ApiClient implements IApiClient {
|
||||
};
|
||||
}
|
||||
|
||||
@override
|
||||
Future<Response<T>> get<T>(String path, {Options? options}) async {
|
||||
try {
|
||||
return await _dio.get<T>(path, options: options);
|
||||
|
||||
@@ -40,7 +40,11 @@ class MockApiClient implements IApiClient {
|
||||
_handlers[key] = handler;
|
||||
}
|
||||
|
||||
void registerPatternHandler(RegExp pattern, String method, MockHandler handler) {
|
||||
void registerPatternHandler(
|
||||
RegExp pattern,
|
||||
String method,
|
||||
MockHandler handler,
|
||||
) {
|
||||
_patternHandlers.add(
|
||||
_PatternRoute(
|
||||
pattern: pattern,
|
||||
@@ -96,11 +100,7 @@ class MockApiClient implements IApiClient {
|
||||
final direct = _handlers[key];
|
||||
if (direct != null) {
|
||||
final response = direct(
|
||||
MockRequest(
|
||||
path: path,
|
||||
method: 'SSE',
|
||||
headers: headers,
|
||||
),
|
||||
MockRequest(path: path, method: 'SSE', headers: headers),
|
||||
);
|
||||
if (response is Stream<String>) {
|
||||
return response;
|
||||
@@ -118,11 +118,7 @@ class MockApiClient implements IApiClient {
|
||||
continue;
|
||||
}
|
||||
final response = route.handler(
|
||||
MockRequest(
|
||||
path: path,
|
||||
method: 'SSE',
|
||||
headers: headers,
|
||||
),
|
||||
MockRequest(path: path, method: 'SSE', headers: headers),
|
||||
);
|
||||
if (response is Stream<String>) {
|
||||
return response;
|
||||
@@ -147,12 +143,7 @@ class MockApiClient implements IApiClient {
|
||||
|
||||
if (handler != null) {
|
||||
final response = handler(
|
||||
MockRequest(
|
||||
path: path,
|
||||
method: method,
|
||||
data: data,
|
||||
options: options,
|
||||
),
|
||||
MockRequest(path: path, method: method, data: data, options: options),
|
||||
);
|
||||
if (response is Response) {
|
||||
return response as Response<T>;
|
||||
|
||||
Reference in New Issue
Block a user