Compare commits
2 Commits
19d9d4d9a9
...
d8e0446f40
Author | SHA1 | Date |
---|---|---|
Fierelier | d8e0446f40 | |
Fierelier | d3718bb297 |
|
@ -8,3 +8,5 @@ Usage:
|
|||
* Put your OpenAI API key into the environment variable OPENAI_API_KEY or the file $USER/.config/me.fier.simpleGPT/api_key.txt (Linux) / %appdata%\me.fier.simpleGPT/api_key.txt (Windows)
|
||||
|
||||
Syntax: ./simpleGPT <text editor> <topic>
|
||||
|
||||
(I use nano, you best use some editor that opens a process per file)
|
||||
|
|
|
@ -49,7 +49,7 @@ def convertHumanReadableToList(txt):
|
|||
lst.append(message)
|
||||
return lst
|
||||
|
||||
userFile = os.path.join(userDir,"conversations",sys.argv[1] + ".txt")
|
||||
userFile = os.path.join(userDir,"conversations",sys.argv[2] + ".txt")
|
||||
userFileTmp = userFile + ".tmp"
|
||||
if not os.path.isfile(userFile):
|
||||
lst = []
|
||||
|
@ -58,7 +58,7 @@ if not os.path.isfile(userFile):
|
|||
open(userFile,"w",encoding="utf-8").write(convertListToHumanReadable(lst).strip(" \t\r\n") + "\n")
|
||||
|
||||
while True:
|
||||
subprocess.Popen([sys.argv[2],userFile]).wait()
|
||||
subprocess.Popen([sys.argv[1],userFile]).wait()
|
||||
lst = convertHumanReadableToList(open(userFile,"r",encoding="utf8").read())
|
||||
if lst[-1]["role"] != "user" or lst[-1]["content"].strip(" \t\r\n") == "": sys.exit(0)
|
||||
print("Awaiting response ...")
|
||||
|
|
Loading…
Reference in New Issue