-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathai-english-teacher.sh
More file actions
executable file
·33 lines (28 loc) · 1.06 KB
/
ai-english-teacher.sh
File metadata and controls
executable file
·33 lines (28 loc) · 1.06 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#!/usr/bin/env bash
# -*- coding: UTF-8 -*-
## This script acts as an AI English teacher, processing text from the clipboard to provide feedback.
set -x
SUBMITTED=$(wl-paste)
OUTFILE=/tmp/english-teacher.md
# Redirect to a file, so that I can run the script in background and read the result asynchronously
{
echo "$SUBMITTED"
echo "---"
} > "$OUTFILE"
notify-send --app-name "AI English Editor" "Reviewing: $SUBMITTED"
$HOME/workspace/toolbelt/gm "You are an English teacher and editor. Grade the message after the triple dashes (---) and provide 2 new versions improving english form and clarity --- $SUBMITTED" >> "$OUTFILE"
ACTION_CHOICE=$(notify-send "English Editor is ready" "Open the file?" \
--expire-time=30000 \
--action="yes=Yes" \
--action="no=No" \
--wait)
# The variable $ACTION_CHOICE now holds the NAME of the button clicked ('yes' or 'no').
# We use a case statement to react to the choice.
case "$ACTION_CHOICE" in
"yes")
xdg-open "$OUTFILE"
# Add your command to run for 'Yes' here
;;
*)
;;
esac