-
Notifications
You must be signed in to change notification settings - Fork 117
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Chat interface updates - new flags for multi-line input, model choice selection, updated paragraph wrapping for output and option flag to disable, and minor bugfixes #230
Conversation
Ah, also added a mini timeout feature, for when requests occasionally go bad. Probably should change the commit message to reflect that. Will wait for feedback |
ceb526f
to
f7a68ec
Compare
split commits up into manageable chunks. hope some are good for cherry picking |
f7a68ec
to
451a3c0
Compare
c61e9e3
to
2e12df4
Compare
always with the "just one more thing" with git ;) FYI, my usage style with these changes is:
I've also been making some improvements to the save chat functionality too. being able to name saved chats as you start them, and allowing branches with reworking from a certain point. need to save the chat_vdqs along the way. open for a discussion, if it'd be of any interest? |
2e12df4
to
6a515ba
Compare
Previous output: ```python import click def wrap_text_with_newlines(text, width=78): paragraphs = text.split('\n') wrapped_paragraphs = [click.wrap_text(paragraph, width=width) for paragraph in paragraphs] return '\n'.join(wrapped_paragraphs) text = "This is a sample text.\n\nIt has multiple paragraphs.\nEach paragraph should be wrapped separately." wrapped_text = wrap_text_with_newlines(text, width=78) print(wrapped_text) ``` Updated output: ```python import click def wrap_text_with_newlines(text, width=78): paragraphs = text.split('\n') wrapped_paragraphs = [click.wrap_text(paragraph, width=width) for paragraph in paragraphs] wrapped_text = '\n'.join(wrapped_paragraphs) return wrapped_text text = "This is a sample text.\nIt has multiple lines.\nEach line should be wrapped separately." wrapped_text = wrap_text_with_newlines(text, width=20) print(wrapped_text) ```
Allow the user to enter multiple lines in a single prompt. Remind the user that the EOF command key will finish the input.
When dealing with large amount of text as a prompt, it's easier to edit command line history when copying and pasting a number of paragraphs. When asking coding questions it's useful to be able to edit multi-line input after pasting, which can't be done in the interactive console. This new functionality will assume multi-line input is enabled, and check between interactive console and piping from stdin behaviour. Since longer prompts take longer to respond, increase the timeout to 30s
6a515ba
to
e96beb4
Compare
The code is overcomplicated. |
Following on the inspiration to share back to the community from PR 227, I offer these improvements.
The commit messages should have most of the info there.
I did modify/comment out this line
text = resp_answer #click.wrap_text(resp_answer, width=78, preserve_paragraphs=True)
since the formatted text returned does look right when it prints mardown code.
Let me know what you think.