Closed maxiR8 closed 6 months ago
Hi @maxiR8 thanks for the issue. Return (Enter) works on my mac, I will investigate to make sure it works on iPad's magic keyboard as well!
I added onSubmit
method to the TextField
in ChatView.swift
that fixed it in the emulator. However not sure if this is best way. My Swift knowledge is not great :(
TextField("Message", text: $message, axis: .vertical)
.focused($isFocusedInput)
.frame(minHeight: 40)
.font(.system(size: 14))
.onSubmit {
Task {
Haptics.shared.play(.medium)
guard let selectedModel = selectedModel else { return }
await onSendMessageTap(
message,
selectedModel,
selectedImage,
editMessage?.id.uuidString
)
withAnimation {
isFocusedInput = false
editMessage = nil
selectedImage = nil
message = ""
}
}
}
@maxiR8 I think since we have multiline support on TextField
the onSubmit
will not work.
when the user taps on Return Key
it will move to the next line, However it is working on Mac
Strangely it wasn't working for me on the Mac either in the emulator (believe was iPhone 15) when using the keyboard. Using a wireless apple keyboard, but doubt this is related. Will spin up the project tomorrow and see if I can provide anymore input on this.
I think @maxiR8 your approach is right. I have implemented this and will make a release today.
The expected experience is (as for ChatGPT, Gemini)
Mac
Return
- Submits the prompt
Shift + Return
- New line
Mobile
Return
(virtual keyboard button) - New line
Return
(physical keyboard) - Submits the prompt
Sweet :) Thank you. And great job on the app đź‘Ť Take care.
Nice fix! As far as my experience goes when using the chat from the app to my locally hosted ollama when typing the app sends HEAD requests to the ollama server - my server doesn’t like that and stops responding and I have to restart the ollama service .
So this is a very welcome fix!