Remove textsynth from annna. - annna - Annna the nice friendly bot. | |
git clone git://bitreich.org/annna/ git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfrinws6… | |
Log | |
Files | |
Refs | |
Tags | |
README | |
--- | |
commit 8ee15ea1224832ea174329af94c40c2be436698e | |
parent a5810c4d040c8322e29744003973c17cb0f8589e | |
Author: Annna Robert-Houdin <[email protected]> | |
Date: Sun, 30 Jul 2023 20:12:18 +0200 | |
Remove textsynth from annna. | |
Only binary stuff under non-free licenses. | |
Diffstat: | |
M annna-message-common | 22 ---------------------- | |
D textsynth-complete | 70 -----------------------------… | |
2 files changed, 0 insertions(+), 92 deletions(-) | |
--- | |
diff --git a/annna-message-common b/annna-message-common | |
@@ -506,28 +506,6 @@ case "${text}" in | |
# Emulate https://threats.kaspersky.com/en/threat/IRC-Worm.DOS.Septic/ | |
annna-say -s "${server}" -c "${channel}" "${user}, Your word is my com… | |
;; | |
-"${ircuser}, textsynth is "*) | |
- word="$(printf "%s\n" "${text}" | cut -c 21- | sed 's,\t, ,g')" | |
- case "$word" in | |
- *\?) | |
- word="$(printf "%s\n" "${word}" | cut -c -"$(($(expr length "$… | |
- ;; | |
- esac | |
- | |
- annna-say -s "${server}" -c "${channel}" "textsynth does not work, bec… | |
- # Do in background, because read is very slow. | |
- #{ | |
- # dresult="$(textsynth-complete -r "${word}")" | |
- # if [ -n "${dresult}" ]; | |
- # then | |
- # puri="$(printf "%s" "${dresult}" | /br/bin/bitreich-p… | |
- # else | |
- # puri="Textsynth did not answer." | |
- # fi | |
- # annna-say -s "${server}" -c "${channel}" "textsynth result: $… | |
- #} & | |
- | |
- ;; | |
"${ircuser}, weather at "*) | |
{ | |
weatherplace="$(printf "%s\n" "${text}" \ | |
diff --git a/textsynth-complete b/textsynth-complete | |
@@ -1,70 +0,0 @@ | |
-#!/usr/bin/env python | |
-# coding=utf-8 | |
-# | |
-# Copy me if you can. | |
-# by 20h | |
-# | |
- | |
-# Does not work anymore. Mr. Bellard made a company out of it. | |
- | |
-import os | |
-import sys | |
-import getopt | |
-import websocket | |
-import time | |
- | |
-def usage(app): | |
- app = os.path.basename(app) | |
- print("usage: %s [-hr] [-b base] text to complete..." % (app), | |
- file=sys.stderr) | |
- sys.exit(1) | |
- | |
-def main(args): | |
- try: | |
- opts, largs = getopt.getopt(args[1:], "hb:r") | |
- except getopt.GetoptError as err: | |
- print(str(err)) | |
- usage(args[0]) | |
- | |
- onlyresult = False | |
- | |
- baseuri = "wss://bellard.org/textsynth/ws" | |
- for o, a in opts: | |
- if o == "-h": | |
- usage(args[0]) | |
- elif o == "-r": | |
- onlyresult = True | |
- else: | |
- assert False, "unhandled option" | |
- | |
- if len(largs) < 1: | |
- usage(args[0]) | |
- txtstr = " ".join(largs) | |
- timenow = time.time() * 1000 | |
- timenowint = round(timenow) | |
- seed = (timenowint | 0) + (round(timenow / 4294967296) | 0) | |
- reqstr = "g,gpt2_1558M,40,0.9,1,%d,%s" % (seed, txtstr) | |
- | |
- try: | |
- ws = websocket.WebSocket() | |
- ws.connect(baseuri) | |
- ws.send(reqstr) | |
- | |
- rstr = "" | |
- while 1: | |
- r = ws.recv() | |
- if onlyresult == False: | |
- print(r) | |
- if len(r) == 0: | |
- break | |
- rstr += r | |
- except: | |
- return 1 | |
- | |
- print("%s%s\n" % (txtstr, rstr)) | |
- | |
- return 0 | |
- | |
-if __name__ == "__main__": | |
- sys.exit(main(sys.argv)) | |
- |