main: 增强会话功能,支持归档与消息检索
- 添加会话归档接口及相关服务逻辑,并确保幂等性 - 实现单条消息获取接口,校验消息所属会话 - 增加 SSE 增量推送与实时消息订阅功能 - 提供相关的测试用例覆盖新功能 - 更新接口文档,完善 OpenAPI 规范,新增多项示例
This commit is contained in:
@@ -70,6 +70,17 @@ class ChatSessionController extends Controller
|
||||
return MessageResource::collection($messages)->response();
|
||||
}
|
||||
|
||||
public function showMessage(string $sessionId, string $messageId): JsonResponse
|
||||
{
|
||||
$message = $this->service->getMessage($sessionId, $messageId);
|
||||
|
||||
if (! $message) {
|
||||
abort(404);
|
||||
}
|
||||
|
||||
return (new MessageResource($message))->response();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取会话列表。
|
||||
*
|
||||
@@ -109,4 +120,18 @@ class ChatSessionController extends Controller
|
||||
|
||||
return (new ChatSessionResource($session))->response();
|
||||
}
|
||||
|
||||
public function show(string $sessionId): JsonResponse
|
||||
{
|
||||
$session = $this->service->getSessionWithLastMessage($sessionId);
|
||||
|
||||
return (new ChatSessionResource($session))->response();
|
||||
}
|
||||
|
||||
public function archive(string $sessionId): JsonResponse
|
||||
{
|
||||
$session = $this->service->archiveSession($sessionId);
|
||||
|
||||
return (new ChatSessionResource($session))->response();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user