refactor: 重构聊天模块支持 SSE 断线重连及用户上下文隔离
This commit is contained in:
@@ -25,16 +25,16 @@ class ChatApiImpl implements ChatApi {
|
||||
@override
|
||||
Future<Stream<String>> streamRunEvents(
|
||||
String threadId, {
|
||||
required String runId,
|
||||
String? lastEventId,
|
||||
}) {
|
||||
final headers = <String, String>{'Accept': 'text/event-stream'};
|
||||
if (lastEventId != null && lastEventId.isNotEmpty) {
|
||||
headers['Last-Event-ID'] = lastEventId;
|
||||
}
|
||||
return _apiClient.getSseLines(
|
||||
'/api/v1/agent/runs/$threadId/events',
|
||||
headers: headers,
|
||||
);
|
||||
final encodedRunId = Uri.encodeQueryComponent(runId);
|
||||
final path = '/api/v1/agent/runs/$threadId/events?runId=$encodedRunId';
|
||||
return _apiClient.getSseLines(path, headers: headers);
|
||||
}
|
||||
|
||||
@override
|
||||
|
||||
Reference in New Issue
Block a user