Although by default chat window could show less history (see linked ticket), but some users might prefer to still see older history or even more older messages. So, there could be a setting to select 12, 24 hours or maybe days. And then also another limit of X messages, so you won't get hundreds of them. Although this might get very complex quickly and confusing to users with many different checkboxes and input fields.
Default to 24 hours. And allow to override this with X days, and X can be set by a user.
A setting to set X last messages to show. Default is 20. Currently implemented without GUI.