模块描述 用户可以输入身高,体重,年龄,选择性别和输入补充信息(包括职业:非必填,喜好:非必填,天气:非必填,温度:非必填,其他需求:显高显瘦?儒雅甜美?等),AI会提供量身定制的服装和配饰建议并且保存AI生成的推荐结果以及用户信息和用户输入的信息。
objectId:唯一标识符
createdAt:创建时间
height: Float (用户身高,以cm为单位)
weight: Float (用户体重,以kg为单位)
age: Integer (用户年龄)
gender: String (用户性别)
occupation: String (用户职业,非必填)
preferences: String (用户喜好,非必填)
weather: String (用户天气偏好,非必填)
temperature: String (用户温度偏好,非必填)
otherNeeds: String (其他需求,非必填)
objectId:唯一标识符
createdAt:创建时间
name: String (服装名称)
type: String (服装类型,)
size: String (服装尺码,例如 "S", "M", "L", "XL")
color: String (服装颜色)
style: String (服装风格)
recommendedFor: Pointer (指向推荐给的用户)
accessoryItems: Array (推荐的配饰)
@startuml
class UserProfile {
+objectId: String
+createdAt: Date
+height: Float
+weight: Float
+age: Int
+gender: String
+occupation: String
+preferences: String
+weather: String
+temperature: String
+otherNeeds: String
}
class ClothingItem {
+objectId: String
+createdAt: Date
+name: String
+type: String
+size: String
+color: String
+style: String
+recommendedFor: Pointer
}
class AccessoryItem {
+objectId: String
+createdAt: Date
+name: String
+type: String
+material: String
+style: String
+recommendedFor: Pointer
}
class Recommendation {
+objectId: String
+createdAt: Date
+userProfile: Pointer
+clothingItems: Array>
+accessoryItems: Array>
}
UserProfile "1" -- "0..*" ClothingItem : contains
UserProfile "1" -- "0..*" AccessoryItem : contains
UserProfile "1" -- "0..*" Recommendation : makes
@enduml
Language:plantuml
UserProfile 表存储用户的基本信息和个性化需求。 ClothingItem 和 AccessoryItem 表分别存储服装和配饰的信息,并通过 Pointer 关联到推荐的用户。 Recommendation 表用于存储为特定用户生成的推荐,包括推荐的服装和配饰。 这种设计符合第三范式(3NF),确保数据的规范化和减少冗余。
用户在APP内,通过文本生成穿搭推荐
生成结果:recommendList
循环数组,向Recommendation表逐个插入数据。
[
{
"objectId": "rec1",
"createdAt": "2024-12-09T22:00:00Z",
"userProfile": "user1",
"clothingItems": [
"clothing1",
"clothing2"
],
"accessoryItems": [
"accessory1",
"accessory2"
]
},
{
"objectId": "rec2",
"createdAt": "2024-12-09T22:00:00Z",
"userProfile": "user2",
"clothingItems": [
"clothing3",
"clothing4"
],
"accessoryItems": [
"accessory3"
]
},
{
"objectId": "rec3",
"createdAt": "2024-12-09T22:00:00Z",
"userProfile": "user3",
"clothingItems": [
"clothing5"
],
"accessoryItems": [
"accessory4",
"accessory5"
]
},
{
"objectId": "rec4",
"createdAt": "2024-12-09T22:00:00Z",
"userProfile": "user4",
"clothingItems": [
"clothing6",
"clothing7"
],
"accessoryItems": []
},
{
"objectId": "rec5",
"createdAt": "2024-12-09T22:00:00Z",
"userProfile": "user5",
"clothingItems": [
"clothing8"
],
"accessoryItems": [
"accessory6"
]
}
]
@startuml
actor User
participant "APP" as App
participant "Recommendation Service" as RecService
participant "Recommendation Database" as RecDB
User -> App: 输入身高、体重、年龄、性别等信息
App -> RecService: 发送用户输入数据
RecService -> RecService: 处理用户输入数据
RecService -> RecService: 生成推荐穿搭方案
RecService -> RecService: 准备推荐列表 (recommendList)
loop 插入推荐数据
RecService -> RecDB: 插入推荐数据
end
RecDB -> RecService: 返回插入结果
RecService -> App: 返回推荐结果给用户
App -> User: 显示推荐的穿搭方案列表
@enduml
这个时序图清晰地展示了个性化推荐生成逻辑的每一步,描述了用户与系统之间的交互过程。