Skip to content

fix: update somark.tech to somark.cn/somark.ai with purchase URLs - #16892

Merged
JinHai-CN merged 3 commits into
infiniflow:mainfrom
maybehokori:fix/somark_url
Jul 16, 2026
Merged

JinHai-CN merged 3 commits into
infiniflow:mainfrom
maybehokori:fix/somark_url

Conversation

@maybehokori

Copy link
Copy Markdown
Contributor

Summary

Update all somark.tech references to somark.cn (default for China) / somark.ai (for overseas including Taiwan, China; Hong Kong, China; Macau, China). Users fill in base_url manually — default is somark.cn.

Changes

File Change
constants.py Default → somark.cn
somark_parser.py SAAS_BASE_URL + fallback → somark.cn
ocr_model.py Default → somark.cn
pdf_parser_common.go Go default → somark.cn
llm.ts API key URL → somark.cn
en.ts Base URL descriptions + purchase URLs
zh.ts Base URL descriptions + purchase URLs

Purchase URLs

  • China: https://somark.cn/workbench/purchase
  • Overseas: https://somark.ai/studio/purchase

justinychuang added 2 commits July 13, 2026 19:44
- SoMarkParser: add _REGION_BASE_URLS dict (china→somark.cn, overseas→somark.ai);
  base_url now defaults to empty and auto-resolves from region
- SoMarkOcrModel: resolve somark_region/SOMARK_REGION from config/env
- Update all somark.tech references to somark.cn (default) or somark.ai (overseas)
- Update locale base URL descriptions with both China and overseas endpoints
- Add purchaseUrl locale entries: somark.cn/workbench/purchase (China),
  somark.ai/studio/purchase (overseas including Taiwan, China; Hong Kong, China;
  Macau, China)
- Update Go pdf_parser_common.go default URL
- Update all somark.tech references to somark.cn (default) or somark.ai
- Add locale entries for both China and overseas base URLs
- Add purchaseUrl locale entries
- Update Go pdf_parser_common.go default URL
@dosubot dosubot Bot added the size:S This PR changes 10-29 lines, ignoring generated files. label Jul 14, 2026
@coderabbitai

coderabbitai Bot commented Jul 14, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 1a31f4ad-77d8-4720-bbcb-593e3d8a9245

📥 Commits

Reviewing files that changed from the base of the PR and between 0ed87b4 and 4e72f74.

📒 Files selected for processing (3)
  • common/constants.py
  • web/src/locales/en.ts
  • web/src/locales/zh.ts
🚧 Files skipped from review as they are similar to previous changes (3)
  • web/src/locales/zh.ts
  • common/constants.py
  • web/src/locales/en.ts

📝 Walkthrough

Walkthrough

SoMark default API endpoints are changed from somark.tech to somark.cn across backend and frontend configuration. Localized frontend guidance now distinguishes mainland China endpoints from somark.ai endpoints for other regions.

Changes

SoMark endpoint configuration

Layer / File(s) Summary
Backend SoMark defaults
common/constants.py, deepdoc/parser/somark_parser.py, internal/parser/parser/pdf_parser_common.go, rag/llm/ocr_model.py
Default SoMark API URLs now use https://somark.cn/api/v1 across configuration, parser, PDF parser, and OCR model fallbacks.
Frontend regional guidance
web/src/constants/llm.ts, web/src/locales/en.ts, web/src/locales/zh.ts
API-key links and localized Base URL and purchase guidance now distinguish mainland China from overseas regions.

Estimated code review effort: 2 (Simple) | ~10 minutes

Poem

I hopped through configs, fresh and bright,
Replacing old URLs in flight.
CN for home, AI afar,
Purchase links now know where they are.
“Sniff sniff,” said Bun, “that endpoint’s right!”

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: switching SoMark endpoints to regional domains and adding purchase URLs.
Description check ✅ Passed The description matches the template's Summary section and includes enough context plus a useful change breakdown.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot 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.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@deepdoc/parser/somark_parser.py`:
- Line 124: Update the endpoint classification used by check_installation() so
both https://somark.cn/api/v1 and https://somark.ai/api/v1 use the SaaS /usage
validation path, including API-key and quota checks. Treat the hosted endpoints
as equivalent SaaS URLs rather than sending somark.ai through the
private-deployment HEAD probe.

