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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# SecondMe API Documentation
|
| 2 |
+
|
| 3 |
+
This document provides an overview of the SecondMe backend API, how to connect to it, and the various functionalities available.
|
| 4 |
+
|
| 5 |
+
## Connecting to the API
|
| 6 |
+
|
| 7 |
+
The API is served using Flask and deployed on Hugging Face Spaces. To connect to the API, you need to know the host and port on which the application is running. The base URL for the API is `https://harvesthealth-secondme-api.hf.space`.
|
| 8 |
+
|
| 9 |
+
## API Endpoints
|
| 10 |
+
|
| 11 |
+
The API is organized into several domains, each with its own set of endpoints.
|
| 12 |
+
|
| 13 |
+
### Health Check
|
| 14 |
+
|
| 15 |
+
- **GET /health**
|
| 16 |
+
- **Description:** Checks the health of the service.
|
| 17 |
+
- **Response:** A JSON object indicating the service is healthy.
|
| 18 |
+
|
| 19 |
+
### Documents
|
| 20 |
+
|
| 21 |
+
- **GET /api/documents/list**
|
| 22 |
+
- **Description:** Lists all documents.
|
| 23 |
+
- **POST /api/documents/scan**
|
| 24 |
+
- **Description:** Scans for documents in the configured directory.
|
| 25 |
+
- **POST /api/documents/analyze**
|
| 26 |
+
- **Description:** Analyzes all unanalyzed documents.
|
| 27 |
+
- **GET /api/documents/<document_id>/l0**
|
| 28 |
+
- **Description:** Gets L0 data for a document.
|
| 29 |
+
- **GET /api/documents/<document_id>/chunks**
|
| 30 |
+
- **Description:** Gets chunks for a document.
|
| 31 |
+
- **POST /api/documents/chunks/process**
|
| 32 |
+
- **Description:** Processes chunks for all documents.
|
| 33 |
+
- **POST /api/documents/<document_id>/chunk/embedding**
|
| 34 |
+
- **Description:** Processes embeddings for all chunks of a document.
|
| 35 |
+
- **GET /api/documents/<document_id>/chunk/embedding**
|
| 36 |
+
- **Description:** Gets embeddings for all chunks of a document.
|
| 37 |
+
- **POST /api/documents/<document_id>/embedding**
|
| 38 |
+
- **Description:** Processes document-level embedding.
|
| 39 |
+
- **GET /api/documents/<document_id>/embedding**
|
| 40 |
+
- **Description:** Gets document-level embedding.
|
| 41 |
+
- **GET /api/documents/verify-embeddings**
|
| 42 |
+
- **Description:** Verifies all document embeddings.
|
| 43 |
+
- **POST /api/documents/repair**
|
| 44 |
+
- **Description:** Repairs documents with missing analysis and embeddings.
|
| 45 |
+
|
| 46 |
+
### Kernel (L1)
|
| 47 |
+
|
| 48 |
+
- **POST /api/kernel/l1/global/generate**
|
| 49 |
+
- **Description:** Generates L1 data from L0 data.
|
| 50 |
+
- **GET /api/kernel/l1/global/versions**
|
| 51 |
+
- **Description:** Lists all L1 data versions.
|
| 52 |
+
- **GET /api/kernel/l1/global/version/<version>**
|
| 53 |
+
- **Description:** Gets a specific version of L1 data.
|
| 54 |
+
- **POST /api/kernel/l1/status_bio/generate**
|
| 55 |
+
- **Description:** Generates a status biography.
|
| 56 |
+
- **GET /api/kernel/l1/status_bio/get**
|
| 57 |
+
- **Description:** Gets the latest status biography.
|
| 58 |
+
- **GET /api/kernel/l1/latest/save_topics**
|
| 59 |
+
- **Description:** Saves the latest L1 topics to a file.
|
| 60 |
+
- **GET /api/kernel/l1/latest/save_notes**
|
| 61 |
+
- **Description:** Saves the latest notes to a file.
|
| 62 |
+
- **GET /api/kernel/l1/notes**
|
| 63 |
+
- **Description:** Gets notes from a file.
|
| 64 |
+
|
| 65 |
+
### Kernel (L2)
|
| 66 |
+
|
| 67 |
+
- **GET /api/kernel2/health**
|
| 68 |
+
- **Description:** Health check for the L2 kernel.
|
| 69 |
+
- **GET /api/kernel2/username**
|
| 70 |
+
- **Description:** Gets the current username.
|
| 71 |
+
- **GET /api/kernel2/docker/env**
|
| 72 |
+
- **Description:** Gets the docker environment.
|
| 73 |
+
- **POST /api/kernel2/llama/start**
|
| 74 |
+
- **Description:** Starts the llama-server.
|
| 75 |
+
- **POST /api/kernel2/llama/stop**
|
| 76 |
+
- **Description:** Stops the llama-server.
|
| 77 |
+
- **GET /api/kernel2/llama/status**
|
| 78 |
+
- **Description:** Gets the status of the llama-server.
|
| 79 |
+
- **POST /api/kernel2/chat**
|
| 80 |
+
- **Description:** Chat interface with streaming response.
|
| 81 |
+
- **GET /api/kernel2/cuda/available**
|
| 82 |
+
- **Description:** Checks if CUDA is available.
|
| 83 |
+
|
| 84 |
+
### Roles
|
| 85 |
+
|
| 86 |
+
- **POST /api/kernel2/roles**
|
| 87 |
+
- **Description:** Creates a new role.
|
| 88 |
+
- **GET /api/kernel2/roles**
|
| 89 |
+
- **Description:** Gets all roles.
|
| 90 |
+
- **GET /api/kernel2/roles/<uuid>**
|
| 91 |
+
- **Description:** Gets a specific role.
|
| 92 |
+
- **PUT /api/kernel2/roles/<uuid>**
|
| 93 |
+
- **Description:** Updates a role.
|
| 94 |
+
- **DELETE /api/kernel2/roles/<uuid>**
|
| 95 |
+
- **Description:** Deletes a role.
|
| 96 |
+
- **POST /api/kernel2/roles/share**
|
| 97 |
+
- **Description:** Shares a role.
|
| 98 |
+
|
| 99 |
+
### Talk
|
| 100 |
+
|
| 101 |
+
- **POST /api/talk**
|
| 102 |
+
- **Description:** Chat endpoint with streaming response.
|
| 103 |
+
- **POST /chat_json**
|
| 104 |
+
- **Description:** Chat endpoint with JSON response.
|
| 105 |
+
- **POST /advanced_chat**
|
| 106 |
+
- **Description:** Advanced chat endpoint with multi-phase processing.
|
| 107 |
+
|
| 108 |
+
### Loads
|
| 109 |
+
|
| 110 |
+
- **POST /api/loads**
|
| 111 |
+
- **Description:** Creates a new load record.
|
| 112 |
+
- **GET /api/loads/current**
|
| 113 |
+
- **Description:** Gets the current load record.
|
| 114 |
+
- **PUT /api/loads/current**
|
| 115 |
+
- **Description:** Updates the current load record.
|
| 116 |
+
- **DELETE /api/loads/<load_name>**
|
| 117 |
+
- **Description:** Deletes a load record.
|
| 118 |
+
- **POST /api/loads/<load_name>/avatar**
|
| 119 |
+
- **Description:** Uploads an avatar for a load.
|
| 120 |
+
- **GET /api/loads/<load_name>/avatar**
|
| 121 |
+
- **Description:** Gets the avatar for a load.
|
| 122 |
+
|
| 123 |
+
### Memories
|
| 124 |
+
|
| 125 |
+
- **POST /api/memories/file**
|
| 126 |
+
- **Description:** Uploads a file.
|
| 127 |
+
- **DELETE /api/memories/file/<filename>**
|
| 128 |
+
- **Description:** Deletes a file.
|
| 129 |
+
|
| 130 |
+
### Space
|
| 131 |
+
|
| 132 |
+
- **POST /api/space/create**
|
| 133 |
+
- **Description:** Creates a new space.
|
| 134 |
+
- **GET /api/space/<space_id>**
|
| 135 |
+
- **Description:** Gets information about a space.
|
| 136 |
+
- **GET /api/space/all**
|
| 137 |
+
- **Description:** Gets all spaces.
|
| 138 |
+
- **DELETE /api/space/<space_id>**
|
| 139 |
+
- **Description:** Deletes a space.
|
| 140 |
+
- **POST /api/space/<space_id>/start**
|
| 141 |
+
- **Description:** Starts a discussion in a space.
|
| 142 |
+
- **GET /api/space/<space_id>/status**
|
| 143 |
+
- **Description:** Gets the status of a discussion in a space.
|
| 144 |
+
- **POST /api/space/<space_id>/share**
|
| 145 |
+
- **Description:** Shares a space.
|
| 146 |
+
|
| 147 |
+
### Upload
|
| 148 |
+
|
| 149 |
+
- **POST /api/upload/register**
|
| 150 |
+
- **Description:** Registers an upload instance.
|
| 151 |
+
- **POST /api/upload/connect**
|
| 152 |
+
- **Description:** Establishes a WebSocket connection for an upload instance.
|
| 153 |
+
- **GET /api/upload/status**
|
| 154 |
+
- **Description:** Gets the status of an upload instance.
|
| 155 |
+
- **DELETE /api/upload**
|
| 156 |
+
- **Description:** Unregisters an upload instance.
|
| 157 |
+
- **GET /api/upload**
|
| 158 |
+
- **Description:** Lists registered upload instances.
|
| 159 |
+
- **GET /api/upload/count**
|
| 160 |
+
- **Description:** Gets the number of registered upload instances.
|
| 161 |
+
- **PUT /api/upload**
|
| 162 |
+
- **Description:** Updates an upload instance.
|
| 163 |
+
|
| 164 |
+
### User LLM Config
|
| 165 |
+
|
| 166 |
+
- **GET /api/user-llm-configs**
|
| 167 |
+
- **Description:** Gets the LLM configuration.
|
| 168 |
+
- **PUT /api/user-llm-configs**
|
| 169 |
+
- **Description:** Updates the LLM configuration.
|
| 170 |
+
- **PUT /api/user-llm-configs/thinking**
|
| 171 |
+
- **Description:** Updates the thinking model configuration.
|
| 172 |
+
- **DELETE /api/user-llm-configs/key**
|
| 173 |
+
- **Description:** Deletes the API key from the LLM configuration.
|