@@ -311,16 +311,17 @@ public function deleteSession(int $sessionId): JSONResponse {
311311 *
312312 * Get all chat sessions for the current user
313313 *
314+ * @param bool|null $isAssignment Whether to get only the sessions for assignments (true) or not (false) defaults to false
314315 * @return JSONResponse<Http::STATUS_OK, list<AssistantChatSession>, array{}>|JSONResponse<Http::STATUS_INTERNAL_SERVER_ERROR|Http::STATUS_UNAUTHORIZED, array{error: string}, array{}>
315316 *
316317 * 200: The session list has been obtained successfully
317318 * 401: Not logged in
318319 */
319320 #[NoAdminRequired]
320321 #[OpenAPI(scope: OpenAPI::SCOPE_DEFAULT , tags: ['chat_api ' ])]
321- public function getSessions (): JSONResponse {
322+ public function getSessions (? bool $ isAssignment = false ): JSONResponse {
322323 try {
323- $ sessions = $ this ->chatService ->getSessionsForUser ($ this ->userId );
324+ $ sessions = $ this ->chatService ->getSessionsForUser ($ this ->userId , $ isAssignment );
324325 /** @var list<AssistantChatSession> $serializedSessions */
325326 $ serializedSessions = array_map (static function ($ session ) {
326327 return $ session ->jsonSerialize ();
@@ -380,6 +381,7 @@ public function newMessage(
380381 * @param int $sessionId The session ID
381382 * @param int $limit The max number of messages to return
382383 * @param int $cursor The index of the first result to return
384+ * @param string $filterByRole Only role to include in the response
383385 * @return JSONResponse<Http::STATUS_OK, list<AssistantChatMessage>, array{}>|JSONResponse<Http::STATUS_INTERNAL_SERVER_ERROR|Http::STATUS_UNAUTHORIZED|Http::STATUS_NOT_FOUND, array{error: string}, array{}>
384386 *
385387 * 200: The message list has been successfully obtained
@@ -388,9 +390,9 @@ public function newMessage(
388390 */
389391 #[NoAdminRequired]
390392 #[OpenAPI(scope: OpenAPI::SCOPE_DEFAULT , tags: ['chat_api ' ])]
391- public function getMessages (int $ sessionId , int $ limit = 20 , int $ cursor = 0 ): JSONResponse {
393+ public function getMessages (int $ sessionId , int $ limit = 20 , int $ cursor = 0 , string $ filterByRole = '' ): JSONResponse {
392394 try {
393- $ messages = $ this ->chatService ->getSessionMessages ($ this ->userId , $ sessionId , $ limit , $ cursor );
395+ $ messages = $ this ->chatService ->getSessionMessages ($ this ->userId , $ sessionId , $ limit , $ cursor, $ filterByRole );
394396 return new JSONResponse (array_map (static function (Message $ message ) {
395397 return $ message ->jsonSerialize ();
396398 }, $ messages ));
0 commit comments