Simatwa / python-tgpt

AI Chat in Terminal + Package + REST-API
https://python-tgpt.onrender.com
MIT License
102 stars 15 forks source link

Pyperclip error #17

Closed sameedzahoor closed 7 months ago

sameedzahoor commented 7 months ago

I am getting the following error after the last update. - ERROR : Exception - Pyperclip could not find a copy/paste mechanism for your system. For more information, please visit https://pyperclip.readthedocs.io/en/latest/index.html#not-implemented-error

It was working fine in the version 0.2.2 I had before.

Simatwa commented 7 months ago

I think this is an issue related to your system. Updating these libraries might help.

pip install -U pyperclip clipman
sameedzahoor commented 7 months ago

Tried reinstalling but nothing changed. It was working fine earlier.

Simatwa commented 7 months ago

I'm unable to reproduce the bug on my side. So it's quite not possible to fix that folk.

sameedzahoor commented 7 months ago

I fixed it. I uninstalled pyperclip altogether and used only clipman instead.

sameedzahoor commented 7 months ago

Also since we are discussing clipboards, I don't think the --with-copied flag is necessary since the incorporation of placeholders {{copied}} and {{stream}}. I think they should be enabled by default in the generate mode. It would save a lot of if else statements in scripts.

Simatwa commented 7 months ago

I really don't think that would be fair. At times one might just want to have a quick response that has nothing to do with the copied contents.

sameedzahoor commented 7 months ago

The behaviour that is causing problems is that calling --with-copied without using {{copied}} or {{stream}} results in the copied text being prefixed to the prompt. While it was a nice feature, since the advent of placeholders it becomes redundant as one could just type pytgpt generate "{{copied}} . Explain this code." I would have liked users to type and use placeholders directly on the fzf prompt in szl. For that currently I need to have the --with-copied flag enabled. However, right now it would prefix the prompt with the clipboard content if the placeholder is not used. Maybe we could have a flag that enables the use of placeholders by default in the generate mode without prefixing any copied text by default.

Simatwa commented 7 months ago

Now I've get you folk. Auto-detect the placeholders and substitute them with their respective values, disregarding --with-copied option?

sameedzahoor commented 7 months ago

Exactly. I will test it and give you feedback if you implement that. I like placeholders. It is a very powerful concept. Especially for coding scripts.

Simatwa commented 7 months ago

Awesome. LGTM as well.

sameedzahoor commented 7 months ago

Works beautifully. Thanks.