In `@web/src/constants/llm.ts`:
- Line 219: Update the SoMark entry in the LLM API-key URL mapping to derive its
link from the selected SoMark region or base-URL configuration rather than
hardcoding https://somark.cn/workbench/apikey. Reuse the existing region-aware
SoMark URL mechanism and preserve the /workbench/apikey path for each region.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 0a461b68-dff5-433c-8a33-d23478e01cd2

📥 Commits

Reviewing files that changed from the base of the PR and between 999eb53 and 0ed87b4.

📒 Files selected for processing (7)
  • common/constants.py
  • deepdoc/parser/somark_parser.py
  • internal/parser/parser/pdf_parser_common.go
  • rag/llm/ocr_model.py
  • web/src/constants/llm.ts
  • web/src/locales/en.ts
  • web/src/locales/zh.ts

# /usage quota check only works in SaaS; private deployments fall back
# to a generic HEAD health check.
SAAS_BASE_URL = "https://somark.tech/api/v1"
SAAS_BASE_URL = "https://somark.cn/api/v1"

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.

🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

printf '\n## File outline\n'
ast-grep outline deepdoc/parser/somark_parser.py --view expanded || true

printf '\n## Relevant line ranges\n'
sed -n '100,170p' deepdoc/parser/somark_parser.py
printf '\n---\n'
sed -n '720,780p' deepdoc/parser/somark_parser.py

printf '\n## Endpoint references\n'
rg -n "somark\.(ai|cn)|check_installation|SAAS_BASE_URL" deepdoc -S

Repository: infiniflow/ragflow

Length of output: 8687


🏁 Script executed:

#!/bin/bash
set -euo pipefail

printf '\n## check_installation implementation\n'
sed -n '190,215p' deepdoc/parser/somark_parser.py

printf '\n## somark.ai references in repo\n'
rg -n "somark\.ai" -S .

printf '\n## SOMARK_BASE_URL references\n'
rg -n "SOMARK_BASE_URL|somark\.cn|somark\.ai" -S deepdoc README* docs* .github* 2>/dev/null || true

Repository: infiniflow/ragflow

Length of output: 2697


🌐 Web query:

Somark API hosted endpoint somark.ai somark.cn documentation

💡 Result:

SoMark is a document intelligence platform that transforms unstructured documents like PDFs, scans, tables, and formulas into structured data formats such as Markdown and JSON for use in RAG (Retrieval-Augmented Generation) and AI agents [1][2]. The official documentation for the SoMark API is hosted at docs.somark.ai and docs.somark.tech [3][4]. Key API details: Base URL: https://somark.ai/api/v1 (or https://somark.tech/api/v1) [3][4] Authentication: API requests require an api_key passed in the request body, formatted as sk-* [3][4]. Primary Endpoints: - Sync parsing: POST /parse/sync (for immediate results) [3][4] - Async parsing: POST /parse/async (to submit tasks) and POST /parse/async_check (to poll results using task_id) [3][4] - Usage query: POST /usage (to check quota and account info) [3][4] Migration Notice: Previous endpoint paths (e.g., /extract/) have been migrated to /parse/. The older paths will be discontinued on December 31, 2026 [3][4]. Regarding somark.cn: While some internal or testing documentation may exist on subdomains associated with soulcode.cn (such as docs.somark-sit.soulcode.cn), official documentation and service access are centralized under somark.ai and somark.tech [3][4][5]. Users are advised to rely on the official documentation at docs.somark.ai [4].

Citations:


Recognize both hosted SaaS endpoints. check_installation() only routes https://somark.cn/api/v1 through the SaaS /usage check, so the hosted https://somark.ai/api/v1 path falls back to the private-deployment HEAD probe and skips API-key/quota validation. Treat hosted URLs as a set, or classify them by host/region.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@deepdoc/parser/somark_parser.py` at line 124, Update the endpoint
classification used by check_installation() so both https://somark.cn/api/v1 and
https://somark.ai/api/v1 use the SaaS /usage validation path, including API-key
and quota checks. Treat the hosted endpoints as equivalent SaaS URLs rather than
sending somark.ai through the private-deployment HEAD probe.

