[GH-ISSUE #169] How to enter multiline text #66

Closed
opened 2026-04-12 09:36:35 -05:00 by GiteaMirror · 12 comments
Owner

Originally created by @abulka on GitHub (Jul 22, 2023).
Original GitHub issue: https://github.com/ollama/ollama/issues/169

How to enter multiline text?
When I hit enter, the input prompt teminates. In ChatGPT I can hit SHIFT enter to begin a new line but not with ollama.
Even pasting multiline text works in ChatGPT but not with ollama.

A workaround seems to be to pipe text files in - see #161

Shouldn't there be a multiline mode or something? Like https://github.com/ggerganov/llama.cpp/issues/1382

Originally created by @abulka on GitHub (Jul 22, 2023). Original GitHub issue: https://github.com/ollama/ollama/issues/169 How to enter multiline text? When I hit enter, the input prompt teminates. In ChatGPT I can hit SHIFT enter to begin a new line but not with ollama. Even pasting multiline text works in ChatGPT but not with ollama. A workaround seems to be to pipe text files in - see #161 Shouldn't there be a multiline mode or something? Like https://github.com/ggerganov/llama.cpp/issues/1382
GiteaMirror added the feature request label 2026-04-12 09:36:35 -05:00
Author
Owner

@pdevine commented on GitHub (Jul 22, 2023):

I'm definitely thinking about different ways to do this, but I'm still not 100% certain which way to go. Piping files does work for now. I'm not (yet) convinced about the llama.cpp approach though.

<!-- gh-comment-id:1646651942 --> @pdevine commented on GitHub (Jul 22, 2023): I'm definitely thinking about different ways to do this, but I'm still not 100% certain which way to go. Piping files does work for now. I'm not (yet) convinced about the llama.cpp approach though.
Author
Owner

@abulka commented on GitHub (Jul 28, 2023):

Seems you can use the API to enter multiline prompts e.g.

{
    "model": "llama2",
    "prompt": "what does this code do\npublic class App \n{\n    public static void main( String[] args )\n    {\n        System.out.println( \"Hello World!\" );\n    }\n}"
}

If the API supported file upload that might be kind of cool too.

<!-- gh-comment-id:1656474424 --> @abulka commented on GitHub (Jul 28, 2023): Seems you can use the API to enter multiline prompts e.g. ```json { "model": "llama2", "prompt": "what does this code do\npublic class App \n{\n public static void main( String[] args )\n {\n System.out.println( \"Hello World!\" );\n }\n}" } ``` If the API supported file upload that might be kind of cool too.
Author
Owner

@mxyng commented on GitHub (Aug 2, 2023):

This is possible as of v0.0.13 by starting the multiline string with """. Once you are done with the multiline input, close it with another """.

$ go run . run llama2
>>> """tell
... me
... a
... joke"""
Of course! Here is a neutral and respectful joke:

Why did the computer go to therapy?
It had a virus!

I hope you found that joke amusing. Is there anything else I can help you with?
<!-- gh-comment-id:1662784852 --> @mxyng commented on GitHub (Aug 2, 2023): This is possible as of v0.0.13 by starting the multiline string with `"""`. Once you are done with the multiline input, close it with another `"""`. ``` $ go run . run llama2 >>> """tell ... me ... a ... joke""" Of course! Here is a neutral and respectful joke: Why did the computer go to therapy? It had a virus! I hope you found that joke amusing. Is there anything else I can help you with? ```
Author
Owner

@nonetrix commented on GitHub (Mar 14, 2024):

Copying and pasting multiple lines doesn't seem to work still, how can I do that? Sorry for commenting on a old thread

<!-- gh-comment-id:1997764113 --> @nonetrix commented on GitHub (Mar 14, 2024): Copying and pasting multiple lines doesn't seem to work still, how can I do that? Sorry for commenting on a old thread
Author
Owner

@pdevine commented on GitHub (Mar 14, 2024):

@nonetrix what platform/terminal are you using, and what version of Ollama are you using? We added "bracketed paste mode" a while ago, so it should be working as long as you have a decent terminal.

<!-- gh-comment-id:1997872255 --> @pdevine commented on GitHub (Mar 14, 2024): @nonetrix what platform/terminal are you using, and what version of Ollama are you using? We added "bracketed paste mode" a while ago, so it should be working as long as you have a decent terminal.
Author
Owner

@nonetrix commented on GitHub (Mar 14, 2024):

Hm I am using Wezterm so maybe it's a issue there?

<!-- gh-comment-id:1998473375 --> @nonetrix commented on GitHub (Mar 14, 2024): Hm I am using Wezterm so maybe it's a issue there?
Author
Owner

@pdevine commented on GitHub (Mar 14, 2024):

@nonetrix It looks like bracketed paste mode is supported?

<!-- gh-comment-id:1998486726 --> @pdevine commented on GitHub (Mar 14, 2024): @nonetrix It looks like [bracketed paste mode](https://wezfurlong.org/wezterm/cli/cli/send-text.html) is supported?
Author
Owner

@nonetrix commented on GitHub (Mar 14, 2024):

Strange, no idea then. I am running ollama 0.1.28, wezterm 20240203-110809-5046fc22. Knowing wezterm and it's currently abysmal Wayland support because of a Wayland backend rewrite that's still kinda buggy, I thought it could be Wayland maybe because it does clipboard stuff differently but same on XWayland

<!-- gh-comment-id:1998579410 --> @nonetrix commented on GitHub (Mar 14, 2024): Strange, no idea then. I am running ollama 0.1.28, wezterm 20240203-110809-5046fc22. Knowing wezterm and it's currently abysmal Wayland support because of a Wayland backend rewrite that's still kinda buggy, I thought it could be Wayland maybe because it does clipboard stuff differently but same on XWayland
Author
Owner

@pdevine commented on GitHub (Mar 14, 2024):

Maybe a bug in wezterm then? I just tested this out w/ macOS and iTerm2 and it's definitely working correctly.

<!-- gh-comment-id:1998590187 --> @pdevine commented on GitHub (Mar 14, 2024): Maybe a bug in wezterm then? I just tested this out w/ macOS and iTerm2 and it's definitely working correctly.
Author
Owner

@nonetrix commented on GitHub (Jun 23, 2024):

Seems fixed now suddenly

<!-- gh-comment-id:2185353546 --> @nonetrix commented on GitHub (Jun 23, 2024): Seems fixed now suddenly
Author
Owner

@colltoaction commented on GitHub (Jul 8, 2025):

What if the documents have """ occurrences as well? A flag to pass multiple files as inputs would be great. The CLI would ingest all files as the prompt.

<!-- gh-comment-id:3050198645 --> @colltoaction commented on GitHub (Jul 8, 2025): What if the documents have `"""` occurrences as well? A flag to pass multiple files as inputs would be great. The CLI would ingest all files as the prompt.
Author
Owner

@pdevine commented on GitHub (Jul 8, 2025):

if you're pasting I think the """'s will get skipped. For images, you should be able to copy multiple file names and it will pick them up automatically, but it'd be nice to do that for any file.

<!-- gh-comment-id:3050205296 --> @pdevine commented on GitHub (Jul 8, 2025): if you're pasting I think the """'s will get skipped. For images, you should be able to copy multiple file names and it will pick them up automatically, but it'd be nice to do that for any file.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/ollama#66