feat(memory-api): implement memory read/write API service endpoints

- Add MemoryAPIService with read_memory and write_memory methods for managing user memories
- Create memory_api_schema.py with request/response schemas for read and write operations
- Implement write_memory_api_service endpoint for storing memory content with configurable storage backends
- Implement read_memory_api_service endpoint for querying memories with context-aware responses
- Add memory-specific error codes (MEMORY_WRITE_FAILED, MEMORY_READ_FAILED, MEMORY_CONFIG_NOT_FOUND) to error_codes.py
This commit is contained in:
Ke Sun
2025-12-26 11:43:51 +08:00
parent 2fa3bebe8f
commit bf1dfd97f0
4 changed files with 455 additions and 24 deletions

View File

@@ -78,6 +78,11 @@ class BizCode(IntEnum):
EMBEDDING_FAILED = 9002
SEARCH_FAILED = 9003
# Memory API95xx
MEMORY_WRITE_FAILED = 9501
MEMORY_READ_FAILED = 9502
MEMORY_CONFIG_NOT_FOUND = 9503
# 系统100xx
INTERNAL_ERROR = 10001
DB_ERROR = 10002
@@ -148,6 +153,12 @@ HTTP_MAPPING = {
BizCode.INDEX_BUILD_FAILED: 500,
BizCode.EMBEDDING_FAILED: 500,
BizCode.SEARCH_FAILED: 500,
# Memory API 错误码映射
BizCode.MEMORY_WRITE_FAILED: 500,
BizCode.MEMORY_READ_FAILED: 500,
BizCode.MEMORY_CONFIG_NOT_FOUND: 400,
BizCode.INTERNAL_ERROR: 500,
BizCode.DB_ERROR: 500,
BizCode.SERVICE_UNAVAILABLE: 503,