Nexent Community API Documentation
This document provides a comprehensive overview of all API endpoints available in the Nexent Community backend.
Table of Contents
- Base App
- Agent App
- Config Sync App
- Conversation Management App
- Data Process App
- Elasticsearch App
- ME Model Management App
- Model Management App
- Proxy App
- File Management App
- Voice App
Base App
The base app serves as the main FastAPI application that includes all other routers and provides global exception handling.
Global Exception Handlers
HTTPException
: Returns JSON response with error messageException
: Returns generic 500 error response
Agent App
Endpoints
POST /api/agent/run
Executes an agent with the provided request.
Request Body:
{
"query": "string",
"history": "array",
"minio_files": "array"
}
Response:
- Streaming response with SSE (Server-Sent Events)
- Returns agent's responses in real-time
POST /api/agent/reload_config
Manually triggers configuration reload.
Response:
- Success/failure status
Config Sync App
Endpoints
POST /api/config/save_config
Saves configuration to environment variables.
Request Body:
{
"app": {
"name": "string",
"description": "string",
"icon": {
"type": "string",
"avatarUri": "string",
"customUrl": "string"
}
},
"models": {
"llm": {
"name": "string",
"displayName": "string",
"apiConfig": {
"apiKey": "string",
"modelUrl": "string"
}
},
// ... other model configurations
},
"data": {
"selectedKbNames": "array",
"selectedKbModels": "array",
"selectedKbSources": "array"
}
}
Response:
{
"message": "Configuration saved successfully",
"status": "saved"
}
GET /api/config/load_config
Loads configuration from environment variables.
Response:
{
"config": {
"app": {
"name": "string",
"description": "string",
"icon": {
"type": "string",
"avatarUri": "string",
"customUrl": "string"
}
},
"models": {
"llm": {
"name": "string",
"displayName": "string",
"apiConfig": {
"apiKey": "string",
"modelUrl": "string"
}
},
// ... other model configurations
},
"data": {
"selectedKbNames": ["string"],
"selectedKbModels": ["string"],
"selectedKbSources": ["string"]
}
}
}
Conversation Management App
Endpoints
PUT /api/conversation/create
Creates a new conversation.
Request Body:
{
"title": "string"
}
Response:
{
"code": 0,
"message": "success",
"data": {
"conversation_id": "string",
"conversation_title": "string",
"create_time": "number",
"update_time": "number"
}
}
GET /api/conversation/list
Gets all conversations.
Response:
{
"code": 0,
"message": "success",
"data": [
{
"conversation_id": "string",
"conversation_title": "string",
"create_time": "number",
"update_time": "number"
}
]
}
POST /api/conversation/rename
Renames a conversation.
Request Body:
{
"conversation_id": "number",
"name": "string"
}
Response:
{
"code": 0,
"message": "success",
"data": true
}
DELETE /api/conversation/
Deletes a conversation.
Response:
{
"code": 0,
"message": "success",
"data": true
}
GET /api/conversation/
Gets conversation history.
Response:
{
"code": 0,
"message": "success",
"data": {
"conversation_id": "string",
"create_time": "number",
"message": [
{
"role": "string",
"message": "array",
"message_id": "string",
"opinion_flag": "string",
"picture": "array",
"search": "array"
}
]
}
}
POST /api/conversation/sources
Gets message source information.
Request Body:
{
"conversation_id": "number",
"message_id": "string",
"type": "string"
}
Response:
{
"code": 0,
"message": "success",
"data": {
"searches": [
{
"title": "string",
"text": "string",
"source_type": "string",
"url": "string",
"filename": "string",
"published_date": "string",
"score": "number",
"score_details": {
"accuracy": "number",
"semantic": "number"
}
}
],
"images": ["string"]
}
}
POST /api/conversation/generate_title
Generates conversation title.
Request Body:
{
"conversation_id": "number",
"history": [
{
"role": "string",
"content": "string"
}
]
}
Response:
{
"code": 0,
"message": "success",
"data": "string"
}
POST /api/conversation/message/update_opinion
Updates message like/dislike status.
Request Body:
{
"message_id": "string",
"opinion": "string"
}
Response:
{
"code": 0,
"message": "success",
"data": true
}
Data Process App
Endpoints
POST /api/tasks
Creates a new data processing task.
Request Body:
{
"source": "string",
"source_type": "string",
"chunking_strategy": "string",
"index_name": "string",
"additional_params": {
"key": "value"
}
}
Response:
{
"task_id": "string"
}
POST /api/tasks/batch
Creates a batch of data processing tasks.
Request Body:
{
"sources": [
{
"source": "string",
"source_type": "string",
"chunking_strategy": "string",
"index_name": "string",
"additional_params": {
"key": "value"
}
}
]
}
Response:
{
"task_ids": ["string"]
}
GET /api/tasks/
Gets task status.
Response:
{
"id": "string",
"status": "string",
"created_at": "string",
"updated_at": "string",
"error": "string"
}
GET /api/tasks
Lists all tasks.
Response:
{
"tasks": [
{
"id": "string",
"status": "string",
"created_at": "string",
"updated_at": "string",
"error": "string"
}
]
}
GET /api/tasks/indices/{index_name}/tasks
Gets all active tasks for a specific index.
Response:
{
"index_name": "string",
"files": [
{
"path_or_url": "string",
"status": "string"
}
]
}
GET /api/tasks/{task_id}/details
Gets task status and results.
Response:
{
"id": "string",
"status": "string",
"created_at": "string",
"updated_at": "string",
"error": "string",
"results": "object"
}
Elasticsearch App
Endpoints
POST /api/indices/
Creates a new vector index.
Parameters:
index_name
: Name of the indexembedding_dim
: Optional dimension of embedding vectors
Response:
{
"status": "success",
"message": "string",
"embedding_dim": "number"
}
DELETE /api/indices/
Deletes an index.
Response:
{
"status": "success",
"message": "string"
}
GET /api/indices
Lists all indices.
Parameters:
pattern
: Pattern to match index namesinclude_stats
: Whether to include index stats
Response:
{
"indices": ["string"],
"count": "number",
"indices_info": [
{
"name": "string",
"stats": {
"docs": "number",
"size": "string"
}
}
]
}
GET /api/indices/{index_name}/info
Gets index information.
Parameters:
include_files
: Whether to include file listinclude_chunks
: Whether to include text chunks
Response:
{
"base_info": {
"docs": "number",
"size": "string"
},
"search_performance": {
"query_time": "number",
"hits": "number"
},
"fields": {
"field_name": {
"type": "string"
}
},
"files": [
{
"path_or_url": "string",
"file": "string",
"file_size": "number",
"create_time": "string",
"status": "string",
"chunks": [
{
"id": "string",
"title": "string",
"content": "string",
"create_time": "string"
}
],
"chunks_count": "number"
}
]
}
POST /api/indices/{index_name}/documents
Indexes documents.
Request Body:
{
"task_id": "string",
"results": [
{
"metadata": {
"filename": "string",
"title": "string",
"languages": ["string"],
"author": "string",
"date": "string",
"file_size": "number",
"creation_date": "string"
},
"source": "string",
"text": "string",
"source_type": "string"
}
]
}
Response:
{
"success": true,
"message": "string",
"total_indexed": "number",
"total_submitted": "number"
}
DELETE /api/indices/{index_name}/documents
Deletes documents.
Request Body:
{
"path_or_url": "string"
}
Response:
{
"status": "success",
"deleted_count": "number"
}
POST /api/indices/search/accurate
Performs accurate search.
Request Body:
{
"query": "string",
"index_names": ["string"],
"top_k": "number"
}
Response:
{
"results": [
{
"id": "string",
"title": "string",
"content": "string",
"score": "number",
"index": "string"
}
],
"total": "number",
"query_time_ms": "number"
}
POST /api/indices/search/semantic
Performs semantic search.
Request Body:
{
"query": "string",
"index_names": ["string"],
"top_k": "number"
}
Response:
{
"results": [
{
"id": "string",
"title": "string",
"content": "string",
"score": "number",
"index": "string"
}
],
"total": "number",
"query_time_ms": "number"
}
POST /api/indices/search/hybrid
Performs hybrid search.
Request Body:
{
"query": "string",
"index_names": ["string"],
"top_k": "number",
"weight_accurate": "number"
}
Response:
{
"results": [
{
"id": "string",
"title": "string",
"content": "string",
"score": "number",
"index": "string",
"score_details": {
"accurate": "number",
"semantic": "number"
}
}
],
"total": "number",
"query_time_ms": "number"
}
GET /api/indices/health
Checks API and Elasticsearch health.
Response:
{
"status": "healthy",
"elasticsearch": "connected",
"indices_count": "number"
}
ME Model Management App
Endpoints
GET /api/me/model/list
Gets list of ME models.
Request Body:
{
"type": "string",
"timeout": "number"
}
Response:
{
"code": 200,
"message": "Successfully retrieved",
"data": [
{
// TODO: Definition
"id": "string",
"name": "string",
"type": "string",
"description": "string"
}
]
}
GET /api/me/healthcheck
Checks ME model connectivity.
Request Body:
{
"timeout": "number"
}
Response:
{
"code": 200,
"message": "Connection successful",
"data": {
"status": "Connected",
"desc": "Connection successful",
"connect_status": "AVAILABLE"
}
}
GET /api/me/model/healthcheck
Checks specific model health.
Request Body:
{
"model_name": "string"
}
Response:
{
"code": 200,
"message": "Model health check successful",
"data": {
"status": "string",
"desc": "string",
"connect_status": "string"
}
}
Model Management App
Endpoints
POST /api/model/create
Creates a new model.
Request Body:
{
"model_name": "string",
"display_name": "string",
"connect_status": "string"
}
Response:
{
"code": 200,
"message": "Model created successfully",
"data": null
}
POST /api/model/update
Updates a model.
Request Body:
{
"model_name": "string",
"display_name": "string",
"connect_status": "string"
}
Response:
{
"code": 200,
"message": "Model updated successfully",
"data": {
"model_name": "string"
}
}
POST /api/model/delete
Deletes a model.
Request Body:
{
"model_name": "string"
}
Response:
{
"code": 200,
"message": "Model deleted successfully",
"data": {
"model_name": "string"
}
}
GET /api/model/list
Gets all models.
Response:
{
"code": 200,
"message": "Successfully retrieved model list",
"data": [
{
"model_id": "string",
"model_name": "string",
"model_repo": "string",
"display_name": "string",
"connect_status": "string"
}
]
}
GET /api/model/healthcheck
Checks model health.
Request Body:
{
"model_name": "string"
}
Response:
{
"code": 200,
"message": "Model health check successful",
"data": {
"status": "string",
"desc": "string",
"connect_status": "string"
}
}
GET /api/model/get_connect_status
Gets model connection status.
Request Body:
{
"model_name": "string"
}
Response:
{
"code": 200,
"message": "Successfully retrieved connection status",
"data": {
"model_name": "string",
"connect_status": "string"
}
}
POST /api/model/update_connect_status
Updates model connection status.
Request Body:
{
"model_name": "string",
"connect_status": "string"
}
Response:
{
"code": 200,
"message": "Successfully updated connection status",
"data": {
"model_name": "string",
"connect_status": "string"
}
}
Proxy App
Endpoints
GET /api/proxy/image
Proxies remote images.
Request Body:
{
"url": "string"
}
Response:
{
"success": true,
"base64": "string",
"content_type": "string"
}
File Management App
Endpoints
POST /api/file/upload
Uploads files.
Request Body:
{
"file": ["file"],
"chunking_strategy": "string",
"index_name": "string"
}
Response:
{
"message": "string",
"uploaded_files": ["string"],
"process_tasks": {
"task_id": "string"
}
}
POST /api/file/storage
Uploads files to storage.
Request Body:
{
"files": ["file"],
"folder": "string"
}
Response:
{
"message": "string",
"success_count": "number",
"failed_count": "number",
"results": [
{
"success": true,
"file_name": "string",
"url": "string"
}
]
}
GET /api/file/storage
Gets storage files.
Request Body:
{
"prefix": "string",
"limit": "number",
"include_urls": true
}
Response:
{
"total": "number",
"files": [
{
"name": "string",
"size": "number",
"url": "string"
}
]
}
GET /api/file/storage/
Gets storage file.
Request Body:
{
"download": true,
"expires": "number"
}
Response:
{
"success": true,
"url": "string",
"expires": "string"
}
DELETE /api/file/storage/
Deletes storage file.
Response:
{
"success": true,
"message": "string"
}
POST /api/file/storage/batch-urls
Gets batch file URLs.
Request Body:
{
"object_names": ["string"],
"expires": "number"
}
Response:
{
"urls": [
{
"object_name": "string",
"success": true,
"url": "string"
}
]
}
POST /api/file/preprocess
Preprocesses files for agent.
Request Body:
{
"query": "string",
"files": ["file"]
}
Response:
- Streaming response with SSE (Server-Sent Events)
- Returns processed content in real-time
Voice App
Endpoints
WebSocket /api/voice/stt/ws
Real-time speech-to-text streaming.
Input:
- Audio stream
Output:
- Text stream
WebSocket /api/voice/tts/ws
Real-time text-to-speech streaming.
Input:
{
"text": "string"
}
Output:
- Audio stream
Dependencies
The apps have the following dependencies:
Base App:
- All other app routers
Agent App:
- Agent utilities
- Conversation management service
Config Sync App:
- python-dotenv
- Configuration utilities
Conversation Management App:
- Conversation database
- Conversation management utilities
Data Process App:
- Data process core
- Task status utilities
Elasticsearch App:
- Elasticsearch core
- Embedding model
- Data process service
ME Model Management App:
- Requests
- Model health service
Model Management App:
- Model management database
- Model health service
- Model name utilities
Proxy App:
- aiohttp
- Image filter utilities
File Management App:
- File management utilities
- Attachment database
- Data process service
Voice App:
- STT model
- TTS model
- WebSocket support