Honcho v0.0.12 Release (#74)
* fix(API): Basic API Versioning * fix (docs) update docs with the latest API Specs * chore: CHANGELOG * chore: linting
This commit is contained in:
parent
038a172737
commit
1af4539d03
168
CHANGELOG.md
168
CHANGELOG.md
|
|
@ -1,175 +1,195 @@
|
|||
# Change Log
|
||||
|
||||
All notable changes to this project will be documented in this file.
|
||||
|
||||
|
||||
The format is based on [Keep a Changelog](http://keepachangelog.com/)
|
||||
and this project adheres to [Semantic Versioning](http://semver.org/).
|
||||
|
||||
## [0.0.12] — 2024-10-21
|
||||
|
||||
### Added
|
||||
|
||||
- GitHub Actions Testing
|
||||
- Ability to disable derivations on a session using the `deriver_disabled` flag
|
||||
in a session's metadata
|
||||
- `/v1/` prefix to all routes
|
||||
- Environment variable to control deriver workers
|
||||
|
||||
### Changed
|
||||
|
||||
- public_ids to use [NanoID](https://github.com/ai/nanoid) and internal ID to
|
||||
use `BigInt`
|
||||
- Dialectic Endpoint can take a list of queries
|
||||
- Using `uv` for project management
|
||||
- User Representations stored in a metamessage rather than using reserved
|
||||
collection
|
||||
- Base model for Dialectic API and Deriver is now Claude 3.5 Sonnet
|
||||
- Paginated GET requests now POST requests for better developer UX
|
||||
|
||||
### Removed
|
||||
|
||||
- Mirascope Dependency
|
||||
- Slowapi Dependency
|
||||
- Opentelemetry Dependencies and Setup
|
||||
|
||||
## [0.0.11] — 2024-08-01
|
||||
|
||||
### Added
|
||||
|
||||
* `session_id` column to `QueueItem` Table
|
||||
* `ActiveQueueSession` Table to track which sessions are being actively
|
||||
processed
|
||||
* Queue can process multiple sessions at once
|
||||
- `session_id` column to `QueueItem` Table
|
||||
- `ActiveQueueSession` Table to track, which sessions are being actively
|
||||
processed
|
||||
- Queue can process multiple sessions at once
|
||||
|
||||
### Changed
|
||||
|
||||
* Sessions do not require a `location_id`
|
||||
* Detailed printing using `rich`
|
||||
- Sessions do not require a `location_id`
|
||||
- Detailed printing using `rich`
|
||||
|
||||
## [0.0.10] — 2024-07-23
|
||||
|
||||
### Added
|
||||
|
||||
* Test cases for Storage API
|
||||
* Sentry tracing and profiling
|
||||
* Additional Error handling
|
||||
- Test cases for Storage API
|
||||
- Sentry tracing and profiling
|
||||
- Additional Error handling
|
||||
|
||||
### Changed
|
||||
|
||||
* Document API uses same embedding endpoint as deriver
|
||||
* CRUD operations use one less database call by removing extra refresh
|
||||
* Use database for timestampz rather than API
|
||||
* Pydantic schemas to use modern syntax
|
||||
- Document API uses same embedding endpoint as deriver
|
||||
- CRUD operations use one less database call by removing extra refresh
|
||||
- Use database for timestampz rather than API
|
||||
- Pydantic schemas to use modern syntax
|
||||
|
||||
### Fixed
|
||||
|
||||
* Deriver queue resolution
|
||||
|
||||
- Deriver queue resolution
|
||||
|
||||
## [0.0.9] — 2024-05-16
|
||||
|
||||
### Added
|
||||
|
||||
* Deriver to docker compose
|
||||
* Postgres based Queue for background jobs
|
||||
- Deriver to docker compose
|
||||
- Postgres based Queue for background jobs
|
||||
|
||||
### Changed
|
||||
|
||||
* Deriver to use a queue instead of supabase realtime
|
||||
* Using mirascope instead of langchain
|
||||
- Deriver to use a queue instead of supabase realtime
|
||||
- Using mirascope instead of langchain
|
||||
|
||||
### Removed
|
||||
|
||||
* Legacy SDKs in preference for stainless SDKs
|
||||
|
||||
- Legacy SDKs in preference for stainless SDKs
|
||||
|
||||
## [0.0.8] — 2024-05-09
|
||||
|
||||
### Added
|
||||
|
||||
* Documentation to OpenAPI
|
||||
* Bearer token auth to OpenAPI routes
|
||||
* Get by ID routes for users and collections
|
||||
* [NodeJS](https://github.com/plastic-labs/honcho-node) SDK support
|
||||
- Documentation to OpenAPI
|
||||
- Bearer token auth to OpenAPI routes
|
||||
- Get by ID routes for users and collections
|
||||
- [NodeJS](https://github.com/plastic-labs/honcho-node) SDK support
|
||||
|
||||
### Changed
|
||||
|
||||
* Authentication Middleware now implemented using built-in FastAPI Security
|
||||
module
|
||||
* Get by name routes for users and collections now include "name" in slug
|
||||
* Python SDK moved to separate [respository](https://github.com/plastic-labs/honcho-python)
|
||||
- Authentication Middleware now implemented using built-in FastAPI Security
|
||||
module
|
||||
- Get by name routes for users and collections now include "name" in slug
|
||||
- Python SDK moved to separate [respository](https://github.com/plastic-labs/honcho-python)
|
||||
|
||||
### Fixed
|
||||
|
||||
* Error reporting for methods with integrity errors due to unique key
|
||||
constraints
|
||||
- Error reporting for methods with integrity errors due to unique key
|
||||
constraints
|
||||
|
||||
## [0.0.7] — 2024-04-01
|
||||
|
||||
### Added
|
||||
|
||||
* Authentication Middleware Interface
|
||||
- Authentication Middleware Interface
|
||||
|
||||
## [0.0.6] — 2024-03-21
|
||||
|
||||
### Added
|
||||
|
||||
* Full docker-compose for API and Database
|
||||
- Full docker-compose for API and Database
|
||||
|
||||
### Fixed
|
||||
|
||||
* API Response schema removed unnecessary fields
|
||||
* OTEL logging to properly work with async database engine
|
||||
* `fly.toml` default settings for deriver set `auto_stop=false`
|
||||
- API Response schema removed unnecessary fields
|
||||
- OTEL logging to properly work with async database engine
|
||||
- `fly.toml` default settings for deriver set `auto_stop=false`
|
||||
|
||||
### Changed
|
||||
|
||||
* Refactored API server into multiple route files
|
||||
|
||||
- Refactored API server into multiple route files
|
||||
|
||||
## [0.0.5] — 2024-03-14
|
||||
|
||||
### Added
|
||||
|
||||
* Metadata to all data primitives (Users, Sessions, Messages, etc.)
|
||||
* Ability to filter paginated GET requests by JSON filter based on metadata
|
||||
* Optional Sentry error monitoring
|
||||
* Optional Opentelemetry logging
|
||||
* Dialectic API to interact with honcho agent and get insights about users
|
||||
* Automatic Fact Derivation Script for automatically generating simple memory
|
||||
- Metadata to all data primitives (Users, Sessions, Messages, etc.)
|
||||
- Ability to filter paginated GET requests by JSON filter based on metadata
|
||||
- Optional Sentry error monitoring
|
||||
- Optional Opentelemetry logging
|
||||
- Dialectic API to interact with honcho agent and get insights about users
|
||||
- Automatic Fact Derivation Script for automatically generating simple memory
|
||||
|
||||
### Changed
|
||||
|
||||
* API Server now uses async methods to make use of benefits of FastAPI
|
||||
|
||||
- API Server now uses async methods to make use of benefits of FastAPI
|
||||
|
||||
## [0.0.4] — 2024-02-22
|
||||
|
||||
### Added
|
||||
|
||||
* apps table with a relationship to the users table
|
||||
* users table with a relationship to the collections and sessions tables
|
||||
* Reverse Pagination support to get recent messages, sessions, etc. more easily
|
||||
* Linting Rules
|
||||
- apps table with a relationship to the users table
|
||||
- users table with a relationship to the collections and sessions tables
|
||||
- Reverse Pagination support to get recent messages, sessions, etc. more easily
|
||||
- Linting Rules
|
||||
|
||||
### Changed
|
||||
|
||||
* Get sessions method returns all sessions including inactive
|
||||
* using timestampz instead of timestamp
|
||||
|
||||
- Get sessions method returns all sessions including inactive
|
||||
- using timestampz instead of timestamp
|
||||
|
||||
## [0.0.3] — 2024-02-15
|
||||
|
||||
### Added
|
||||
|
||||
* Collections table to reference a collection of embedding documents
|
||||
* Documents table to hold vector embeddings for RAG workflows
|
||||
* Local scripts for running a postgres database with pgvector installed
|
||||
* OpenAI Dependency for embedding models
|
||||
* PGvector dependency for vector db support
|
||||
- Collections table to reference a collection of embedding documents
|
||||
- Documents table to hold vector embeddings for RAG workflows
|
||||
- Local scripts for running a postgres database with pgvector installed
|
||||
- OpenAI Dependency for embedding models
|
||||
- PGvector dependency for vector db support
|
||||
|
||||
### Changed
|
||||
|
||||
* session_data is now metadata
|
||||
* session_data is a JSON field used python `dict` for compatability
|
||||
|
||||
- session_data is now metadata
|
||||
- session_data is a JSON field used python `dict` for compatability
|
||||
|
||||
## [0.0.2] — 2024-02-01
|
||||
|
||||
### Added
|
||||
|
||||
* Pagination for requests via `fastapi_pagination`
|
||||
* Metamessages
|
||||
* `get_message` routes
|
||||
* `created_at` field added to each Table
|
||||
* Message size limits
|
||||
- Pagination for requests via `fastapi_pagination`
|
||||
- Metamessages
|
||||
- `get_message` routes
|
||||
- `created_at` field added to each Table
|
||||
- Message size limits
|
||||
|
||||
### Changed
|
||||
|
||||
* IDs are now UUIDs
|
||||
* default rate limit now 100 requests per minute
|
||||
- IDs are now UUIDs
|
||||
- default rate limit now 100 requests per minute
|
||||
|
||||
### Removed
|
||||
|
||||
* Removed messages from session response model
|
||||
|
||||
- Removed messages from session response model
|
||||
|
||||
## [0.0.1] — 2024-02-01
|
||||
|
||||
### Added
|
||||
|
||||
* Rate limiting of 10 requests for minute
|
||||
* Application level scoping
|
||||
|
||||
- Rate limiting of 10 requests for minute
|
||||
- Application level scoping
|
||||
|
|
|
|||
|
|
@ -1,3 +1,3 @@
|
|||
---
|
||||
openapi: post /apps
|
||||
openapi: post /v1/apps
|
||||
---
|
||||
|
|
@ -1,3 +1,3 @@
|
|||
---
|
||||
openapi: get /apps/name/{name}
|
||||
openapi: get /v1/apps/name/{name}
|
||||
---
|
||||
|
|
@ -1,3 +1,3 @@
|
|||
---
|
||||
openapi: get /apps/{app_id}
|
||||
openapi: get /v1/apps/{app_id}
|
||||
---
|
||||
|
|
@ -1,3 +1,3 @@
|
|||
---
|
||||
openapi: get /apps/get_or_create/{name}
|
||||
openapi: get /v1/apps/get_or_create/{name}
|
||||
---
|
||||
|
|
@ -1,3 +1,3 @@
|
|||
---
|
||||
openapi: put /apps/{app_id}
|
||||
openapi: put /v1/apps/{app_id}
|
||||
---
|
||||
|
|
@ -1,3 +1,3 @@
|
|||
---
|
||||
openapi: post /apps/{app_id}/users/{user_id}/collections
|
||||
openapi: post /v1/apps/{app_id}/users/{user_id}/collections
|
||||
---
|
||||
|
|
@ -1,3 +1,3 @@
|
|||
---
|
||||
openapi: delete /apps/{app_id}/users/{user_id}/collections/{collection_id}
|
||||
openapi: delete /v1/apps/{app_id}/users/{user_id}/collections/{collection_id}
|
||||
---
|
||||
|
|
@ -1,3 +1,3 @@
|
|||
---
|
||||
openapi: get /apps/{app_id}/users/{user_id}/collections/{collection_id}
|
||||
openapi: get /v1/apps/{app_id}/users/{user_id}/collections/{collection_id}
|
||||
---
|
||||
|
|
@ -1,3 +1,3 @@
|
|||
---
|
||||
openapi: get /apps/{app_id}/users/{user_id}/collections/name/{name}
|
||||
---
|
||||
openapi: get /v1/apps/{app_id}/users/{user_id}/collections/name/{name}
|
||||
---
|
||||
|
|
@ -1,3 +1,3 @@
|
|||
---
|
||||
openapi: get /apps/{app_id}/users/{user_id}/collections
|
||||
openapi: post /v1/apps/{app_id}/users/{user_id}/collections/list
|
||||
---
|
||||
|
|
@ -1,3 +1,3 @@
|
|||
---
|
||||
openapi: put /apps/{app_id}/users/{user_id}/collections/{collection_id}
|
||||
openapi: put /v1/apps/{app_id}/users/{user_id}/collections/{collection_id}
|
||||
---
|
||||
|
|
@ -1,3 +1,3 @@
|
|||
---
|
||||
openapi: post /apps/{app_id}/users/{user_id}/collections/{collection_id}/documents
|
||||
openapi: post /v1/apps/{app_id}/users/{user_id}/collections/{collection_id}/documents
|
||||
---
|
||||
|
|
@ -1,3 +1,3 @@
|
|||
---
|
||||
openapi: delete /apps/{app_id}/users/{user_id}/collections/{collection_id}/documents/{document_id}
|
||||
openapi: delete /v1/apps/{app_id}/users/{user_id}/collections/{collection_id}/documents/{document_id}
|
||||
---
|
||||
|
|
@ -1,3 +1,3 @@
|
|||
---
|
||||
openapi: get /apps/{app_id}/users/{user_id}/collections/{collection_id}/documents/{document_id}
|
||||
openapi: get /v1/apps/{app_id}/users/{user_id}/collections/{collection_id}/documents/{document_id}
|
||||
---
|
||||
|
|
@ -1,3 +1,3 @@
|
|||
---
|
||||
openapi: get /apps/{app_id}/users/{user_id}/collections/{collection_id}/documents
|
||||
openapi: post /v1/apps/{app_id}/users/{user_id}/collections/{collection_id}/documents/list
|
||||
---
|
||||
|
|
@ -1,3 +1,3 @@
|
|||
---
|
||||
openapi: get /apps/{app_id}/users/{user_id}/collections/{collection_id}/query
|
||||
openapi: get /v1/apps/{app_id}/users/{user_id}/collections/{collection_id}/documents/query
|
||||
---
|
||||
|
|
@ -1,3 +1,3 @@
|
|||
---
|
||||
openapi: put /apps/{app_id}/users/{user_id}/collections/{collection_id}/documents/{document_id}
|
||||
openapi: put /v1/apps/{app_id}/users/{user_id}/collections/{collection_id}/documents/{document_id}
|
||||
---
|
||||
|
|
@ -1,3 +1,3 @@
|
|||
---
|
||||
openapi: post /apps/{app_id}/users/{user_id}/sessions/{session_id}/messages
|
||||
openapi: post /v1/apps/{app_id}/users/{user_id}/sessions/{session_id}/messages
|
||||
---
|
||||
|
|
@ -1,3 +0,0 @@
|
|||
---
|
||||
openapi: post /apps/{app_id}/users/{user_id}/sessions/{session_id}/metamessages
|
||||
---
|
||||
|
|
@ -1,3 +1,3 @@
|
|||
---
|
||||
openapi: get /apps/{app_id}/users/{user_id}/sessions/{session_id}/messages/{message_id}
|
||||
openapi: get /v1/apps/{app_id}/users/{user_id}/sessions/{session_id}/messages/{message_id}
|
||||
---
|
||||
|
|
@ -1,3 +1,3 @@
|
|||
---
|
||||
openapi: get /apps/{app_id}/users/{user_id}/sessions/{session_id}/messages
|
||||
openapi: post /v1/apps/{app_id}/users/{user_id}/sessions/{session_id}/messages/list
|
||||
---
|
||||
|
|
@ -1,3 +0,0 @@
|
|||
---
|
||||
openapi: get /apps/{app_id}/users/{user_id}/sessions/{session_id}/metamessages/{metamessage_id}
|
||||
---
|
||||
|
|
@ -1,3 +0,0 @@
|
|||
---
|
||||
openapi: get /apps/{app_id}/users/{user_id}/sessions/{session_id}/metamessages
|
||||
---
|
||||
|
|
@ -1,3 +1,3 @@
|
|||
---
|
||||
openapi: put /apps/{app_id}/users/{user_id}/sessions/{session_id}/messages/{message_id}
|
||||
openapi: put /v1/apps/{app_id}/users/{user_id}/sessions/{session_id}/messages/{message_id}
|
||||
---
|
||||
|
|
@ -1,3 +0,0 @@
|
|||
---
|
||||
openapi: put /apps/{app_id}/users/{user_id}/sessions/{session_id}/metamessages/{metamessage_id}
|
||||
---
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
---
|
||||
openapi: post /v1/apps/{app_id}/users/{user_id}/sessions/{session_id}/metamessages
|
||||
---
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
---
|
||||
openapi: get /v1/apps/{app_id}/users/{user_id}/sessions/{session_id}/metamessages/{metamessage_id}
|
||||
---
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
---
|
||||
openapi: post /v1/apps/{app_id}/users/{user_id}/metamessages/list
|
||||
---
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
---
|
||||
openapi: post /v1/apps/{app_id}/users/{user_id}/sessions/{session_id}/metamessages/list
|
||||
---
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
---
|
||||
openapi: put /v1/apps/{app_id}/users/{user_id}/sessions/{session_id}/metamessages/{metamessage_id}
|
||||
---
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
---
|
||||
openapi: post /v1/apps/{app_id}/users/{user_id}/sessions/{session_id}/chat/stream
|
||||
---
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
---
|
||||
openapi: post /v1/apps/{app_id}/users/{user_id}/sessions/{session_id}/chat
|
||||
---
|
||||
|
|
@ -1,3 +1,3 @@
|
|||
---
|
||||
openapi: post /apps/{app_id}/users/{user_id}/sessions
|
||||
openapi: post /v1/apps/{app_id}/users/{user_id}/sessions
|
||||
---
|
||||
|
|
@ -1,3 +1,3 @@
|
|||
---
|
||||
openapi: delete /apps/{app_id}/users/{user_id}/sessions/{session_id}
|
||||
openapi: delete /v1/apps/{app_id}/users/{user_id}/sessions/{session_id}
|
||||
---
|
||||
|
|
@ -1,3 +0,0 @@
|
|||
---
|
||||
openapi: get /apps/{app_id}/users/{user_id}/sessions/{session_id}/chat/stream
|
||||
---
|
||||
|
|
@ -1,3 +0,0 @@
|
|||
---
|
||||
openapi: get /apps/{app_id}/users/{user_id}/sessions/{session_id}/chat
|
||||
---
|
||||
|
|
@ -1,3 +1,3 @@
|
|||
---
|
||||
openapi: get /apps/{app_id}/users/{user_id}/sessions/{session_id}
|
||||
openapi: get /v1/apps/{app_id}/users/{user_id}/sessions/{session_id}
|
||||
---
|
||||
|
|
@ -1,3 +1,3 @@
|
|||
---
|
||||
openapi: get /apps/{app_id}/users/{user_id}/sessions
|
||||
openapi: post /v1/apps/{app_id}/users/{user_id}/sessions/list
|
||||
---
|
||||
|
|
@ -1,3 +1,3 @@
|
|||
---
|
||||
openapi: put /apps/{app_id}/users/{user_id}/sessions/{session_id}
|
||||
openapi: put /v1/apps/{app_id}/users/{user_id}/sessions/{session_id}
|
||||
---
|
||||
|
|
@ -1,3 +1,3 @@
|
|||
---
|
||||
openapi: post /apps/{app_id}/users
|
||||
openapi: post /v1/apps/{app_id}/users
|
||||
---
|
||||
|
|
@ -1,3 +1,3 @@
|
|||
---
|
||||
openapi: get /apps/{app_id}/users/get_or_create/{name}
|
||||
openapi: get /v1/apps/{app_id}/users/get_or_create/{name}
|
||||
---
|
||||
|
|
@ -1,3 +1,3 @@
|
|||
---
|
||||
openapi: get /apps/{app_id}/users/name/{name}
|
||||
---
|
||||
openapi: get /v1/apps/{app_id}/users/name/{name}
|
||||
---
|
||||
|
|
@ -1,3 +1,3 @@
|
|||
---
|
||||
openapi: get /apps/{app_id}/users/{user_id}
|
||||
openapi: get /v1/apps/{app_id}/users/{user_id}
|
||||
---
|
||||
|
|
@ -1,3 +1,3 @@
|
|||
---
|
||||
openapi: get /apps/{app_id}/users
|
||||
openapi: post /v1/apps/{app_id}/users/list
|
||||
---
|
||||
|
|
@ -1,3 +1,3 @@
|
|||
---
|
||||
openapi: put /apps/{app_id}/users/{user_id}
|
||||
openapi: put /v1/apps/{app_id}/users/{user_id}
|
||||
---
|
||||
File diff suppressed because it is too large
Load Diff
|
|
@ -61,34 +61,23 @@
|
|||
},
|
||||
{
|
||||
"group": "Getting Started",
|
||||
"pages": [
|
||||
"guides/overview"
|
||||
]
|
||||
"pages": ["guides/overview"]
|
||||
},
|
||||
{
|
||||
"group": "Application Interfaces",
|
||||
"pages": [
|
||||
"guides/discord"
|
||||
]
|
||||
"pages": ["guides/discord"]
|
||||
},
|
||||
{
|
||||
"group": "Integrations",
|
||||
"pages": [
|
||||
"guides/langchain"
|
||||
]
|
||||
"pages": ["guides/langchain"]
|
||||
},
|
||||
{
|
||||
"group": "Personal Memory",
|
||||
"pages": [
|
||||
"guides/simple-memory",
|
||||
"guides/dialectic-endpoint"
|
||||
]
|
||||
"pages": ["guides/simple-memory", "guides/dialectic-endpoint"]
|
||||
},
|
||||
{
|
||||
"group": "API Documentation",
|
||||
"pages": [
|
||||
"api-reference/introduction"
|
||||
]
|
||||
"pages": ["api-reference/introduction"]
|
||||
},
|
||||
{
|
||||
"group": "apps",
|
||||
|
|
@ -119,8 +108,8 @@
|
|||
"api-reference/endpoint/sessions/get-session",
|
||||
"api-reference/endpoint/sessions/update-session",
|
||||
"api-reference/endpoint/sessions/delete-session",
|
||||
"api-reference/endpoint/sessions/get-chat",
|
||||
"api-reference/endpoint/sessions/get-chat-stream"
|
||||
"api-reference/endpoint/sessions/chat",
|
||||
"api-reference/endpoint/sessions/chat-stream"
|
||||
]
|
||||
},
|
||||
{
|
||||
|
|
@ -129,11 +118,17 @@
|
|||
"api-reference/endpoint/messages/get-messages",
|
||||
"api-reference/endpoint/messages/create-message-for-session",
|
||||
"api-reference/endpoint/messages/get-message",
|
||||
"api-reference/endpoint/messages/update-message",
|
||||
"api-reference/endpoint/messages/get-metamessages",
|
||||
"api-reference/endpoint/messages/create-metamessage",
|
||||
"api-reference/endpoint/messages/get-metamessage",
|
||||
"api-reference/endpoint/messages/update-metamessage"
|
||||
"api-reference/endpoint/messages/update-message"
|
||||
]
|
||||
},
|
||||
{
|
||||
"group": "metamessages",
|
||||
"pages": [
|
||||
"api-reference/endpoint/metamessages/create-metamessage",
|
||||
"api-reference/endpoint/metamessages/get-metamessages",
|
||||
"api-reference/endpoint/metamessages/get-metamessage",
|
||||
"api-reference/endpoint/metamessages/update-metamessage",
|
||||
"api-reference/endpoint/metamessages/get-metamessages-by-user"
|
||||
]
|
||||
},
|
||||
{
|
||||
|
|
@ -164,9 +159,7 @@
|
|||
"github": "https://github.com/plastic-labs",
|
||||
"linkedin": "https://www.linkedin.com/company/plasticlabs"
|
||||
},
|
||||
"openapi": [
|
||||
"/openapi.json"
|
||||
],
|
||||
"openapi": ["/openapi.json"],
|
||||
"analytics": {
|
||||
"posthog": {
|
||||
"apiKey": "phc_1yrzzcgywqXGcerkkI4g7C0YfyPMcAKNOOvGcjTCiUk"
|
||||
|
|
|
|||
2187
docs/openapi.json
2187
docs/openapi.json
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
|
@ -5,13 +5,13 @@
|
|||
"main": ".pnp.js",
|
||||
"scripts": {
|
||||
"dev": "mintlify dev",
|
||||
"openapi": "npx @mintlify/scraping@latest openapi-file openapi.json -o api-reference/endpoint",
|
||||
"openapi": "npx @mintlify/scraping openapi-file openapi.json -o api-reference/endpoint",
|
||||
"test": "echo \"Error: no test specified\" && exit 1"
|
||||
},
|
||||
"author": "",
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"@mintlify/scraping": "^3.0.92",
|
||||
"mintlify": "^4.0.132"
|
||||
"mintlify": "^4.0.245"
|
||||
}
|
||||
}
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
18
src/crud.py
18
src/crud.py
|
|
@ -225,18 +225,7 @@ async def create_session(
|
|||
h_metadata=session.metadata,
|
||||
)
|
||||
db.add(honcho_session)
|
||||
# print("====== Testing State of ORM Object ====")
|
||||
# print(honcho_session)
|
||||
# print("=======================================")
|
||||
#
|
||||
# await db.flush()
|
||||
#
|
||||
# print("====== Testing State of ORM Object ====")
|
||||
# print(honcho_session)
|
||||
# print("=======================================")
|
||||
|
||||
await db.commit()
|
||||
# await db.refresh(honcho_session)
|
||||
return honcho_session
|
||||
|
||||
|
||||
|
|
@ -319,9 +308,6 @@ async def get_messages(
|
|||
reverse: Optional[bool] = False,
|
||||
filter: Optional[dict] = None,
|
||||
) -> Select:
|
||||
print("============")
|
||||
print(filter)
|
||||
print("============")
|
||||
stmt = (
|
||||
select(models.Message)
|
||||
.join(models.Session, models.Session.public_id == models.Message.session_id)
|
||||
|
|
@ -340,10 +326,6 @@ async def get_messages(
|
|||
else:
|
||||
stmt = stmt.order_by(models.Message.created_at)
|
||||
|
||||
print("============")
|
||||
print(stmt)
|
||||
print("============")
|
||||
|
||||
return stmt
|
||||
|
||||
|
||||
|
|
|
|||
16
src/main.py
16
src/main.py
|
|
@ -74,11 +74,11 @@ router = APIRouter(prefix="/apps/{app_id}/users/{user_id}")
|
|||
|
||||
add_pagination(app)
|
||||
|
||||
app.include_router(apps.router)
|
||||
app.include_router(users.router)
|
||||
app.include_router(sessions.router)
|
||||
app.include_router(messages.router)
|
||||
app.include_router(metamessages.router)
|
||||
app.include_router(metamessages.router_user_level)
|
||||
app.include_router(collections.router)
|
||||
app.include_router(documents.router)
|
||||
app.include_router(apps.router, prefix="/v1")
|
||||
app.include_router(users.router, prefix="/v1")
|
||||
app.include_router(sessions.router, prefix="/v1")
|
||||
app.include_router(messages.router, prefix="/v1")
|
||||
app.include_router(metamessages.router, prefix="/v1")
|
||||
app.include_router(metamessages.router_user_level, prefix="/v1")
|
||||
app.include_router(collections.router, prefix="/v1")
|
||||
app.include_router(documents.router, prefix="/v1")
|
||||
|
|
|
|||
|
|
@ -1,14 +1,11 @@
|
|||
from nanoid import generate as generate_nanoid
|
||||
|
||||
import pytest
|
||||
from sqlalchemy.ext.asyncio import AsyncSession
|
||||
|
||||
from src import models # Import your SQLAlchemy models
|
||||
|
||||
|
||||
def test_create_app(client):
|
||||
name = str(generate_nanoid())
|
||||
response = client.post("/apps", json={"name": name, "metadata": {"key": "value"}})
|
||||
response = client.post(
|
||||
"/v1/apps", json={"name": name, "metadata": {"key": "value"}}
|
||||
)
|
||||
print(response)
|
||||
assert response.status_code == 200
|
||||
data = response.json()
|
||||
|
|
@ -22,9 +19,9 @@ def test_create_app(client):
|
|||
|
||||
def test_get_or_create_app(client):
|
||||
name = str(generate_nanoid())
|
||||
response = client.get(f"/apps/name/{name}")
|
||||
response = client.get(f"/v1/apps/name/{name}")
|
||||
assert response.status_code == 404
|
||||
response = client.get(f"/apps/get_or_create/{name}")
|
||||
response = client.get(f"/v1/apps/get_or_create/{name}")
|
||||
assert response.status_code == 200
|
||||
data = response.json()
|
||||
assert data["name"] == name
|
||||
|
|
@ -33,12 +30,14 @@ def test_get_or_create_app(client):
|
|||
|
||||
def test_get_or_create_existing_app(client):
|
||||
name = str(generate_nanoid())
|
||||
response = client.get(f"/apps/name/{name}")
|
||||
response = client.get(f"/v1/apps/name/{name}")
|
||||
assert response.status_code == 404
|
||||
response = client.post("/apps", json={"name": name, "metadata": {"key": "value"}})
|
||||
response = client.post(
|
||||
"/v1/apps", json={"name": name, "metadata": {"key": "value"}}
|
||||
)
|
||||
assert response.status_code == 200
|
||||
app1 = response.json()
|
||||
response = client.get(f"/apps/get_or_create/{name}")
|
||||
response = client.get(f"/v1/apps/get_or_create/{name}")
|
||||
assert response.status_code == 200
|
||||
app2 = response.json()
|
||||
assert app1["name"] == app2["name"]
|
||||
|
|
@ -48,7 +47,7 @@ def test_get_or_create_existing_app(client):
|
|||
|
||||
def test_get_app_by_id(client, sample_data):
|
||||
test_app, _ = sample_data
|
||||
response = client.get(f"/apps/{test_app.public_id}")
|
||||
response = client.get(f"/v1/apps/{test_app.public_id}")
|
||||
assert response.status_code == 200
|
||||
data = response.json()
|
||||
assert data["name"] == test_app.name
|
||||
|
|
@ -57,7 +56,7 @@ def test_get_app_by_id(client, sample_data):
|
|||
|
||||
def test_get_app_by_name(client, sample_data):
|
||||
test_app, _ = sample_data
|
||||
response = client.get(f"/apps/name/{test_app.name}")
|
||||
response = client.get(f"/v1/apps/name/{test_app.name}")
|
||||
assert response.status_code == 200
|
||||
data = response.json()
|
||||
assert data["name"] == test_app.name
|
||||
|
|
@ -68,7 +67,7 @@ def test_update_app(client, sample_data):
|
|||
test_app, _ = sample_data
|
||||
new_name = str(generate_nanoid())
|
||||
response = client.put(
|
||||
f"/apps/{test_app.public_id}",
|
||||
f"/v1/apps/{test_app.public_id}",
|
||||
json={"name": new_name, "metadata": {"new_key": "new_value"}},
|
||||
)
|
||||
assert response.status_code == 200
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ from nanoid import generate as generate_nanoid
|
|||
def test_create_collection(client, sample_data) -> None:
|
||||
test_app, test_user = sample_data
|
||||
response = client.post(
|
||||
f"/apps/{test_app.public_id}/users/{test_user.public_id}/collections",
|
||||
f"/v1/apps/{test_app.public_id}/users/{test_user.public_id}/collections",
|
||||
json={"name": "test_collection", "metadata": {}},
|
||||
)
|
||||
assert response.status_code == 200
|
||||
|
|
@ -18,14 +18,14 @@ def test_get_collection_by_id(client, sample_data) -> None:
|
|||
test_app, test_user = sample_data
|
||||
# Make the collection
|
||||
response = client.post(
|
||||
f"/apps/{test_app.public_id}/users/{test_user.public_id}/collections",
|
||||
f"/v1/apps/{test_app.public_id}/users/{test_user.public_id}/collections",
|
||||
json={"name": "test_collection", "metadata": {}},
|
||||
)
|
||||
assert response.status_code == 200
|
||||
data = response.json()
|
||||
# Get the collection
|
||||
response = client.get(
|
||||
f"/apps/{test_app.public_id}/users/{test_user.public_id}/collections/{data['id']}"
|
||||
f"/v1/apps/{test_app.public_id}/users/{test_user.public_id}/collections/{data['id']}"
|
||||
)
|
||||
assert response.status_code == 200
|
||||
data = response.json()
|
||||
|
|
@ -38,14 +38,14 @@ def test_get_collection_by_name(client, sample_data) -> None:
|
|||
test_app, test_user = sample_data
|
||||
# Make the collection
|
||||
response = client.post(
|
||||
f"/apps/{test_app.public_id}/users/{test_user.public_id}/collections",
|
||||
f"/v1/apps/{test_app.public_id}/users/{test_user.public_id}/collections",
|
||||
json={"name": "test_collection", "metadata": {}},
|
||||
)
|
||||
assert response.status_code == 200
|
||||
data = response.json()
|
||||
# Get the collection
|
||||
response = client.get(
|
||||
f"/apps/{test_app.public_id}/users/{test_user.public_id}/collections/name/test_collection"
|
||||
f"/v1/apps/{test_app.public_id}/users/{test_user.public_id}/collections/name/test_collection"
|
||||
)
|
||||
assert response.status_code == 200
|
||||
data = response.json()
|
||||
|
|
@ -58,21 +58,21 @@ def test_get_collections(client, sample_data) -> None:
|
|||
test_app, test_user = sample_data
|
||||
# Make Sample Collections
|
||||
client.post(
|
||||
f"/apps/{test_app.public_id}/users/{test_user.public_id}/collections",
|
||||
f"/v1/apps/{test_app.public_id}/users/{test_user.public_id}/collections",
|
||||
json={"name": str(generate_nanoid()), "metadata": {"test": "key"}},
|
||||
)
|
||||
client.post(
|
||||
f"/apps/{test_app.public_id}/users/{test_user.public_id}/collections",
|
||||
f"/v1/apps/{test_app.public_id}/users/{test_user.public_id}/collections",
|
||||
json={"name": str(generate_nanoid()), "metadata": {"test": "key"}},
|
||||
)
|
||||
client.post(
|
||||
f"/apps/{test_app.public_id}/users/{test_user.public_id}/collections",
|
||||
f"/v1/apps/{test_app.public_id}/users/{test_user.public_id}/collections",
|
||||
json={"name": str(generate_nanoid()), "metadata": {"test": "key2"}},
|
||||
)
|
||||
|
||||
# Get the Collections
|
||||
response = client.post(
|
||||
f"/apps/{test_app.public_id}/users/{test_user.public_id}/collections/list",
|
||||
f"/v1/apps/{test_app.public_id}/users/{test_user.public_id}/collections/list",
|
||||
json={},
|
||||
)
|
||||
assert response.status_code == 200
|
||||
|
|
@ -80,7 +80,7 @@ def test_get_collections(client, sample_data) -> None:
|
|||
assert len(data["items"]) == 3
|
||||
|
||||
response = client.post(
|
||||
f"/apps/{test_app.public_id}/users/{test_user.public_id}/collections/list",
|
||||
f"/v1/apps/{test_app.public_id}/users/{test_user.public_id}/collections/list",
|
||||
json={"filter": {"test": "key"}},
|
||||
)
|
||||
|
||||
|
|
@ -95,14 +95,14 @@ def test_update_collection(client, sample_data) -> None:
|
|||
test_app, test_user = sample_data
|
||||
# Make the collection
|
||||
response = client.post(
|
||||
f"/apps/{test_app.public_id}/users/{test_user.public_id}/collections",
|
||||
f"/v1/apps/{test_app.public_id}/users/{test_user.public_id}/collections",
|
||||
json={"name": "test_collection", "metadata": {}},
|
||||
)
|
||||
assert response.status_code == 200
|
||||
data = response.json()
|
||||
# Update the collection
|
||||
response = client.put(
|
||||
f"/apps/{test_app.public_id}/users/{test_user.public_id}/collections/{data['id']}",
|
||||
f"/v1/apps/{test_app.public_id}/users/{test_user.public_id}/collections/{data['id']}",
|
||||
json={"name": "test_collection_updated", "metadata": {"new_key": "new_value"}},
|
||||
)
|
||||
assert response.status_code == 200
|
||||
|
|
@ -116,17 +116,17 @@ def test_delete_collection(client, sample_data) -> None:
|
|||
test_app, test_user = sample_data
|
||||
# Make the collection
|
||||
response = client.post(
|
||||
f"/apps/{test_app.public_id}/users/{test_user.public_id}/collections",
|
||||
f"/v1/apps/{test_app.public_id}/users/{test_user.public_id}/collections",
|
||||
json={"name": "test_collection", "metadata": {}},
|
||||
)
|
||||
assert response.status_code == 200
|
||||
data = response.json()
|
||||
# Delete the collection
|
||||
response = client.delete(
|
||||
f"/apps/{test_app.public_id}/users/{test_user.public_id}/collections/{data['id']}"
|
||||
f"/v1/apps/{test_app.public_id}/users/{test_user.public_id}/collections/{data['id']}"
|
||||
)
|
||||
assert response.status_code == 200
|
||||
response = client.get(
|
||||
f"/apps/{test_app.public_id}/users/{test_user.public_id}/collections/{data['id']}"
|
||||
f"/v1/apps/{test_app.public_id}/users/{test_user.public_id}/collections/{data['id']}"
|
||||
)
|
||||
assert response.status_code == 404
|
||||
|
|
|
|||
|
|
@ -5,14 +5,14 @@ def test_create_document(client, sample_data):
|
|||
test_app, test_user = sample_data
|
||||
# Create a collection
|
||||
response = client.post(
|
||||
f"/apps/{test_app.public_id}/users/{test_user.public_id}/collections",
|
||||
f"/v1/apps/{test_app.public_id}/users/{test_user.public_id}/collections",
|
||||
json={"name": "test_collection", "metadata": {}},
|
||||
)
|
||||
assert response.status_code == 200
|
||||
data = response.json()
|
||||
# Create a document
|
||||
response = client.post(
|
||||
f"/apps/{test_app.public_id}/users/{test_user.public_id}/collections/{data['id']}/documents",
|
||||
f"/v1/apps/{test_app.public_id}/users/{test_user.public_id}/collections/{data['id']}/documents",
|
||||
json={"content": "test_text", "metadata": {}},
|
||||
)
|
||||
assert response.status_code == 200
|
||||
|
|
@ -26,21 +26,21 @@ def test_get_document(client, sample_data):
|
|||
test_app, test_user = sample_data
|
||||
# Create a collection
|
||||
response = client.post(
|
||||
f"/apps/{test_app.public_id}/users/{test_user.public_id}/collections",
|
||||
f"/v1/apps/{test_app.public_id}/users/{test_user.public_id}/collections",
|
||||
json={"name": "test_collection", "metadata": {}},
|
||||
)
|
||||
assert response.status_code == 200
|
||||
collection = response.json()
|
||||
# Create a document
|
||||
response = client.post(
|
||||
f"/apps/{test_app.public_id}/users/{test_user.public_id}/collections/{collection['id']}/documents",
|
||||
f"/v1/apps/{test_app.public_id}/users/{test_user.public_id}/collections/{collection['id']}/documents",
|
||||
json={"content": "test_text", "metadata": {}},
|
||||
)
|
||||
assert response.status_code == 200
|
||||
document = response.json()
|
||||
# Get the document
|
||||
response = client.get(
|
||||
f"/apps/{test_app.public_id}/users/{test_user.public_id}/collections/{collection['id']}/documents/{document['id']}"
|
||||
f"/v1/apps/{test_app.public_id}/users/{test_user.public_id}/collections/{collection['id']}/documents/{document['id']}"
|
||||
)
|
||||
assert response.status_code == 200
|
||||
data = response.json()
|
||||
|
|
@ -53,27 +53,27 @@ def test_get_documents(client, sample_data):
|
|||
test_app, test_user = sample_data
|
||||
# Create a collection
|
||||
response = client.post(
|
||||
f"/apps/{test_app.public_id}/users/{test_user.public_id}/collections",
|
||||
f"/v1/apps/{test_app.public_id}/users/{test_user.public_id}/collections",
|
||||
json={"name": str(generate_nanoid()), "metadata": {}},
|
||||
)
|
||||
assert response.status_code == 200
|
||||
collection = response.json()
|
||||
# Create a document
|
||||
response = client.post(
|
||||
f"/apps/{test_app.public_id}/users/{test_user.public_id}/collections/{collection['id']}/documents",
|
||||
f"/v1/apps/{test_app.public_id}/users/{test_user.public_id}/collections/{collection['id']}/documents",
|
||||
json={"content": "test_text", "metadata": {"test": "key"}},
|
||||
)
|
||||
response = client.post(
|
||||
f"/apps/{test_app.public_id}/users/{test_user.public_id}/collections/{collection['id']}/documents",
|
||||
f"/v1/apps/{test_app.public_id}/users/{test_user.public_id}/collections/{collection['id']}/documents",
|
||||
json={"content": "test_text", "metadata": {"test": "key"}},
|
||||
)
|
||||
response = client.post(
|
||||
f"/apps/{test_app.public_id}/users/{test_user.public_id}/collections/{collection['id']}/documents",
|
||||
f"/v1/apps/{test_app.public_id}/users/{test_user.public_id}/collections/{collection['id']}/documents",
|
||||
json={"content": "test_text", "metadata": {"test": "key2"}},
|
||||
)
|
||||
# Get the documents
|
||||
response = client.post(
|
||||
f"/apps/{test_app.public_id}/users/{test_user.public_id}/collections/{collection['id']}/documents/list",
|
||||
f"/v1/apps/{test_app.public_id}/users/{test_user.public_id}/collections/{collection['id']}/documents/list",
|
||||
json={},
|
||||
)
|
||||
assert response.status_code == 200
|
||||
|
|
@ -81,7 +81,7 @@ def test_get_documents(client, sample_data):
|
|||
assert len(data["items"]) == 3
|
||||
|
||||
response = client.post(
|
||||
f"/apps/{test_app.public_id}/users/{test_user.public_id}/collections/{collection['id']}/documents/list",
|
||||
f"/v1/apps/{test_app.public_id}/users/{test_user.public_id}/collections/{collection['id']}/documents/list",
|
||||
json={"filter": {"test": "key"}},
|
||||
)
|
||||
assert response.status_code == 200
|
||||
|
|
@ -95,21 +95,21 @@ def test_update_document(client, sample_data):
|
|||
test_app, test_user = sample_data
|
||||
# Create a collection
|
||||
response = client.post(
|
||||
f"/apps/{test_app.public_id}/users/{test_user.public_id}/collections",
|
||||
f"/v1/apps/{test_app.public_id}/users/{test_user.public_id}/collections",
|
||||
json={"name": "test_collection", "metadata": {}},
|
||||
)
|
||||
assert response.status_code == 200
|
||||
data = response.json()
|
||||
# Create a document
|
||||
response = client.post(
|
||||
f"/apps/{test_app.public_id}/users/{test_user.public_id}/collections/{data['id']}/documents",
|
||||
f"/v1/apps/{test_app.public_id}/users/{test_user.public_id}/collections/{data['id']}/documents",
|
||||
json={"content": "test_text", "metadata": {}},
|
||||
)
|
||||
assert response.status_code == 200
|
||||
data = response.json()
|
||||
# Update the document
|
||||
response = client.put(
|
||||
f"/apps/{test_app.public_id}/users/{test_user.public_id}/collections/{data['id']}/documents/{data['id']}",
|
||||
f"/v1/apps/{test_app.public_id}/users/{test_user.public_id}/collections/{data['id']}/documents/{data['id']}",
|
||||
json={"content": "test_text_updated", "metadata": {"new_key": "new_value"}},
|
||||
)
|
||||
|
||||
|
|
@ -118,24 +118,24 @@ def test_delete_document(client, sample_data):
|
|||
test_app, test_user = sample_data
|
||||
# Create a collection
|
||||
response = client.post(
|
||||
f"/apps/{test_app.public_id}/users/{test_user.public_id}/collections",
|
||||
f"/v1/apps/{test_app.public_id}/users/{test_user.public_id}/collections",
|
||||
json={"name": "test_collection", "metadata": {}},
|
||||
)
|
||||
assert response.status_code == 200
|
||||
collection = response.json()
|
||||
# Create a document
|
||||
response = client.post(
|
||||
f"/apps/{test_app.public_id}/users/{test_user.public_id}/collections/{collection['id']}/documents",
|
||||
f"/v1/apps/{test_app.public_id}/users/{test_user.public_id}/collections/{collection['id']}/documents",
|
||||
json={"content": "test_text", "metadata": {}},
|
||||
)
|
||||
assert response.status_code == 200
|
||||
document = response.json()
|
||||
# Delete the document
|
||||
response = client.delete(
|
||||
f"/apps/{test_app.public_id}/users/{test_user.public_id}/collections/{collection['id']}/documents/{document['id']}"
|
||||
f"/v1/apps/{test_app.public_id}/users/{test_user.public_id}/collections/{collection['id']}/documents/{document['id']}"
|
||||
)
|
||||
assert response.status_code == 200
|
||||
response = client.get(
|
||||
f"/apps/{test_app.public_id}/users/{test_user.public_id}/collections/{collection['id']}/documents/{document['id']}"
|
||||
f"/v1/apps/{test_app.public_id}/users/{test_user.public_id}/collections/{collection['id']}/documents/{document['id']}"
|
||||
)
|
||||
assert response.status_code == 404
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ async def test_create_message(client, db_session, sample_data):
|
|||
await db_session.commit()
|
||||
|
||||
response = client.post(
|
||||
f"/apps/{test_app.public_id}/users/{test_user.public_id}/sessions/{test_session.public_id}/messages",
|
||||
f"/v1/apps/{test_app.public_id}/users/{test_user.public_id}/sessions/{test_session.public_id}/messages",
|
||||
json={
|
||||
"content": "Test message",
|
||||
"is_user": True,
|
||||
|
|
@ -41,7 +41,7 @@ async def test_get_messages(client, db_session, sample_data):
|
|||
await db_session.commit()
|
||||
|
||||
response = client.post(
|
||||
f"/apps/{test_app.public_id}/users/{test_user.public_id}/sessions/{test_session.public_id}/messages/list",
|
||||
f"/v1/apps/{test_app.public_id}/users/{test_user.public_id}/sessions/{test_session.public_id}/messages/list",
|
||||
json={},
|
||||
)
|
||||
assert response.status_code == 200
|
||||
|
|
@ -77,7 +77,7 @@ async def test_get_filtered_messages(client, db_session, sample_data):
|
|||
await db_session.commit()
|
||||
|
||||
response = client.post(
|
||||
f"/apps/{test_app.public_id}/users/{test_user.public_id}/sessions/{test_session.public_id}/messages/list",
|
||||
f"/v1/apps/{test_app.public_id}/users/{test_user.public_id}/sessions/{test_session.public_id}/messages/list",
|
||||
json={"filter": {"key": "value2"}},
|
||||
)
|
||||
assert response.status_code == 200
|
||||
|
|
@ -104,7 +104,7 @@ async def test_update_message(client, db_session, sample_data):
|
|||
await db_session.commit()
|
||||
|
||||
response = client.put(
|
||||
f"/apps/{test_app.public_id}/users/{test_user.public_id}/sessions/{test_session.public_id}/messages/{test_message.public_id}",
|
||||
f"/v1/apps/{test_app.public_id}/users/{test_user.public_id}/sessions/{test_session.public_id}/messages/{test_message.public_id}",
|
||||
json={"metadata": {"new_key": "new_value"}},
|
||||
)
|
||||
assert response.status_code == 200
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ async def test_create_metamessage(client, db_session, sample_data):
|
|||
await db_session.commit()
|
||||
|
||||
response = client.post(
|
||||
f"/apps/{test_app.public_id}/users/{test_user.public_id}/sessions/{test_session.public_id}/metamessages",
|
||||
f"/v1/apps/{test_app.public_id}/users/{test_user.public_id}/sessions/{test_session.public_id}/metamessages",
|
||||
json={
|
||||
"message_id": str(test_message.public_id),
|
||||
"content": "Test Metamessage",
|
||||
|
|
@ -55,7 +55,7 @@ async def test_get_metamessage(client, db_session, sample_data):
|
|||
await db_session.commit()
|
||||
|
||||
response = client.get(
|
||||
f"/apps/{test_app.public_id}/users/{test_user.public_id}/sessions/{test_session.public_id}/metamessages/{test_metamessage.public_id}/?message_id={test_message.public_id}"
|
||||
f"/v1/apps/{test_app.public_id}/users/{test_user.public_id}/sessions/{test_session.public_id}/metamessages/{test_metamessage.public_id}/?message_id={test_message.public_id}"
|
||||
)
|
||||
assert response.status_code == 200
|
||||
data = response.json()
|
||||
|
|
@ -108,7 +108,7 @@ async def test_get_metamessages(client, db_session, sample_data):
|
|||
await db_session.commit()
|
||||
|
||||
response = client.post(
|
||||
f"/apps/{test_app.public_id}/users/{test_user.public_id}/sessions/{test_session.public_id}/metamessages/list",
|
||||
f"/v1/apps/{test_app.public_id}/users/{test_user.public_id}/sessions/{test_session.public_id}/metamessages/list",
|
||||
json={"metamessage_type": "test_type"},
|
||||
)
|
||||
|
||||
|
|
@ -181,7 +181,7 @@ async def test_get_metamessage_by_user(client, db_session, sample_data):
|
|||
await db_session.commit()
|
||||
|
||||
response = client.post(
|
||||
f"/apps/{test_app.public_id}/users/{test_user.public_id}/metamessages/list",
|
||||
f"/v1/apps/{test_app.public_id}/users/{test_user.public_id}/metamessages/list",
|
||||
json={"metamessage_type": "test_type"},
|
||||
)
|
||||
assert response.status_code == 200
|
||||
|
|
@ -218,7 +218,7 @@ async def test_update_metamessage(client, db_session, sample_data):
|
|||
await db_session.commit()
|
||||
|
||||
response = client.put(
|
||||
f"/apps/{test_app.public_id}/users/{test_user.public_id}/sessions/{test_session.public_id}/metamessages/{test_metamessage.public_id}",
|
||||
f"/v1/apps/{test_app.public_id}/users/{test_user.public_id}/sessions/{test_session.public_id}/metamessages/{test_metamessage.public_id}",
|
||||
json={
|
||||
"message_id": str(test_message.public_id),
|
||||
"metadata": {"new_key": "new_value"},
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ from src import models # Import your SQLAlchemy models
|
|||
def test_create_session(client, sample_data):
|
||||
test_app, test_user = sample_data
|
||||
response = client.post(
|
||||
f"/apps/{test_app.public_id}/users/{test_user.public_id}/sessions",
|
||||
f"/v1/apps/{test_app.public_id}/users/{test_user.public_id}/sessions",
|
||||
json={},
|
||||
)
|
||||
assert response.status_code == 200
|
||||
|
|
@ -18,7 +18,7 @@ def test_create_session(client, sample_data):
|
|||
def test_create_session_with_metadata(client, sample_data):
|
||||
test_app, test_user = sample_data
|
||||
response = client.post(
|
||||
f"/apps/{test_app.public_id}/users/{test_user.public_id}/sessions",
|
||||
f"/v1/apps/{test_app.public_id}/users/{test_user.public_id}/sessions",
|
||||
json={
|
||||
"metadata": {"session_key": "session_value"},
|
||||
},
|
||||
|
|
@ -34,7 +34,7 @@ async def test_get_sessions(client, db_session, sample_data):
|
|||
test_app, test_user = sample_data
|
||||
# Create a test session
|
||||
response = client.post(
|
||||
f"/apps/{test_app.public_id}/users/{test_user.public_id}/sessions",
|
||||
f"/v1/apps/{test_app.public_id}/users/{test_user.public_id}/sessions",
|
||||
json={
|
||||
"metadata": {"test_key": "test_value"},
|
||||
},
|
||||
|
|
@ -45,7 +45,7 @@ async def test_get_sessions(client, db_session, sample_data):
|
|||
assert "id" in data
|
||||
|
||||
response = client.post(
|
||||
f"/apps/{test_app.public_id}/users/{test_user.public_id}/sessions/list",
|
||||
f"/v1/apps/{test_app.public_id}/users/{test_user.public_id}/sessions/list",
|
||||
json={"filter": {"test_key": "test_value"}},
|
||||
)
|
||||
assert response.status_code == 200
|
||||
|
|
@ -64,7 +64,7 @@ async def test_empty_update_session(client, db_session, sample_data):
|
|||
await db_session.commit()
|
||||
|
||||
response = client.put(
|
||||
f"/apps/{test_app.public_id}/users/{test_user.public_id}/sessions/{test_session.public_id}",
|
||||
f"/v1/apps/{test_app.public_id}/users/{test_user.public_id}/sessions/{test_session.public_id}",
|
||||
json={},
|
||||
)
|
||||
assert response.status_code == 400
|
||||
|
|
@ -81,7 +81,7 @@ async def test_update_delete_metadata(client, db_session, sample_data):
|
|||
await db_session.commit()
|
||||
|
||||
response = client.put(
|
||||
f"/apps/{test_app.public_id}/users/{test_user.public_id}/sessions/{test_session.public_id}",
|
||||
f"/v1/apps/{test_app.public_id}/users/{test_user.public_id}/sessions/{test_session.public_id}",
|
||||
json={"metadata": {}},
|
||||
)
|
||||
assert response.status_code == 200
|
||||
|
|
@ -98,7 +98,7 @@ async def test_update_session(client, db_session, sample_data):
|
|||
await db_session.commit()
|
||||
|
||||
response = client.put(
|
||||
f"/apps/{test_app.public_id}/users/{test_user.public_id}/sessions/{test_session.public_id}",
|
||||
f"/v1/apps/{test_app.public_id}/users/{test_user.public_id}/sessions/{test_session.public_id}",
|
||||
json={"metadata": {"new_key": "new_value"}},
|
||||
)
|
||||
assert response.status_code == 200
|
||||
|
|
@ -114,11 +114,11 @@ async def test_delete_session(client, db_session, sample_data):
|
|||
db_session.add(test_session)
|
||||
await db_session.commit()
|
||||
response = client.delete(
|
||||
f"/apps/{test_app.public_id}/users/{test_user.public_id}/sessions/{test_session.public_id}"
|
||||
f"/v1/apps/{test_app.public_id}/users/{test_user.public_id}/sessions/{test_session.public_id}"
|
||||
)
|
||||
assert response.status_code == 200
|
||||
response = client.get(
|
||||
f"/apps/{test_app.public_id}/users/{test_user.public_id}/sessions/{test_session.public_id}"
|
||||
f"/v1/apps/{test_app.public_id}/users/{test_user.public_id}/sessions/{test_session.public_id}"
|
||||
)
|
||||
data = response.json()
|
||||
assert data["is_active"] is False
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ def test_create_user(client, sample_data):
|
|||
test_app, _ = sample_data
|
||||
name = str(generate_nanoid())
|
||||
response = client.post(
|
||||
f"/apps/{test_app.public_id}/users",
|
||||
f"/v1/apps/{test_app.public_id}/users",
|
||||
json={"name": name, "metadata": {"user_key": "user_value"}},
|
||||
)
|
||||
assert response.status_code == 200
|
||||
|
|
@ -17,7 +17,7 @@ def test_create_user(client, sample_data):
|
|||
|
||||
def test_get_user_by_id(client, sample_data):
|
||||
test_app, test_user = sample_data
|
||||
response = client.get(f"/apps/{test_app.public_id}/users/{test_user.public_id}")
|
||||
response = client.get(f"/v1/apps/{test_app.public_id}/users/{test_user.public_id}")
|
||||
assert response.status_code == 200
|
||||
data = response.json()
|
||||
assert data["name"] == test_user.name
|
||||
|
|
@ -26,7 +26,7 @@ def test_get_user_by_id(client, sample_data):
|
|||
|
||||
def test_get_user_by_name(client, sample_data):
|
||||
test_app, test_user = sample_data
|
||||
response = client.get(f"/apps/{test_app.public_id}/users/name/{test_user.name}")
|
||||
response = client.get(f"/v1/apps/{test_app.public_id}/users/name/{test_user.name}")
|
||||
assert response.status_code == 200
|
||||
data = response.json()
|
||||
assert data["name"] == test_user.name
|
||||
|
|
@ -36,9 +36,9 @@ def test_get_user_by_name(client, sample_data):
|
|||
def test_get_or_create_user(client, sample_data):
|
||||
test_app, _ = sample_data
|
||||
name = str(generate_nanoid())
|
||||
response = client.get(f"/apps/{test_app.public_id}/users/name/{name}")
|
||||
response = client.get(f"/v1/apps/{test_app.public_id}/users/name/{name}")
|
||||
assert response.status_code == 404
|
||||
response = client.get(f"/apps/{test_app.public_id}/users/get_or_create/{name}")
|
||||
response = client.get(f"/v1/apps/{test_app.public_id}/users/get_or_create/{name}")
|
||||
assert response.status_code == 200
|
||||
data = response.json()
|
||||
assert data["name"] == name
|
||||
|
|
@ -48,19 +48,19 @@ def test_get_or_create_user(client, sample_data):
|
|||
def test_get_users(client, sample_data):
|
||||
test_app, _ = sample_data
|
||||
response = client.post(
|
||||
f"/apps/{test_app.public_id}/users",
|
||||
f"/v1/apps/{test_app.public_id}/users",
|
||||
json={"name": str(generate_nanoid()), "metadata": {"user_key": "user_value"}},
|
||||
)
|
||||
response = client.post(
|
||||
f"/apps/{test_app.public_id}/users",
|
||||
f"/v1/apps/{test_app.public_id}/users",
|
||||
json={"name": str(generate_nanoid()), "metadata": {"user_key": "user_value"}},
|
||||
)
|
||||
response = client.post(
|
||||
f"/apps/{test_app.public_id}/users",
|
||||
f"/v1/apps/{test_app.public_id}/users",
|
||||
json={"name": str(generate_nanoid()), "metadata": {"user_key": "user_value2"}},
|
||||
)
|
||||
response = client.post(
|
||||
f"/apps/{test_app.public_id}/users/list",
|
||||
f"/v1/apps/{test_app.public_id}/users/list",
|
||||
json={"filter": {"user_key": "user_value"}},
|
||||
)
|
||||
assert response.status_code == 200
|
||||
|
|
@ -75,7 +75,7 @@ def test_update_user(client, sample_data):
|
|||
test_app, test_user = sample_data
|
||||
new_name = str(generate_nanoid())
|
||||
response = client.put(
|
||||
f"/apps/{test_app.public_id}/users/{test_user.public_id}",
|
||||
f"/v1/apps/{test_app.public_id}/users/{test_user.public_id}",
|
||||
json={"name": new_name, "metadata": {"new_key": "new_value"}},
|
||||
)
|
||||
assert response.status_code == 200
|
||||
|
|
|
|||
Loading…
Reference in New Issue