Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

error:code #61

Open
shanshen123654789 opened this issue Oct 7, 2024 · 10 comments · May be fixed by #62
Open

error:code #61

shanshen123654789 opened this issue Oct 7, 2024 · 10 comments · May be fixed by #62
Assignees

Comments

@shanshen123654789
Copy link

shanshen123654789 commented Oct 7, 2024

we absolutly downloaded the library foliowing the guidenance ,when we run the code of manubot-ai-editor,the error indicated 'gbk'codec can't decode byte xb9 in position 949: illegal multibyte sequence
error
a5df59d3dd8fdbb183336c9b9703645

@miltondp
Copy link
Collaborator

miltondp commented Oct 7, 2024

Hi @shanshen123654789. Thanks for reporting this. Could you please provide the files you are revising with the editor so we can reproduce the error?

@falquaddoomi falquaddoomi self-assigned this Oct 7, 2024
@cgreene
Copy link
Contributor

cgreene commented Oct 7, 2024

@shanshen123654789 : I strongly recommend you invalidate the API keys in your screenshots if you haven't already.

@falquaddoomi
Copy link
Collaborator

falquaddoomi commented Oct 7, 2024

@shanshen123654789 Thanks for the bug report! @cgreene has a good point; I'd invalidate that API key ASAP. If you're looking for the correct place to put it, you should create a file called .env in the repo root containing the following text:

OPENAI_API_KEY="your key here"

This will allow the library to use your API key, and since the .env file is listed in the project's .gitignore file, you won't run the risk of accidentally committing it, either.

UPDATE: actually, sorry, the library doesn't currently automatically load .env files. I'd still suggest putting your API key in there for when the library eventually does. For now you can run export OPENAI_API_KEY="your key here" before invoking the tool to add your key to the environment.

Regarding your encoding issue, I'm looking into it now. As @miltondp suggested, if you could provide your input files it'd be helpful.

@shanshen123654789
Copy link
Author

Hi @shanshen123654789. Thanks for reporting this. Could you please provide the files you are revising with the editor so we can reproduce the error?

Thank you for your prompt strongly,I have revised my screenshots and the API is hidden.

@shanshen123654789
Copy link
Author

@shanshen123654789 Thanks for the bug report! @cgreene has a good point; I'd invalidate that API key ASAP. If you're looking for the correct place to put it, you should create a file called .env in the repo root containing the following text:

OPENAI_API_KEY="your key here"

This will allow the library to use your API key, and since the .env file is listed in the project's .gitignore file, you won't run the risk of accidentally committing it, either.

UPDATE: actually, sorry, the library doesn't currently automatically load .env files. I'd still suggest putting your API key in there for when the library eventually does. For now you can run export OPENAI_API_KEY="your key here" before invoking the tool to add your key to the environment.

Regarding your encoding issue, I'm looking into it now. As @miltondp suggested, if you could provide your input files it'd be helpful.

Thank you very much for your reminder. I have hidden the API key to avoid privacy leakage. I will pay attention next time.

@shanshen123654789
Copy link
Author

Hi @shanshen123654789. Thanks for reporting this. Could you please provide the files you are revising with the editor so we can reproduce the error?

We followed your instructions and installed the Pandoc and Manubot libraries in the conda environment, and downloaded them from the website https://github.com/manubot/manubot-ai-editor and https://github.com/manubot/rootstock We found a code issue with all the files in ceshi.py when running it, which should be a compilation problem

cdb20fa17b5cbe7f3e81ffa2f0e511d abc9fc9da3d49371bf1e385108098f6 fbdbe85147e4f4284d7aa8dd95727ec

The content of ceshi.by is as follows:
`import shutil
import os
from pathlib import Path

from manubot_ai_editor.editor import ManuscriptEditor
from manubot_ai_editor.models import GPT3CompletionModel

os.environ["OPENAI_API_KEY"] = ""

me = ManuscriptEditor(
content_dir="content",
config_dir="ci"
)

model = GPT3CompletionModel(
title="AI在医疗领域的应用",
keywords="人工智能, 医疗诊断, 机器学习",
openai_api_key="",
model_engine="gpt-4"
)

output_folder = (Path("tmp") / "manubot-ai-editor-output").resolve()
shutil.rmtree(output_folder, ignore_errors=True)
output_folder.mkdir(parents=True, exist_ok=True)

me.revise_manuscript(output_folder, model,debug=True)

print(f"修订后的手稿已保存在: {output_folder}")`

@falquaddoomi
Copy link
Collaborator

Hey @shanshen123654789, thank you for providing the code you're using to invoke our library. I assume that ceshi.py is just what you chose to call the script you're using to invoke Manubot AI Editor, since I don't think we have a file called that in the library.

Also, I believe what @miltondp was asking for are your input markdown files, since those are what appear to be causing a decoding issue in the library. If you're unable to provide those files, no worries, but it'd help to be sure we've fixed the issue you're experiencing. Even just one GBK-encoded file that contains Chinese characters (what I assume is causing the problem in our library) would be helpful.

@shanshen123654789
Copy link
Author

shanshen123654789 commented Oct 9, 2024

Hey @shanshen123654789, thank you for providing the code you're using to invoke our library. I assume that ceshi.py is just what you chose to call the script you're using to invoke Manubot AI Editor, since I don't think we have a file called that in the library.

Also, I believe what @miltondp was asking for are your input markdown files, since those are what appear to be causing a decoding issue in the library. If you're unable to provide those files, no worries, but it'd help to be sure we've fixed the issue you're experiencing. Even just one GBK-encoded file that contains Chinese characters (what I assume is causing the problem in our library) would be helpful.

415ee934da7e7c24583be0d6dba1ca7

Thank you very much for your patient response. The file test.py is the execution script in my PyCharm project, and its content is identical to everything found under the "Example usage" section in the website https://github.com/manubot/manubot-ai-editor. Similarly, the file I used for content is also a Markdown file, as I converted my manuscript into Markdown format.

@miltondp
Copy link
Collaborator

miltondp commented Oct 9, 2024

Hi @shanshen123654789. Thanks. Would it be possible to share the content of your file example.md?

@falquaddoomi falquaddoomi linked a pull request Oct 9, 2024 that will close this issue
@shanshen123654789
Copy link
Author

Hi @shanshen123654789. Thanks. Would it be possible to share the content of your file example.md?

Hi, there might have been errors previously due to encoding issues, but we have already made adjustments based on Faisal Alquaddoomi's suggestions. I would like to ask about the editing process: should we perform the editing on a single file (e.g., exemple.md) in the content directory, or on multiple parts such as abstract.md, introduction.md, and result.md? Currently, if we want to perform editing, can we only modify the settings for our manuscript in the ai-revision-prompts.yaml file?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants