fix(tui): attachment source is not stored when using message from message history (#1542)

This commit is contained in:
Yihui Khuu
2025-08-03 00:23:32 +10:00
committed by GitHub
parent 0b132c032a
commit fa95c09cdc
2 changed files with 85 additions and 0 deletions

View File

@@ -120,5 +120,13 @@ func LoadState(filePath string) (*State, error) {
}
return nil, fmt.Errorf("failed to decode TOML from file %s: %w", filePath, err)
}
// Restore attachment sources types that were deserialized as map[string]any
for _, prompt := range state.MessageHistory {
for _, att := range prompt.Attachments {
att.RestoreSourceType()
}
}
return &state, nil
}