llm icon indicating copy to clipboard operation
llm copied to clipboard

Strip off last \r\n in the prompt file.

Open KerfuffleV2 opened this issue 2 years ago • 2 comments

Naturally also works if it's just \r or just \n. (However \n\r would result in \n. If you put weird stuff like that in your prompt file, you deserve what you get.)

Closes #60

KerfuffleV2 avatar Mar 24 '23 12:03 KerfuffleV2

Seems reasonable, but is there a reason not to use str::trim_end or str::trim_end_matches?

philpax avatar Mar 24 '23 17:03 philpax

@philpax Because those would strip off all the trailing newline/carriage return characters, making it 1) impossible to actually use a prompt from a file that ends with a newline and 2) different behavior from llama.cpp which is probably what people will expect it to function like.

I care more about the first one there personally since I think that may be something people will actually want/need to do.

KerfuffleV2 avatar Mar 24 '23 17:03 KerfuffleV2

Fair enough!

philpax avatar Mar 24 '23 18:03 philpax

By the way, I hope that comment wasn't too blunt. With the numbered items it does kind of read like I was lecturing you or something. So it may have come off stronger than I intended (I'm just generally a pretty direct person though).

KerfuffleV2 avatar Mar 24 '23 19:03 KerfuffleV2

Oh no, don't worry - you explained it just fine. 'sall good :)

philpax avatar Mar 24 '23 19:03 philpax