zeitlings / ayai-gpt-nexus

OpenAI, Anthropic, and Gemini integrations with support for local LLMs
31 stars 0 forks source link

Allow universal action to provide custom prompt? #6

Closed nabsiddiqui closed 1 week ago

nabsiddiqui commented 1 week ago

Is it possible to allow universal action to have a customizable prompt before the selected text?

zeitlings commented 1 week ago

Hey @nabsiddiqui You can modify or add new prompts by editing actions.config.pkl and build it with pkl or by modifying the actions.json directly. Make a backup of your modified files or they will be overwritten when you update the workflow.

If you don't want to go that route, you can create a new Universal Action object for the workflow, prepend your instruction to the selected text via the Args and Vars utility, and pass it into the final Run Script object of the inference tasks.

Make sure to use the Follow Instruction action by setting the related environment variable. These variables have to be set:

"workflow_program_state" : "generate",
"action_dispatch_id" : "follow.instruction",
"action_payload": "{your_prompt_and_selected_text}"

I'm assuming that you know your way around the Alfred workflow builder canvas, but note that if you just make your instruction (prompt) part of the selected text, you can simply use the default Follow Instruction action.

nabsiddiqui commented 1 week ago

Thank you for the quick follow-up. Unfortunately, I don't currently know my way around the workflow builder to do this, but I will try to learn it soon. My main reason for suggestion is that this is, I believe, the default way for the other ChatGPT workflow in Alfred and Gemini workflow in Raycast.

zeitlings commented 1 week ago

Hey @nabsiddiqui Ah, do you mean the Universal Action to open the chat window, and not the one for Inference Actions? That I can indeed look into.

nabsiddiqui commented 1 week ago

Yes, what I would ideally like is to be able to highlight a bunch of text and open it in Universal Action. Then, have an option to prompt it and open up the chat with the results.

This is what it is like in the AskGPT workflow when you select text. I am asking it to rewrite like Shakespeare. The reason I would like to use your extension is to use Gemini and other LLMs, which the AskGPT extension does not allow.

Screenshot 2024-09-09 at 3 34 34 PM Screenshot 2024-09-09 at 3 35 36 PM
zeitlings commented 1 week ago

Added to v1.0.0-alpha.6. Thanks for the suggestion!

nabsiddiqui commented 1 week ago

Thank you so much! This is perfect!