Refactor OpenViking Memory API and User Management
- Updated API authentication headers to use `X-API-Key` for both admin and user APIs. - Modified the account creation process to directly create user-specific accounts without requiring an admin workspace. - Enhanced user creation to return account-specific details, including `admin_user_id`. - Introduced new endpoints for retrieving task status and user profiles, allowing for more flexible user data management. - Updated search functionality to include additional parameters such as `level` and `score_threshold`. - Improved the handling of user keys in the storage layer to associate them with specific accounts. - Added tests to validate the new user account creation process and search functionalities, ensuring proper integration with the OpenViking service. - Included new documentation to reflect changes in API usage and expected request/response formats.
This commit is contained in:
@ -24,6 +24,10 @@ class SessionUserRequest(BaseModel):
|
||||
user_key: str = Field(min_length=1)
|
||||
|
||||
|
||||
class TaskStatusRequest(SessionUserRequest):
|
||||
session_id: str | None = Field(default=None, min_length=1)
|
||||
|
||||
|
||||
class SearchRequest(BaseModel):
|
||||
user_id: str = Field(min_length=1)
|
||||
user_key: str = Field(min_length=1)
|
||||
@ -31,6 +35,9 @@ class SearchRequest(BaseModel):
|
||||
query: str = Field(min_length=1)
|
||||
use_llm: bool = False
|
||||
limit: int = Field(default=10, ge=1, le=100)
|
||||
level: int = Field(default=2, ge=0)
|
||||
score_threshold: float = Field(default=0.8, ge=0, le=1)
|
||||
target_uri: str = Field(default="viking://user/memories", min_length=1)
|
||||
|
||||
|
||||
class SessionContextRequest(BaseModel):
|
||||
@ -40,6 +47,13 @@ class SessionContextRequest(BaseModel):
|
||||
limit: int = Field(default=10, ge=1, le=100)
|
||||
|
||||
|
||||
class ProfileRequest(BaseModel):
|
||||
user_key: str = Field(min_length=1)
|
||||
query: str = Field(default="用户画像", min_length=1)
|
||||
limit: int = Field(default=10, ge=1, le=100)
|
||||
level: int = Field(default=2, ge=0)
|
||||
|
||||
|
||||
class BackendStatus(BaseModel):
|
||||
status: OperationStatus
|
||||
result: Any = None
|
||||
@ -88,4 +102,5 @@ class SessionContextResponse(BaseModel):
|
||||
class ProfileResponse(BaseModel):
|
||||
status: OperationStatus
|
||||
profile: Any = None
|
||||
items: list[dict[str, Any]] = Field(default_factory=list)
|
||||
backends: dict[str, BackendStatus]
|
||||
|
||||
Reference in New Issue
Block a user