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