View Single Post
Old 06-22-2023, 08:26 AM   #6
cdhigh
Enthusiast
cdhigh ought to be getting tired of karma fortunes by now.cdhigh ought to be getting tired of karma fortunes by now.cdhigh ought to be getting tired of karma fortunes by now.cdhigh ought to be getting tired of karma fortunes by now.cdhigh ought to be getting tired of karma fortunes by now.cdhigh ought to be getting tired of karma fortunes by now.cdhigh ought to be getting tired of karma fortunes by now.cdhigh ought to be getting tired of karma fortunes by now.cdhigh ought to be getting tired of karma fortunes by now.cdhigh ought to be getting tired of karma fortunes by now.cdhigh ought to be getting tired of karma fortunes by now.
 
Posts: 41
Karma: 333334
Join Date: Oct 2011
Device: KINDLE 3
Quote:
Originally Posted by luketheduke View Post
Bash-gpt looks like an ideal solution. Needs `jq` to parse JSON, though.

You'd either have to:
  1. Cross-compile `jq` for the Kindle.
  2. Modify the script to use regex or something.
Thank you very much.
It took me a long time to response, but I finally replaced my non-jailbroken Kindle8 with a jailbreakable PW2.
When I tried this solution, I encountered some issues.
Here's steps:
1. Jailbreak
2. Installing KUAL, Usbnetwork, kterm
3. Download bash-gpt, execute and encountered an error in kterm:
line 137: syntax error: bad substitution
4. Then, I did some more searching and found another script called ai-bash-gpt, but it still has same error:
line 103: syntax error: unexpected redirection

I have no knowledge of Linux and Bash, so I have no idea how to fix it.

edited:
some code lines around line137 in bash-gpt:
Code:
133 bash_gpt_save_message() {
134     role="$1"
135     shift
136     content=$(echo "$@" | tr -d '\n')
137     content="${content@Q}"
138     content=$(echo "${content:1:-1}" | jq -R -s '.') # | sed 's/[$`]/\\&/g')
139     filepath=$(bash_gpt_subject_file $BASH_GPT_SUBJECT)
140     echo "{\"role\": \"$role\", \"content\": ${content}}" >> "$filepath"
141 }
some code line around line103 in ai-bash-gpt:
Code:
103  input=$(jq ".[-$CONVERSATION_BUFFER_LEN:]" <<<"$@")
104  while true; do
105    msg_buf_size=$(wc -c <<<"$input" | numfmt --to=iec)

Last edited by cdhigh; 06-22-2023 at 08:34 AM.
cdhigh is offline   Reply With Quote