textgen: add history of the generated text

to avoid generating same text continuously.