c0desurfer Posted December 13, 2022 Share Posted December 13, 2022 (edited) Just type your query after the 'ai' keyword and the result will be pasted into your active application. Go to https://beta.openai.com/account/api-keys to get your OpenAI API key and configure the workflow first. Get the workflow at https://github.com/c0desurfer/alfred-openai-chatgpt. Edited December 13, 2022 by c0desurfer new screenshot Skone and lkjashdga 2 Link to comment Share on other sites More sharing options...
dustonio Posted December 18, 2022 Share Posted December 18, 2022 This workflow is a great idea. Does something need to be installed on the computer for this workflow to work (apart from entering in the API key)? I have been using ChatGPT only through the browser window. Link to comment Share on other sites More sharing options...
Noob Posted December 18, 2022 Share Posted December 18, 2022 It's not working for me. I type "ai" + prompt (same as image) and I see "This will be the query for OpenAI", but when I press enter nothing happens, alfred's prompt box just disappears. ^ says to install openai Python module but I have no idea how to do that, I've just setup the API key. Link to comment Share on other sites More sharing options...
dserodio Posted December 19, 2022 Share Posted December 19, 2022 (edited) @Noob you need to run pip3 install openai on the Terminal to install the openai Python module. I also had to edit the script inside the workflow and change python to python3 Edited December 19, 2022 by dserodio Link to comment Share on other sites More sharing options...
c0desurfer Posted December 22, 2022 Author Share Posted December 22, 2022 Yes, currently the script assumes you are using pyenv to manage python versions and the openai module is installed via pip in the "default" instance. Link to comment Share on other sites More sharing options...
c0desurfer Posted December 24, 2022 Author Share Posted December 24, 2022 Updated to v1.1.0 with better error handling. Link to comment Share on other sites More sharing options...
vitor Posted December 29, 2022 Share Posted December 29, 2022 (edited) On 12/22/2022 at 4:02 PM, c0desurfer said: Yes, currently the script assumes you are using pyenv to manage python versions and the openai module is installed via pip in the "default" instance. That is a huge assumption and dependency, the workflow cannot be added to the Gallery in that state because it cannot be expected most people will have that set up. Plus, the Python command setting (to set python or python3) won’t be clear for most people and it defaults to the least common option. Can you use /usr/bin/python3 and bundle the python package inside the workflow? That would work out of the box and it’s how the majority of Python workflows work. Edited December 29, 2022 by vitor Link to comment Share on other sites More sharing options...
c0desurfer Posted December 30, 2022 Author Share Posted December 30, 2022 21 hours ago, vitor said: Can you use /usr/bin/python3 and bundle the python package inside the workflow? That would work out of the box and it’s how the majority of Python workflows work. I didn't know that was possible, this is my first workflow. Any docs on that? Link to comment Share on other sites More sharing options...
gingerbeardman Posted December 30, 2022 Share Posted December 30, 2022 (edited) Didn't work for me. Needs to be more intelligent or verbose about errors if Python isn't set up correctly. [12:23:40.354] Logging Started... [12:23:42.544] OpenAI ChatGPT[Keyword] Processing complete [12:23:42.547] OpenAI ChatGPT[Keyword] Passing output 'what is love?' to Run Script [12:23:42.835] ERROR: OpenAI ChatGPT[Run Script] pyenv: no such command `virtualenv-init' pyenv: no such command `activate' dyld[57018]: Library not loaded: '/opt/homebrew/Cellar/python@3.9/3.9.13_1/Frameworks/Python.framework/Versions/3.9/Python' Referenced from: '/usr/local/bin/python' Reason: tried: '/opt/homebrew/Cellar/python@3.9/3.9.13_1/Frameworks/Python.framework/Versions/3.9/Python' (no such file), '/Library/Frameworks/Python.framework/Versions/3.9/Python' (no such file), '/System/Library/Frameworks/Python.framework/Versions/3.9/Python' (no such file) [12:23:42.840] OpenAI ChatGPT[Run Script] Processing complete [12:23:42.840] OpenAI ChatGPT[Run Script] Passing output '' to Copy to Clipboard Edited December 30, 2022 by gingerbeardman Link to comment Share on other sites More sharing options...
vitor Posted December 31, 2022 Share Posted December 31, 2022 @c0desurfer Call /usr/bin/python3 directly or use the language dropdown. To include a package with the workflow, use the --target option and set PYTHONPATH. StackOverflow has other options. Skone 1 Link to comment Share on other sites More sharing options...
vitor Posted May 20 Share Posted May 20 @c0desurfer Looking at the GitHub page it seems you haven’t been active there in general, which is OK, but without the changes this can’t go in the Gallery as most users won’t be able to set it up. I’ll move this to completed to help clean up this forum section which allows me to better parse the remainder, but that’s not a permanent outcome, you can always comment back in the future if there’s been progress and I’ll take another look. And, naturally, this has no bearing on your sharing of the workflow anywhere, it’s perfectly fine to have something which fits mostly your needs, a major power of Alfred is precisely that you can create things to work exactly as you want them to. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now