updated documentation
This commit is contained in:
@@ -34,7 +34,7 @@ service to generate and store a vector in Qdrant.
|
||||
```
|
||||
src/
|
||||
├── db/
|
||||
│ ├── index.js # SQLite connection + initialization
|
||||
│ ├── index.js # SQLite connection + initialization + migrations
|
||||
│ └── schema.js # Table definitions, indexes, FTS5, triggers
|
||||
├── episodic/
|
||||
│ └── index.js # Session + episode CRUD, FTS search, embedding write path
|
||||
@@ -49,12 +49,29 @@ src/
|
||||
|
||||
Five core tables:
|
||||
|
||||
- **sessions** — top-level conversation containers, identified by an `external_id`
|
||||
- **sessions** — top-level conversation containers, identified by an `external_id` and optional `name`
|
||||
- **episodes** — individual exchanges (user message + AI response) tied to a session
|
||||
- **entities** — named things the system learns about (people, places, concepts)
|
||||
- **relationships** — directional labeled links between entities
|
||||
- **summaries** — condensed episode groups for efficient context retrieval
|
||||
|
||||
### Migrations
|
||||
|
||||
Schema changes that cannot be expressed in `CREATE TABLE IF NOT EXISTS` are applied
|
||||
as migrations in `db/index.js` at startup, wrapped in try/catch to safely ignore
|
||||
already-applied changes:
|
||||
|
||||
```js
|
||||
try {
|
||||
db.exec(`ALTER TABLE sessions ADD COLUMN name TEXT`);
|
||||
} catch {
|
||||
// Column already exists — safe to ignore on subsequent startups
|
||||
}
|
||||
```
|
||||
|
||||
Current migrations:
|
||||
- `ALTER TABLE sessions ADD COLUMN name TEXT` — adds display name to sessions
|
||||
|
||||
### FTS5 Full-Text Search
|
||||
|
||||
An `episodes_fts` virtual table enables keyword search across all episodes.
|
||||
@@ -144,9 +161,14 @@ Entities and relationships are stored in SQLite with two key constraints:
|
||||
| Method | Path | Description |
|
||||
|---|---|---|
|
||||
| POST | /sessions | Create a new session |
|
||||
| GET | /sessions | Get paginated list of all sessions |
|
||||
| GET | /sessions/:id | Get session by internal ID |
|
||||
| GET | /sessions/by-external/:externalId | Get session by external ID |
|
||||
| DELETE | /sessions/:id | Delete session (cascades to episodes + summaries) |
|
||||
| PATCH | /sessions/by-external/:externalId | Update session name |
|
||||
| DELETE | /sessions/by-external/:externalId | Delete session (cascades to episodes + summaries) |
|
||||
|
||||
> Route ordering matters in Express: `by-external/:externalId` must be defined before
|
||||
> `/:id` to prevent the literal string `by-external` being captured as an ID parameter.
|
||||
|
||||
**POST /sessions body:**
|
||||
```json
|
||||
@@ -156,6 +178,20 @@ Entities and relationships are stored in SQLite with two key constraints:
|
||||
}
|
||||
```
|
||||
|
||||
**PATCH /sessions/by-external/:externalId body:**
|
||||
```json
|
||||
{
|
||||
"name": "My Renamed Session"
|
||||
}
|
||||
```
|
||||
|
||||
Returns the updated session object. `name` is required and must be non-empty.
|
||||
|
||||
**DELETE /sessions/by-external/:externalId**
|
||||
|
||||
Returns `204 No Content` on success. Cascades to delete all associated episodes
|
||||
and summaries via SQLite `ON DELETE CASCADE`.
|
||||
|
||||
### Episodes
|
||||
|
||||
| Method | Path | Description |
|
||||
|
||||
Reference in New Issue
Block a user