Backend¶
Here are listed and documented all the FastApi backend server endpoints.
Starting the server¶
cd backend/
python run.py install
python run.py dev
Available Endpoints¶
Endpoint |
Method |
Description |
|---|---|---|
|
POST |
Creates a new chat session |
|
GET |
Retrieves the paginated chat sessions |
|
GET |
Retrieves conversation history |
|
PUT |
Updates the title of a specific chat |
|
DELETE |
Deletes a chat session |
|
POST |
Sends a message to the chatbot |
|
POST |
Regenerates the answer for a specific message |
|
PUT |
Edits a specific question |
|
POST |
Uploads Jenkins context |
|
GET |
Gets last context upload date |
POST /chats/¶
Create a new chat session
Request body:
{
"title": "string"
}
Response:
{
"id": "int",
"user_id": "str",
"title": "str",
"created_at": "str (datetime)",
"updated_at": "str (datetime)"
}
GET /chats?limit=10&offset=0¶
Retrieve the chat history
Request body:
{}
Response:
{
"items": "ChatResponse[]",
"total_items": "int",
"limit": "int",
"offset": "int"
}
GET /chats/{chat_id}?limit=10&offset=0¶
Retrieves conversation history
Request body:
{}
Response:
{
"items": "QAPairResponse[]",
"total_items": "int",
"limit": "int",
"offset": "int"
}
PUT /chats/{chat_id}/title¶
Updates the title of a specific chat
Request body:
{
"new_title": "str"
}
Response:
{
"id": "int",
"user_id": "str",
"title": "str",
"created_at": "str (datetime)",
"updated_at": "str (datetime)"
}
DELETE /chats/{chat_id}¶
Deletes a chat session
Request body:
{}
Response:
{
"message": "str"
}
POST /messages/send¶
Sends a message to the chatbot. Returns a Server-Sent Events (SSE) stream for typing simulation.
Request body:
{
"chat_id": "int",
"content": "str"
}
Response:
Event Stream (text/event-stream)
data: {"event": "started", "qa_pair_id": "int"}
data: {"event": "chunk", "content": "str"}
...
data: {"event": "done"}
POST /messages/{qa_pair_id}/retry¶
Regenerates the answer for a specific message. Truncates the chat history from this point onward and returns a new Server-Sent Events (SSE) stream.
Request body:
{}
Response:
Event Stream (text/event-stream)
data: {"event": "started", "qa_pair_id": "int"}
data: {"event": "chunk", "content": "str"}
...
data: {"event": "done"}
PUT /messages/{qa_pair_id}/edit¶
Edits a specific question. Truncates the chat history from this point onward, generates a new question, and returns a Server-Sent Events (SSE) stream.
Request body:
{
"new_content": "str"
}
Response:
Event Stream (text/event-stream)
data: {"event": "started", "qa_pair_id": "int"}
data: {"event": "chunk", "content": "str"}
...
data: {"event": "done"}
POST /context/{chat_id}¶
Uploads Jenkins context for a specific chat, stores the logs, and updates vector embeddings.
Request body:
{
"jenkinsContext": {
"currentScreen": "str",
"jenkinsVersion": "str",
"rootUrl": "str",
"systemMessage": "str",
"activePlugins": {
"plugin_name": "version_str"
},
"masterNode": {
"executors": "int",
"isOnline": "bool",
"systemInfo": {}
},
"agentStats": {
"onlineAgents": "int",
"offlineAgents": "int"
},
"jobDetails": {},
"buildDetails": {}
}
}
Response:
{
"success": "bool",
"received_data": "JenkinsContext (object)"
}
GET /context/{chat_id}/last-upload¶
Gets the date and time of the last context upload for a specific chat.
Request body:
{}
Response:
{
"last_upload_at": "str (datetime) | null"
}