Closed egor83 closed 4 months ago
This issue might be related to commit d1100e0af844b6018455f7ee94a5c459ac946288 in PR #7. @sg00, could you explain the bug you fixed in the file path? I believe copyFileIfNotExists
should be called before reading the file.
When running the script from the working dir copyFileIfNotExists
had the effect of permanently caching the initial version of the system prompt, so that any updates were silently ignored. In a later commit a context
parameter was added that can be used to pass in supplementary context to the system prompt file, thereby essentially making the caching issue redundant. I will create a PR to revert the removal of the calls to copyFileIfNotExists
.
The issue should be fixed in version 1.1.1
.
FYI, gpt-po
checks the dictionary and prompt file in this order:
If none of these locations have the files, a default one will be copied to UserHome/.gpt-po/
.
CWD
refers to the current working directory when running the gpt-po
command.
Thanks for a quick fix! Much appreciated.
I first ran the command trying to translate the .po file as follows (*):
npx gpt-po -k GHATGPT_KEY --host CHATGPT_HOST --po django.po -l nl
It complained that it could not find system prompt, then dictionary files in
/home/user/.gpt-po/
. After I created them manually as empty files, it complained about JSON file being malformed. Once I added{}
to dictionary file, it produced the following:(which is a correct translation, BTW)
After I dug around the code and found system prompt template, copied it to my
/home/user/.gpt-po/systemprompt.txt
, it started working properly.My point here is, if these steps are necessary, it might be a good idea to mention them in readme - or was I doing something wrong? If it's indeed necessary, just let me know, I can add a section to readme. The ideal solution would be to automate creating/copying these files, but unfortunately I can't help you here since I'm not a Node dev. Also, I'm a bit surprised that it looked for config files in my home dir instead of a current dir, since #1 says it shouldn't be the case.
And thanks a lot for this project! It's very helpful.
(*) I also had to start gpt-po via npx; don't remember already what the exact error was, but it complained otherwise. I'm coming from Python background, and not very familiar with Node ecosystem, sorry if I'm missing something obvious.