Jump to content

gloogloo

Member
  • Posts

    20
  • Joined

  • Last visited

  • Days Won

    2

gloogloo last won the day on April 7

gloogloo had the most liked content!

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

gloogloo's Achievements

Member

Member (4/5)

8

Reputation

  1. In case anyone stumbles upon this workflow. For some reason I can't edit my original post but just a quick note to mention that Kiki now supports Anthropic's models (Claude), Whisper AI, and can also be set to use a custom API Endpoint, among a few more things. Updates and full documentation can be found over at GITHUB
  2. @iandol I've just released a small update making the main request script a separate file. Feel free to add what you need. Man, I'm actually very close to being code illiterate and most of what you see in there both in bash or Javascript came from GPT 4 itself, so any help is welcome and it's great if you can contribute adding something that helps you or others.
  3. Hey @iandol, thanks for trying Kiki out! I saw the feature request for local LLMs. I haven't really looked into it, but have added it to my to-do list to check this out and see if I can consider it in the future. Adding custom API endpoints may not be too complicated but I'm an absolute beginner at this so even "simple" things do end up eating a lot of time. Oh, and Kiki doesn't stream replies yet. It's one of those things that I'll try to do if I can incorporate it with the new text view. For the most part I've built this on the go, adding the features I personally needed, and just trying to adapt them in a way that is also useful to others. Seems like I still have a long way to go. Even though I know very little coding and about building Alfred workflows, I think this workflow has ended up being a bit too complicated for the average user. I mean, it "can" be if the user wants it to, or they can give it a very basic use, but the length of the documentation alone is probably enough to scare some away. Still, I think Kiki offers some flexibility and features I haven't seen in any other LLM workflows. Would love to be able to submit to the Alfred's gallery, especially for the ease of offering updates, but it seems like submissions are closed. Thanks for checking this out!
  4. I made Kiki, a workflow that works not only with Open AI but also with OpenRouter models (which includes Claude). I have actually already incorporated access to Anthropic's API but haven't gotten around uploading this latest version (I need to update the documentation since I also incorporated Whisper). The update should be up sometime this coming week. It's not as pretty as Alfred's new Chat GPT workflow (still haven't figured out how to use incorporate the new text view or if I should incorporate it at all) but it's super versatile.
  5. Kiki AI-Powered Chat & Text Tools For Chat GPT and OpenRouter's Models A short video showcasing some features. REQUIREMENTS: OpenAI or OpenRouter API Token Jq: Can be installed from Homebrew This workflow is specifically designed with the following features in mind: Quick chats initiated from Alfred’s command bar: These chats start in the command bar of Alfred and continue as AppleScript dialogs. Create and use presets for selected text or user input: Customize prompts, system role, temperature, and other settings per preset. This feature can help with grammar correction, translations, rephrasing, tone adjustment, smart text transformations, idea generation, and much more. Chat initiation options with the use of modifiers from Alfred’s command bar: These options include selecting an alternative model, an alternative system role or "persona," pasting results in the frontmost window, and preserving or resetting existing context. Easy continuation of previous conversations: Seamlessly continue previous conversations by using Alfred Universal actions on existing context files. Trigger presets on text using hotkeys, snippets, or external triggers: Activate presets on text using hotkeys, snippets, or external triggers for faster results, without needing to use Alfred's command bar. Markdown Chat: Enjoy the convenience of making AI requests directly in your preferred markdown text editor. Customize the chat settings through presets included on the header of your notes according to your preferences. SCREENSHOTS A few things I must mention: I have written an extensive documentation over at Github. I may have gone a bit overboard, but this workflow can be as simple or as complicated as users want it to be. My coding skills are very basic, so most of the code used to create this workflow came out of Kiki itself. There are some workflows that are very powerful in using all that OpenAI's API has to offer, but Kiki doesn't try to do everything. This is a tool that shines as a utility for everyday text-related tasks. Because of that, I currently do not have plans to integrate it with image generation, vision, etc. Instead, I welcome any ideas on how to make this better at what it does. I have tried to work around limitations, and I've tried to make this workflow as customizable as possible, but I know it could probably be better. If you encounter any bugs that you can reproduce please feel free to comment or let me know. Honestly, I'm a total beginner at this, but will be happy to help if I can. Lastly, I hope I am not asking too much by requiring users to install Jq. I know that Alfred workflows that make it to the gallery do not have to deal with this, but it seems gallery submissions are closed for the time being. I also know that not every user wants to deal with the creation of presets using JSON files, do you have any idea on how to improve this? It's my first workflow submission to this forum. I'm not sure of what I'm doing here (or on Github), but I hope you give this a try and hopefully find it useful. GITHUB | DOWNLOAD
  6. I know there is the setting under Settings/Universal Actions that applies for all workflows, but if I plan to share a workflow I cannot expect everyone to have that unchecked. The thing is that I am working on a workflow that has several script filters and—for the most part—they do not work as universal actions. They can only receive the listed items as arguments, nothing else. Especially since I like to have the "Alfred Filters Results" option checked on my script filters. This results in having Universal Actions that seem broken, because they are there listed with all the others but basically are unusable. From some testing it seems like if I don't give my Script Filters a keyword they won't be listed as Universal Actions but I'm wondering if there's any other way? I've tried searching and reading all the documentation without success. Any help is appreciated. Thanks!
  7. Thank you SO MUCH. This was making me crazy. I was syncing my preferences. Even while disabling my internet connection it seemed to be happening, but I moved my preferences to a local folder and the issue disappeared. Have been using it for about 30 minutes and no more problems. Wow. This was dropbox, and I had it with the option to make it available offline, I have no idea why was this happening. I guess I'll just have to figure out another backup solution. Thank you so much. Fixed.
  8. It's been some weeks that I find this bug on my computer while editing a workflow. It just makes it very frustrating to drag action blocks around. SEE WHAT I MEAN. It seems like I'm halfway dragging a block out and it just returns to its previous position. In the clip above I also show another very random bug. Sometimes I can't edit the note of those blocks, sometimes I can. I have uninstalled Alfred and deleted preferences multiple times already, and have no idea what can it be. I don't have any similar issues while dragging things anywhere else in my system. I thought it could have been because of Yabai, Karabiner, BetterTouchTool, or Hammerspoon (apps that interact with windows and keyboard or mouse events), but I have quit these and the problem persists. Happens both with my mouse or my trackpad. I'm on Alfred 5.1.4 [2195] and Sonoma 14.2.1 (23C71). Macbook Air M1
  9. Ok, after lots of testing I've come to the conclusion that if I perform a script action in Alfred, and if one step takes a bit longer to complete, the script will still run everything that follows as long as it's inside the same action block. But it will stop Alfred from going to the next one. The times that my workflow fails is because curl delays a bit. So my only workaround so far is to output the assistant's response to a txt file, and trigger the following Alfred's action block from my workflow like this: RESPONSE_FILE="./lastresponse.txt" # Write the assistant's response to a separate file echo "$assistant_response" > "$RESPONSE_FILE" # Run the next step to read the text osascript -e 'tell application id "com.runningwithcrayons.Alfred" to run trigger "receiver" in workflow "com.afadingthought.alfred"' So the "receiver" reads the response from the txt file and pastes to my frontmost app. I guess this is a bit slower than doing it all without jumping from one action to the next one with applescript, but it just seems to be a limitation or bug within Alfred.
  10. I am having problem with a script from a workflow I’m creating to interact with OpenAI’s API. I’m not a developer and I’ve used a lot of GPT help for this, but I’m at the point where I’m lost and seems to be hitting the limit of how GPT 4 can help me with this. The idea of the workflow is so that I can be in Bear, my note-taking app (or any markdown note taking app) and that I can start a Chat GPT chat right there, just below a markdown line (---) . Applescript is used to select my text, copy it, extract the actual request text (after the last line), and then it get to this Bash script which does the request and where somewhere in there the problem lies. The reason it’s making me crazy is because it seems to work perfectly at first, but randomly after a few messages (or sometimes on the first one), and without showing anything at all in the debugging console, it just doesn’t echo the assistant response, which a following action should then paste in my frontmost app. The response is also saved to a json file that is used to keep track of context, and it does gets output there every time without issues. It’s just that for some reason the script action doesn’t echoes the variable so that the can workflow continue... seems to just stop running. Any idea of what could be happening would be very helpful. I thought it had something to do with timeouts but since it is written to the context json file then I don’t think that’s the reason. There’s also been a few cases where the context json file gets some ?? Characters at the end making it unreadable, and I have no idea of the reason for that, and can’t reproduce it yet... but this first issue is keeping me sleepless. I’m on Alfred 5.1.4 [2195], Mac OS 14.2.1 (23C71). The script is this: #!/bin/bash # Configuration variables CONTEXT_MESSAGES_LIMIT=10 SYSTEM_ROLE_MESSAGE="You are a helpful AI assistant. Your answers do not include a description unless prompted to do so." MODEL="gpt-3.5-turbo-1106" TEMPERATURE=0.5 MAX_TOKENS="" # Set to an empty string if not needed: MAX_TOKENS="" # Load API key OPENAI_API_KEY="${APIToken}" # Define the context file path CONTEXT_FILE="./context.json" # Read the new user message from the first argument new_message="${theRequest}" # Initialize or read existing context from file if [[ ! -f "$CONTEXT_FILE" ]]; then # If context doesn't exist, prepend with system role message messages=$(jq -n --arg msg "$SYSTEM_ROLE_MESSAGE" '[{"role":"system","content":$msg}]') else messages=$(cat "$CONTEXT_FILE") fi # Append the new message to the context array messages=$(echo "$messages" | jq --arg msg "$new_message" '. + [{"role":"user","content":$msg}]') # Ensure that we keep only the last N messages as defined by CONTEXT_MESSAGES_LIMIT messages=$(echo "$messages" | jq --argjson limit "$CONTEXT_MESSAGES_LIMIT" '.[-$limit:]') # Formulate the API request payload payload=$(jq -n \ --arg model "$MODEL" \ --argjson messages "$messages" \ --argjson temperature "$TEMPERATURE" \ '{model: $model, messages: $messages, temperature: $temperature}') # If MAX_TOKENS is set, add it to the payload if [[ -n "$MAX_TOKENS" ]]; then payload=$(echo "$payload" | jq --argjson max_tokens "$MAX_TOKENS" '. + {max_tokens: $max_tokens}') fi # Make the API request response=$(curl -s -X POST \ -H "Content-Type: application/json" \ -H "Authorization: Bearer $OPENAI_API_KEY" \ -d "$payload" \ https://api.openai.com/v1/chat/completions) # Extract the assistant's response and append it to the context assistant_response=$(echo "$response" | jq -r '.choices[0].message.content') messages=$(echo "$messages" | jq --arg msg "$assistant_response" '. + [{"role":"assistant","content":$msg}]') # Update the context file with the new messages echo "$messages" > "$CONTEXT_FILE" # Output the assistant's response echo $assistant_response
  11. If someone could help with the Pocket for Alfred workflow that would be awesome.
  12. Now it's all working perfectly. Thank you SO MUCH again. I've learned so much.
  13. Genius!!! Seriously, thank you SO MUCH! Man, you got it perfectly. JavaScript was truly the way to go after all. One last thing. Could it be possible, at all, to enter "\n" and use that to create line breaks within the content of the note? As it's right now if I type \n this goes directly into the note. I've tried to replace \n manually to its hexadecimal code but doesn't seem to work. If it's too much trouble or not possible, no worries. It's already great as it is and I really really appreciate your help.
  14. The URL encoding sent me in the right path, thank you. I still didn't figure out how to do all of this in JavaSript, but I found a bit of a ghetto fix with AppleScript. I found a shell script to URL encode. This: do shell script "php -r 'echo urlencode(\"" & thecontent & "\");'") It seems like AppleScript couldn't use 'open location' after this, so I just return the end variable, make it go through a "trim whitespace" and send it to the "Open URL" Alfred Action. This seems to work for the most part. Characters like "&" and "=" now are sent to the app through x-callback-url without problem. From what I've tested, the only character that still breaks the workflow and gives trouble is if I enter double quotes as the initial query. I have no idea if I'll find a solution to this one but at least it all works much better than before. The entire AppleScript code, for reference: on count_windows_on_current_space(process_name) tell application "System Events" tell process process_name return count of windows end tell end tell end count_windows_on_current_space tell application "System Events" set nom to name of process 1 whose frontmost is true end tell if nom is equal to "Bear" then else if my count_windows_on_current_space("Bear") = 0 then else tell application "Bear" activate end tell tell application "System Events" keystroke "m" using command down end tell end if end if set timo to (do shell script "date +\"%l:%M %p\" | awk '{$1=$1;print}'") set theDate to (do shell script "date +\"%m.%d.%y\" | awk '{$1=$1;print}'") if timo contains "PM" then set findText to "PM" set replaceText to "p.m." set newTime to do shell script "sed 's|" & quoted form of findText & "|" & quoted form of replaceText & "|g' <<< " & quoted form of timo else set findText to "AM" set replaceText to "a.m." set newTime to do shell script "sed 's|" & quoted form of findText & "|" & quoted form of replaceText & "|g' <<< " & quoted form of timo end if on replace_chars(this_text, search_string, replacement_string) set AppleScript's text item delimiters to the search_string set the item_list to every text item of this_text set AppleScript's text item delimiters to the replacement_string set this_text to the item_list as string set AppleScript's text item delimiters to "" return this_text end replace_chars set toreplace to "{query}" set thecontent to replace_chars(toreplace, "'", "`") set queri to (do shell script "php -r 'echo urlencode(\"" & thecontent & "\");'") set theWeb to "bear://x-callback-url/add-text?text=*" & theDate & " @ " & newTime & "*\n\n" & queri & "\n\n---\n&id=DA084FAD-86A9-42C9-A691-0564B76DADE3-44713-0001D35A1A8F960C&open_note=no&new_window=no&show_window=no&mode=prepend&edit=no" set bearUrl to replace_chars(theWeb, "+", " ") return bearUrl
×
×
  • Create New...