Simatwa / python-tgpt

AI Chat in Terminal + Package + REST-API

Home Page:https://python-tgpt.onrender.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Pyperclip error

sameedzahoor opened this issue · comments

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.

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

pip install -U pyperclip clipman

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

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

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

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.

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.

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.

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

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.

Awesome. LGTM as well.

Works beautifully. Thanks.