Enha: id for card map
This commit is contained in:
@@ -109,6 +109,12 @@ func ReadCardJson(fname string) (*models.CharCard, error) {
|
||||
if err := json.Unmarshal(data, &card); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if card.FilePath == "" {
|
||||
card.FilePath = fname
|
||||
}
|
||||
if card.ID == "" {
|
||||
card.ID = models.ComputeCardID(card.Role, card.FilePath)
|
||||
}
|
||||
return &card, nil
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user