[GH-ISSUE #749] unable to terminate session in TUI #46866

Closed
opened 2026-04-28 01:19:25 -05:00 by GiteaMirror · 6 comments
Owner

Originally created by @praveenc on GitHub (Oct 10, 2023).
Original GitHub issue: https://github.com/ollama/ollama/issues/749

Originally assigned to: @pdevine on GitHub.

Hi, I pasted text to the prompt that contained many new line characters. Seems like the session is considering each line as an input prompt and it goes on to generate responses. I'v tried to Ctrl-c, Ctrl-z, Ctrl-d but the prompt wouldn't terminate, essentially locking up the terminal session

ollama run mistral
>>> Summarize this doc for me """Use Docker containers to build models 

Makes extensive use of Docker containers for build and runtime tasks. Provides pre-built Docker images for its built-in algorithms and the supported deep learning frameworks used for training and inference. Using containers, you can train machine learning algorithms and deploy models quickly and reliably at any scale. 

The topics in this section show how to deploy these containers for your own use cases. .

For information about how to bring your own containers for use , see Bring your own Docker image

couldn't close the starting quotes i.e. """ as the model started generating text already ...

Would be nice to capture this.

p.s.: Seems the Ctrl-C, Ctrl-D signal was queued at the end...

...
>>> ^C
Use Ctrl-D or /bye to exit.
>>> ^C
Use Ctrl-D or /bye to exit.
>>> ^C
Use Ctrl-D or /bye to exit.
>>> ^C
Use Ctrl-D or /bye to exit.
>>> ^C
Use Ctrl-D or /bye to exit.
>>> ^C
Use Ctrl-D or /bye to exit.
>>> ^C
Use Ctrl-D or /bye to exit.
>>> ^C
Use Ctrl-D or /bye to exit.
>>> ^D
Originally created by @praveenc on GitHub (Oct 10, 2023). Original GitHub issue: https://github.com/ollama/ollama/issues/749 Originally assigned to: @pdevine on GitHub. Hi, I pasted text to the prompt that contained many new line characters. Seems like the session is considering each line as an input prompt and it goes on to generate responses. I'v tried to `Ctrl-c`, `Ctrl-z`, `Ctrl-d` but the prompt wouldn't terminate, essentially locking up the terminal session ```shell ollama run mistral >>> Summarize this doc for me """Use Docker containers to build models Makes extensive use of Docker containers for build and runtime tasks. Provides pre-built Docker images for its built-in algorithms and the supported deep learning frameworks used for training and inference. Using containers, you can train machine learning algorithms and deploy models quickly and reliably at any scale. The topics in this section show how to deploy these containers for your own use cases. . For information about how to bring your own containers for use , see Bring your own Docker image ``` couldn't close the starting quotes i.e. `"""` as the model started generating text already ... Would be nice to capture this. _p.s.: Seems the `Ctrl-C`, `Ctrl-D` signal was queued at the end..._ ```shell ... >>> ^C Use Ctrl-D or /bye to exit. >>> ^C Use Ctrl-D or /bye to exit. >>> ^C Use Ctrl-D or /bye to exit. >>> ^C Use Ctrl-D or /bye to exit. >>> ^C Use Ctrl-D or /bye to exit. >>> ^C Use Ctrl-D or /bye to exit. >>> ^C Use Ctrl-D or /bye to exit. >>> ^C Use Ctrl-D or /bye to exit. >>> ^D ```
GiteaMirror added the bug label 2026-04-28 01:19:25 -05:00
Author
Owner

@pdevine commented on GitHub (Oct 11, 2023):

I'm looking at revamping this right now w/ replacing the readline library with something that also includes a way to do bracketed paste mode.

<!-- gh-comment-id:1756607184 --> @pdevine commented on GitHub (Oct 11, 2023): I'm looking at revamping this right now w/ replacing the `readline` library with something that also includes a way to do bracketed paste mode.
Author
Owner

@pdevine commented on GitHub (Oct 26, 2023):

This is fixed w/ #922.

<!-- gh-comment-id:1782069454 --> @pdevine commented on GitHub (Oct 26, 2023): This is fixed w/ #922.
Author
Owner

@pdevine commented on GitHub (Oct 26, 2023):

@praveenc you shouldn't need to add """ now when you paste, although it still should work.

<!-- gh-comment-id:1782069982 --> @pdevine commented on GitHub (Oct 26, 2023): @praveenc you shouldn't need to add """ now when you paste, although it still should work.
Author
Owner

@praveenc commented on GitHub (Oct 30, 2023):

Thanks @pdevine ! Just tested this, TUI is now able to capture Ctrl-C signal.

However, when new line separated text is pasted to the TUI, it still considers each line as a separate input.

Tested this on text iTerm2 (Build: 3.4.21) on Macos Sonoma 14.1.

multiline-tui-30Oct2023

<!-- gh-comment-id:1785564492 --> @praveenc commented on GitHub (Oct 30, 2023): Thanks @pdevine ! Just tested this, TUI is now able to capture `Ctrl-C` signal. However, when new line separated text is pasted to the TUI, it still considers each line as a separate input. Tested this on ```text iTerm2 (Build: 3.4.21) on Macos Sonoma 14.1. ``` ![multiline-tui-30Oct2023](https://github.com/jmorganca/ollama/assets/1090396/02c2b3e1-8921-4366-ae5a-848dd76001f5)
Author
Owner

@pdevine commented on GitHub (Oct 30, 2023):

Hi @praveenc can you do an ollama --version to make certain you are on the latest version?

Also, in iTerm2 you need to have bracketed paste mode turned on. I believe this is the setting:
Screenshot 2023-10-30 at 1 18 35 PM

<!-- gh-comment-id:1785974569 --> @pdevine commented on GitHub (Oct 30, 2023): Hi @praveenc can you do an `ollama --version` to make certain you are on the latest version? Also, in iTerm2 you need to have bracketed paste mode turned on. I believe this is the setting: <img width="621" alt="Screenshot 2023-10-30 at 1 18 35 PM" src="https://github.com/jmorganca/ollama/assets/75239/77720f04-a6b6-4e9f-bac2-5e9fd258fd4b">
Author
Owner

@praveenc commented on GitHub (Oct 31, 2023):

@pdevine Sure. Here it is. ollama version 0.1.5
and yes, my iTerm setting has Terminal may enable paste bracketing enabled already.

<!-- gh-comment-id:1787325264 --> @praveenc commented on GitHub (Oct 31, 2023): @pdevine Sure. Here it is. `ollama version 0.1.5` and yes, my iTerm setting has `Terminal may enable paste bracketing` enabled already.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/ollama#46866