Skip to content

Commit

Permalink
Merge pull request #64 from JunNishimura/#63
Browse files Browse the repository at this point in the history
update chat view
  • Loading branch information
JunNishimura authored Aug 22, 2023
2 parents 0316431 + 17b1854 commit c05d553
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion ui/hey/view.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,19 @@ func (m Model) getViewHeight() int {

func (m Model) chatView() string {
var s string
var lastSpeaker Speaker
for _, message := range m.conversation {
if message.speaker == Bot {
s += style.BotChat(m.getViewWidth()).Render(message.content) + "\n\n"
lastSpeaker = Bot
} else if message.speaker == User {
s += style.UserChat().Render(message.content) + "\n\n"
lastSpeaker = User
}
}
s += style.TextInput().Render(m.textInput.View())
if s != "" && lastSpeaker == Bot {
s += style.TextInput().Render(m.textInput.View())
}
return s
}

Expand Down

0 comments on commit c05d553

Please sign in to comment.