Skip to content
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

Add multiline support and use command for changing behavior #3

Merged
merged 4 commits into from
Jul 21, 2024

Conversation

k-aito
Copy link
Contributor

@k-aito k-aito commented Jul 20, 2024

Hello @mrgick

I find this one a bit dirty to be honest but it is working at first view, but if you see a better way to implement it don't hesitate. If you think it's a bit outside the scope don't hesitate to tell me too.

I think there would be some explain after /singleline and /multiline like how they work and stuff like that.

/help command

Capture d’écran_2024-07-20_17-53-17

using /multiline

Capture d’écran_2024-07-20_17-53-48

switching back to /singleline and checking what was sent before and then /quit

Capture d’écran_2024-07-20_17-54-19

@mrgick
Copy link
Owner

mrgick commented Jul 21, 2024

Hello, @k-aito

Very good idea to add commands.
I refactored it a bit and made a cli.py file
Also, I changed the multiple input to sys.stdin.read() - it stops when you raise EOFError (Ctrl+D)

Examples:

  • /help

image

  • /multiline

image

  • /singleline

image

  • Bad input - empty string

image

  • /quit

image

Also, if you have any remarks/suggestions, then write them :)

@k-aito
Copy link
Contributor Author

k-aito commented Jul 21, 2024

It looks very cool like that. The code looks much more clear than my "draft / dirty" version ^^

Maybe a `/model name´ could be nice, but I don't think it's possible because DDG is cleaning the conversation when changing the model.
Something like /summarize could be handy, but it's maybe better to let people easily do their own command in the conf.toml maybe in a key/value style.

Example:

In the conf file

summarize = "Summarize me what I said"

In the application, /summarize would be replaced by Summarize me what I said and validated.
But it would be more of a bonus than a necessity, in my opinion ^^

@mrgick
Copy link
Owner

mrgick commented Jul 21, 2024

Interesting ideas

/model can only be implemented with clearing the chat, though... We could collect the conversation history into one first prompt and send it into a new model

/summarize can be implemented

I think I'll write them in two issues, as this PR is already standalone

So, I will try to play with ideas as soon as I have time, firstly I'll try to speed up api.py (try to replace httpx with curl_cffi, and json to msgspec).

This was referenced Jul 21, 2024
@k-aito
Copy link
Contributor Author

k-aito commented Jul 21, 2024

That sounds nice for me ^^

If I can get something else working, I will do a PR if not, you don't need to wait for me.

It's already very nice like that, it lets me avoid opening a browser when I just need to type 1 line.

Good luck for curl_cffi and msgspec I even don't know them at all ^^

@mrgick
Copy link
Owner

mrgick commented Jul 21, 2024

It would be nice if you could help with some of issue, maybe implement /summarise

And thanks for the luck with speeding up ^^

Have a nice day ;)

@mrgick mrgick merged commit e2e2403 into mrgick:main Jul 21, 2024
@k-aito k-aito deleted the add-commands-and-multiline branch July 21, 2024 15:41
@k-aito
Copy link
Contributor Author

k-aito commented Jul 21, 2024

I will try to take a look when I have a bit of time.

Have a nice day too

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants