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

docs: ✨ doc update #661

Draft
wants to merge 12 commits into
base: main
Choose a base branch
from
4 changes: 3 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ WORKDIR /app
EXPOSE 7860

ENV PYTHONUNBUFFERED=1
ENV NOTO_FONT_PATH=/app
ENV DOCKER_CONFIG=1

# Download all required fonts
ADD "https://github.com/satbyy/go-noto-universal/releases/download/v7.0/GoNotoKurrent-Regular.ttf" /app/
Expand All @@ -26,4 +28,4 @@ COPY . .

RUN uv pip install --system --no-cache .

CMD ["pdf2zh", "-i"]
CMD ["pdf2zh", "--config", "/app/config.json", "-i"]
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,8 @@ For docker deployment on cloud service:
<img src="https://www.koyeb.com/static/images/deploy/button.svg" alt="Deploy to Koyeb" height="26"></a>
</div>

Docker supports custom config. More info can find [here](./docs/ADVANCED.md)

</details>

<details>
Expand Down
2 changes: 2 additions & 0 deletions docs/ADVANCED.md
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,8 @@ example config.json

By default, the config file is saved in the `~/.config/PDFMathTranslate/config.json`. The program will start by reading the contents of config.json, and after that it will read the contents of the environment variables. When an environment variable is available, the contents of the environment variable are used first and the file is updated.

For Docker users, custom config file is also available. You can mount you config file with `/app/config.json` in the container. If you don't mount, everything works fine. PDFMathTranslate will create by itself. The config file will saved in `/app/PDFMathTranslate/config.json` in the container.

[⬆️ Back to top](#toc)

---
Expand Down
10 changes: 9 additions & 1 deletion docs/APIS.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,14 @@ In a more flexible way, you can communicate with the program using HTTP protocol
- Submit translate task

```bash
curl http://localhost:11008/v1/translate -F "[email protected]" -F "data={\"lang_in\":\"en\",\"lang_out\":\"zh\",\"service\":\"google\",\"thread\":4}"
curl http://localhost:11008/v1/translate -F "[email protected]" -F 'data={"lang_in":"en","lang_out":"zh","service":"google","thread":4}'
{"id":"d9894125-2f4e-45ea-9d93-1a9068d2045a"}
```

- Submit translate task with custom prompt

```bash
curl http://localhost:11008/v1/translate -F "[email protected]" -F 'data={"lang_in":"zh","lang_out":"zh","service":"google","thread":4,"prompt":"You are a professional, authentic machine translation engine. 如果目标语言为中文,你需要翻译成文言文。 Translate the following markdown source text to ${lang_out}. Keep the formula notation {{v*}} unchanged. Output translation directly without any additional text.\nSource Text: ${text}\nTranslated Text:"}'
{"id":"d9894125-2f4e-45ea-9d93-1a9068d2045a"}
```

Expand Down Expand Up @@ -92,4 +99,5 @@ In a more flexible way, you can communicate with the program using HTTP protocol

[⬆️ Back to top](#toc)


---
Loading
Loading