Skip to content

[usage] add self-host detailed README - #189

Merged
JaredforReal merged 2 commits into
mainfrom
readme
Apr 8, 2026
Merged

[usage] add self-host detailed README#189
JaredforReal merged 2 commits into
mainfrom
readme

Conversation

@JaredforReal

Copy link
Copy Markdown
Collaborator

Contribution Guide

We welcome your contributions to this repository. To ensure elegant code style and better code quality, we have prepared
the following contribution guidelines.

What We Accept

  • This PR fixes a typo or improves the documentation (if this is the case, you may skip the other checks).
  • This PR fixes a specific issue — please reference the issue number in the PR description. Make sure your code strictly
    follows the coding standards below.
  • This PR introduces a new feature — please clearly explain the necessity and implementation of the feature. Make sure
    your code strictly follows the coding standards below.

Code Style Guide

Good code style is an art. We have prepared a pre-commit hook to enforce consistent code
formatting across the project. You can clean up your code following the steps below:

pre-commit run --all-files

If your code complies with the standards, you should not see any errors.

Naming Conventions

  • Please use English for naming; do not use Pinyin or other languages. All comments should also be in English.
  • Follow PEP8 naming conventions strictly, and use underscores to separate words. Avoid meaningless names such as
    a, b, c.

Signed-off-by: JaredforReal <w13431838023@gmail.com>
Copilot AI review requested due to automatic review settings April 8, 2026 07:00
Signed-off-by: JaredforReal <w13431838023@gmail.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds documentation for a “split deployment” mode where a GPU-hosted glmocr Flask server runs the full OCR pipeline and GPU-less clients call it via the MaaS-compatible protocol.

Changes:

  • Document a new “SDK Server + Client (GPU-less Client)” deployment option in both English and Chinese READMEs.
  • Add a new detailed guide at examples/self-host/README.md describing server/client setup and protocol compatibility.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 6 comments.

File Description
README.md Adds Option 4 pointing users to the self-host server+client guide and a client-side pipeline.maas config example.
README_zh.md Chinese equivalent of the new Option 4 documentation and link to the guide.
examples/self-host/README.md New end-to-end self-host guide (architecture, server install/run, client config, protocol/response fields).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread README.md
Comment on lines +171 to +180
Deploy the SDK Server on a GPU machine, then use any machine as a client — no GPU needed on the client side. The client connects via the MaaS-compatible protocol, pointing `api_url` at your self-hosted server.

```yaml
# Client config.yaml
pipeline:
maas:
enabled: true
api_url: http://<SERVER_IP>:5002/glmocr/parse
api_key: any-string # self-hosted server does not validate keys
verify_ssl: false

Copilot AI Apr 8, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The snippet explicitly notes the self-hosted server does not validate API keys, which means the endpoint is unauthenticated by default. Please add a clear warning not to expose this server publicly, and recommend putting it behind network controls (firewall/VPC) and/or a reverse proxy providing TLS + auth if used outside a trusted network.

Copilot uses AI. Check for mistakes.
Comment thread README.md
Comment on lines +169 to +171
#### Option 4: SDK Server + Client (GPU-less Client)

Deploy the SDK Server on a GPU machine, then use any machine as a client — no GPU needed on the client side. The client connects via the MaaS-compatible protocol, pointing `api_url` at your self-hosted server.

Copilot AI Apr 8, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR description currently contains a generic contribution guide template and doesn’t describe the self-hosted README additions. Please update the PR description to match the actual change (adding a self-hosted SDK server/client guide) so reviewers and release notes consumers have accurate context.

Copilot uses AI. Check for mistakes.
Comment thread README_zh.md
Comment on lines +169 to +178
在 GPU 机器上部署 SDK Server,其他机器作为 Client 通过网络调用——Client 端无需 GPU。Client 通过 MaaS 兼容协议连接,将 `api_url` 指向自建 Server 即可。

```yaml
# Client 端 config.yaml
pipeline:
maas:
enabled: true
api_url: http://<SERVER_IP>:5002/glmocr/parse
api_key: any-string # 自建 Server 不校验 API key
verify_ssl: false

Copilot AI Apr 8, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里提到自建 Server 不校验 API key,意味着该服务默认无鉴权。建议补充明确的安全提示:不要将该服务直接暴露到公网;如需跨网络使用,请通过防火墙/VPC 或反向代理提供 TLS 与鉴权(例如 Basic Auth / Token / mTLS)。

Copilot uses AI. Check for mistakes.
# CLI
glmocr parse document.png --config config.yaml

# Or set via environment variable

Copilot AI Apr 8, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The “Or set via environment variable” example only sets ZHIPU_API_KEY and then runs glmocr parse without --config. Without also overriding the MaaS api_url (e.g., via GLMOCR_API_URL or a config file), the CLI will use the packaged default cloud endpoint instead of the self-hosted server. Update this section to either keep using --config config.yaml or show the necessary env vars to point pipeline.maas.api_url at the self-hosted server.

Suggested change
# Or set via environment variable
# Or set via environment variables
export GLMOCR_API_URL=http://<SERVER_IP>:5002/glmocr/parse

Copilot uses AI. Check for mistakes.
enabled: true
api_url: http://<SERVER_IP>:<SERVER_PORT>/glmocr/parse
api_key: any-string # Self-hosted server does not validate API keys
verify_ssl: false # Internal networks typically lack HTTPS

Copilot AI Apr 8, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

verify_ssl: false disables TLS certificate verification when using HTTPS. Consider rewording the comment to clarify it’s only needed for self-signed/internal HTTPS; if you’re using plain http:// it has no effect, and if you’re using proper HTTPS it should remain true.

Suggested change
verify_ssl: false # Internal networks typically lack HTTPS
verify_ssl: false # Only relevant for https:// URLs; no effect with http://. Use false only for self-signed/internal HTTPS, otherwise keep true.

Copilot uses AI. Check for mistakes.
Comment on lines +50 to +52
api_key: any-string # Self-hosted server does not validate API keys
verify_ssl: false # Internal networks typically lack HTTPS
```

Copilot AI Apr 8, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This guide notes the server doesn’t validate API keys, but it should also include an explicit warning about the security implications (no auth by default) and recommend running it only on trusted networks or behind a reverse proxy with TLS/auth when used beyond localhost.

Copilot uses AI. Check for mistakes.
@JaredforReal
JaredforReal merged commit 0ff54de into main Apr 8, 2026
2 checks passed
@JaredforReal
JaredforReal deleted the readme branch April 16, 2026 03:28
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 this pull request may close these issues.

3 participants