Comment thread web/src/constants/llm.ts
[LLMFactory.DeepInfra]: 'https://deepinfra.com/dash/api_keys',
[LLMFactory.PaddleOCR]: 'https://www.paddleocr.ai/latest/',
[LLMFactory.SoMark]: 'https://somark.tech/workbench/apikey',
[LLMFactory.SoMark]: 'https://somark.cn/workbench/apikey',

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.

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

# Inspect the relevant constant and nearby context.
sed -n '180,250p' web/src/constants/llm.ts

# Inspect the locale text that references somark.ai.
rg -n "somark\.ai|somark\.cn|API-key|apikey|region" web/src/locales/en.ts web/src/constants/llm.ts web/src -g '!**/dist/**' -g '!**/build/**'

# Find the region/base-url selection logic used by the app.
rg -n "region.*base url|base url.*region|somark.*region|LLMFactory\.SoMark|workbench/apikey|api[- ]?key" web/src -g '!**/dist/**' -g '!**/build/**'

Repository: infiniflow/ragflow

Length of output: 18729


🏁 Script executed:

#!/bin/bash
set -euo pipefail

# Map the structure of the llm constants file.
ast-grep outline web/src/constants/llm.ts --view expanded

# Read the top and surrounding provider/link definitions.
sed -n '1,180p' web/src/constants/llm.ts

# Find all references to the SoMark constant and the API-key URL map.
rg -n "LLMFactory\.SoMark|API_KEY|api[- ]?key|apikey" web/src -g '!**/dist/**' -g '!**/build/**'

# Inspect the component(s) that consume the provider icon/list entries if they expose links.
sed -n '1,220p' web/src/components/svg-icon.tsx

Repository: infiniflow/ragflow

Length of output: 18135


🏁 Script executed:

#!/bin/bash
set -euo pipefail

# Inspect provider config for SoMark and any region-aware URL selection.
rg -n "somark\.ai/api/v1|somark\.cn/api/v1|workbench/purchase|workbench/apikey|SoMark|base_url|regionKey|region" \
  web/src/pages/user-setting/setting-model -g '!**/dist/**' -g '!**/build/**'

# Read the generic API-key config and provider config map around SoMark-related entries.
sed -n '1,260p' web/src/pages/user-setting/setting-model/provider-schema/field-config/generic-api-key-config.ts
sed -n '1,260p' web/src/pages/user-setting/setting-model/provider-schema/field-config/provider-config-map.ts

# Inspect how APIMapUrl is consumed.
rg -n "APIMapUrl\[" web/src -g '!**/dist/**' -g '!**/build/**'

Repository: infiniflow/ragflow

Length of output: 29187


Make the SoMark API-key link region-aware. web/src/constants/llm.ts:219 still hardcodes https://somark.cn/workbench/apikey; use the selected SoMark region/base URL here instead of a single constant so overseas users aren’t sent to the mainland-China portal.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@web/src/constants/llm.ts` at line 219, Update the SoMark entry in the LLM
API-key URL mapping to derive its link from the selected SoMark region or
base-URL configuration rather than hardcoding
https://somark.cn/workbench/apikey. Reuse the existing region-aware SoMark URL
mechanism and preserve the /workbench/apikey path for each region.

@JinHai-CN JinHai-CN added the ci Continue Integration label Jul 15, 2026
@codecov

codecov Bot commented Jul 15, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.16%. Comparing base (5cf95d2) to head (4e72f74).
⚠️ Report is 14 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #16892      +/-   ##
==========================================
- Coverage   94.56%   93.16%   -1.40%     
==========================================
  Files          10       10              
  Lines         717      717              
  Branches      118      118              
==========================================
- Hits          678      668      -10     
- Misses         25       29       +4     
- Partials       14       20       +6     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@JinHai-CN
JinHai-CN merged commit f3a2fb7 into infiniflow:main Jul 16, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci Continue Integration size:S This PR changes 10-29 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants