API-PATCH-v1-chat-sessions-id

abstract

Renames a chat session. Called both by the user (inline edit in sidebar) and automatically by the update_session_title_logic background task that generates a title from the first message using the LLM.


🔒 Authentication

None.


🛠️ Technical Specification

Request

PropertyValue
MethodPATCH
Path/api/v1/chat/sessions/{session_id}
Tags["Chat"]

📦 Query Parameters

ParamTypeRequiredDescription
session_idUUIDYesPath param — target session
titlestringYesQuery param — new session title

Logic Flow

📤 Responses

StatusBodyCondition
200 OKUpdated ChatSession objectSession found and renamed
404 Not Found{ detail: "Session not found" }session_id not in DB
RoleFile
Routerbackend/app/api/v1/chat.py :: rename_session()
Title update logicbackend/app/services/chat_history_service.py :: update_session_title()
Auto-title triggerbackend/app/api/v1/chat.py :: update_session_title_logic() (BackgroundTask)
UI triggerfrontend/src/components/nav-session.tsxuseChatStore.updateSessionTitle()

RoleLink
Create sessionAPI-POST-v1-chat-sessions
Delete sessionAPI-DELETE-v1-chat-sessions-id
DB tableDB - chatsession