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
commit fa95c09cdc
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
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
}