Skip to content

Instantly share code, notes, and snippets.

@Ceesaxp
Forked from umputun/safari-summary.sh
Created April 17, 2024 19:23
Show Gist options
  • Select an option

  • Save Ceesaxp/12693f4b3ee79ddfa94ca28522f25fb5 to your computer and use it in GitHub Desktop.

Select an option

Save Ceesaxp/12693f4b3ee79ddfa94ca28522f25fb5 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