diff --git a/examples/gitflic_ci/README.md b/examples/gitflic_ci/README.md index 9f36ce73..3d052b45 100644 --- a/examples/gitflic_ci/README.md +++ b/examples/gitflic_ci/README.md @@ -39,7 +39,7 @@ Go to **Settings → CI/CD → Variables** and add: | `OCR_LLM_URL` | Yes | LLM API endpoint URL | | `OCR_LLM_AUTH_TOKEN` | Yes | LLM API authentication token | | `GITFLIC_TOKEN` | Yes | GitFlic access token used to post discussions | -| `OCR_LLM_MODEL` | No | Model name (e.g., `gpt-4o`) | +| `OCR_LLM_MODEL` | Yes | Model name (e.g., `gpt-4o`) — OCR has no built-in default model and fails when this is unset | | `GITFLIC_API_URL` | No | REST API base URL for self-hosted GitFlic (default: `https://api.gitflic.ru`) | > **Note:** GitFlic CI/CD does not accept variables with values shorter than 8 characters, so `use_anthropic` cannot be set as a CI variable. The pipeline sets it to `false`; to use Anthropic Claude models, edit `gitflic-ci.yaml` directly. diff --git a/examples/gitlab_ci/.gitlab-ci.yml b/examples/gitlab_ci/.gitlab-ci.yml index e8c3f784..9b9d6f81 100644 --- a/examples/gitlab_ci/.gitlab-ci.yml +++ b/examples/gitlab_ci/.gitlab-ci.yml @@ -7,9 +7,10 @@ # Required CI/CD Variables (Settings → CI/CD → Variables): # OCR_LLM_URL - LLM API endpoint (e.g., https://api.openai.com/v1/chat/completions) # OCR_LLM_AUTH_TOKEN - Authentication token for the LLM API (mark as "Masked") +# OCR_LLM_MODEL - Model name (e.g., gpt-4o). OCR has no built-in default model; the +# pipeline fails fast if this is unset. # # Optional CI/CD Variables: -# OCR_LLM_MODEL - Model name (default: gpt-4o) # GITLAB_API_TOKEN - GitLab Personal/Project Access Token with "api" scope # (falls back to CI_JOB_TOKEN if not set) # @@ -48,12 +49,14 @@ code-review: - echo "OpenCodeReview installed with version:" && ocr version || true # Configure OCR - - mkdir -p ~/.open-code-review # Gitlab CI/CD does not support configuring variables with value length less than 8, so you can't set use_anthropic as a CI variable - | - ocr config set llm.url $OCR_LLM_URL - ocr config set llm.auth_token $OCR_LLM_AUTH_TOKEN - ocr config set llm.model $OCR_LLM_MODEL + : "${OCR_LLM_URL:?set OCR_LLM_URL in Settings -> CI/CD -> Variables}" + : "${OCR_LLM_AUTH_TOKEN:?set OCR_LLM_AUTH_TOKEN in Settings -> CI/CD -> Variables}" + : "${OCR_LLM_MODEL:?set OCR_LLM_MODEL in Settings -> CI/CD -> Variables}" + ocr config set llm.url "$OCR_LLM_URL" + ocr config set llm.auth_token "$OCR_LLM_AUTH_TOKEN" + ocr config set llm.model "$OCR_LLM_MODEL" ocr config set llm.use_anthropic false ocr config set llm.extra_body '{"thinking": {"type": "disabled"}}' diff --git a/examples/gitlab_ci/README.md b/examples/gitlab_ci/README.md index ab9461fa..70ac144a 100644 --- a/examples/gitlab_ci/README.md +++ b/examples/gitlab_ci/README.md @@ -38,7 +38,7 @@ Go to your project's **Settings → CI/CD → Variables** and add: |----------|----------|--------|-------------| | `OCR_LLM_URL` | Yes | No | LLM API endpoint URL (e.g., `https://api.openai.com/v1/chat/completions`) | | `OCR_LLM_AUTH_TOKEN` | Yes | Yes | API authentication token | -| `OCR_LLM_MODEL` | No | No | Model name (defaults to `gpt-4o`) | +| `OCR_LLM_MODEL` | Yes | No | Model name (e.g., `gpt-4o`) — OCR has no built-in default model and fails when this is unset | | `GITLAB_API_TOKEN` | No | Yes | GitLab access token with `api` scope (falls back to `CI_JOB_TOKEN` if not set) | > **Note:** GitLab CI/CD does not support variables with values shorter than 8 characters, so `use_anthropic` cannot be set as a CI variable. The pipeline sets it to `false` by default. If you need to use Anthropic Claude models, you'll need to modify the `.gitlab-ci.yml` script directly. @@ -145,11 +145,13 @@ script: - npm install -g @alibaba-group/open-code-review # Configure OCR - - mkdir -p ~/.open-code-review - | - ocr config set llm.url $OCR_LLM_URL - ocr config set llm.auth_token $OCR_LLM_AUTH_TOKEN - ocr config set llm.model $OCR_LLM_MODEL + : "${OCR_LLM_URL:?set OCR_LLM_URL in Settings -> CI/CD -> Variables}" + : "${OCR_LLM_AUTH_TOKEN:?set OCR_LLM_AUTH_TOKEN in Settings -> CI/CD -> Variables}" + : "${OCR_LLM_MODEL:?set OCR_LLM_MODEL in Settings -> CI/CD -> Variables}" + ocr config set llm.url "$OCR_LLM_URL" + ocr config set llm.auth_token "$OCR_LLM_AUTH_TOKEN" + ocr config set llm.model "$OCR_LLM_MODEL" ocr config set llm.use_anthropic false ocr config set llm.extra_body '{"thinking": {"type": "disabled"}}'