Skip to content

Instantly share code, notes, and snippets.

@umputun
Last active April 29, 2024 14:42
Show Gist options
  • Star 20 You must be signed in to star a gist
  • Fork 4 You must be signed in to fork a gist
  • Save umputun/151063e94a55fcf0ff67ae4c75ee871f to your computer and use it in GitHub Desktop.
Save umputun/151063e94a55fcf0ff67ae4c75ee871f to your computer and use it in GitHub Desktop.
Raycast script for Safari's page summary
#!/bin/sh
# @raycast.schemaVersion 1
# @raycast.title Summarize Safari page
# @raycast.mode fullOutput
#
# Optional parameters:
# @raycast.icon ✨
#
# @raycast.packageName Things
set -e
content=$(osascript -e '
tell application "Safari"
set theText to text of front document
end tell
')
echo "$content" | OPENAI_OMIT_HISTORY=true OPENAI_API_KEY=sk-хххххх chatgpt "Please summarize the main points in a few sentences. Then, list up to five detailed bullet points. Provide the response in plain text. Finally, include a sentiment analysis of the text. Do not add any additional information."
# requires chatgpt-cli installed, see https://github.com/kardolus/chatgpt-cli.
# requires OPENAI_API_KEY
# to change the model use `chatgpt --set-model=<model>`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment