ReMe/old/user_attribute.py
2024-06-20 22:18:57 +08:00

36 lines
1.5 KiB
Python
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

from typing import Dict, List
from pydantic import Field, BaseModel
class UserAttribute(BaseModel):
"""
用户画像的一条属性和数据库保持一致只会选择status为1的属性透传过来。
status会透传过来。
如果code为空则为新增否则是更新。
确保请求是10条返回是原始10条+加上新增的条数(如果可以新增)。只会对正确的请求操作数据库。
"""
code: str = Field("", description="唯一主键 code")
memory_id: str = Field("", description="memory id")
# 上游可能没有传这个参数可能隐藏在memory_id做区分
scene: str = Field("", description="source: TONGYI_MAIN_CHAT/TONGYI_CHAR_CHAT/BAILIAN/ASSISTANT")
# 从key改成memory_key
memory_key: str = Field("", description="memory key")
value: List[str] = Field([], description="value")
is_unique: int = Field(1, description="属性是否唯一if 1 value只有一个if 0, value 可以很多个")
is_mutable: int = Field(1, description="是否可变if 1value可变if 1不可变用户定义")
memory_type: str = Field("", description="profile, profile_customized")
description: str = Field("", description="memory id")
status: int = Field(1,
description="0为删除1为active状态算法不感知只为了保存用户删除的画像给算法传status为valid的用户画像")
ext_info: Dict[str, str] = Field({}, description="占位符字典")