Commit 137455af8e6c4efe8d2cea544df7f298ac34d0ed
1 parent
2d17b98e
doc
Showing
3 changed files
with
26 additions
and
7 deletions
Show diff stats
docs/工作总结-微服务性能优化与架构.md
| @@ -154,7 +154,7 @@ instruction: "Given a shopping query, rank product titles by relevance" | @@ -154,7 +154,7 @@ instruction: "Given a shopping query, rank product titles by relevance" | ||
| 154 | 154 | ||
| 155 | ## 三、性能测试报告摘要 | 155 | ## 三、性能测试报告摘要 |
| 156 | 156 | ||
| 157 | -以下数据来自 `docs/性能测试报告.md`,测试时间 **2026-03-12**,环境:**8 vCPU**(Intel Xeon Platinum 8255C @ 2.50GHz)、**约 15Gi 可用内存**;租户 **162** 文档数约 **53**(search/suggest/rerank 与文档规模相关)。压测工具:`scripts/perf_api_benchmark.py`,场景×并发矩阵,每档 **20s**。 | 157 | +以下数据来自 `docs/性能测试报告.md`,测试时间 **2026-03-12**,环境:**8 vCPU**(Intel Xeon Platinum 8255C @ 2.50GHz)、**约 15Gi 可用内存**;租户 **162** 文档数约 **53**(search/search/suggestions/rerank 与文档规模相关)。压测工具:`scripts/perf_api_benchmark.py`,场景×并发矩阵,每档 **20s**。 |
| 158 | 158 | ||
| 159 | **复现命令(四场景×四并发)**: | 159 | **复现命令(四场景×四并发)**: |
| 160 | ```bash | 160 | ```bash |
docs/搜索API对接指南.md
| @@ -1808,7 +1808,7 @@ curl "http://localhost:6007/health" | @@ -1808,7 +1808,7 @@ curl "http://localhost:6007/health" | ||
| 1808 | 1808 | ||
| 1809 | 支持 Qwen(默认)与 DeepL 模型,适用于商品名称、描述等电商场景。 | 1809 | 支持 Qwen(默认)与 DeepL 模型,适用于商品名称、描述等电商场景。 |
| 1810 | 1810 | ||
| 1811 | -**请求体**: | 1811 | +**请求体**(支持单条字符串或字符串列表): |
| 1812 | ```json | 1812 | ```json |
| 1813 | { | 1813 | { |
| 1814 | "text": "商品名称", | 1814 | "text": "商品名称", |
| @@ -1819,9 +1819,20 @@ curl "http://localhost:6007/health" | @@ -1819,9 +1819,20 @@ curl "http://localhost:6007/health" | ||
| 1819 | } | 1819 | } |
| 1820 | ``` | 1820 | ``` |
| 1821 | 1821 | ||
| 1822 | +也支持批量列表形式: | ||
| 1823 | +```json | ||
| 1824 | +{ | ||
| 1825 | + "text": ["商品名称1", "商品名称2"], | ||
| 1826 | + "target_lang": "en", | ||
| 1827 | + "source_lang": "zh", | ||
| 1828 | + "model": "qwen", | ||
| 1829 | + "context": "sku_name" | ||
| 1830 | +} | ||
| 1831 | +``` | ||
| 1832 | + | ||
| 1822 | | 参数 | 类型 | 必填 | 说明 | | 1833 | | 参数 | 类型 | 必填 | 说明 | |
| 1823 | |------|------|------|------| | 1834 | |------|------|------|------| |
| 1824 | -| `text` | string | Y | 待翻译文本 | | 1835 | +| `text` | string \| string[] | Y | 待翻译文本,既支持单条字符串,也支持字符串列表(批量翻译) | |
| 1825 | | `target_lang` | string | Y | 目标语言:`zh`、`en`、`ru` 等 | | 1836 | | `target_lang` | string | Y | 目标语言:`zh`、`en`、`ru` 等 | |
| 1826 | | `source_lang` | string | N | 源语言,不传则自动检测 | | 1837 | | `source_lang` | string | N | 源语言,不传则自动检测 | |
| 1827 | | `model` | string | N | `qwen`(默认)、`deepl` 或 `llm` | | 1838 | | `model` | string | N | `qwen`(默认)、`deepl` 或 `llm` | |
| @@ -1839,6 +1850,18 @@ curl "http://localhost:6007/health" | @@ -1839,6 +1850,18 @@ curl "http://localhost:6007/health" | ||
| 1839 | } | 1850 | } |
| 1840 | ``` | 1851 | ``` |
| 1841 | 1852 | ||
| 1853 | +当请求为列表形式时,`text` 与 `translated_text` 均为等长数组: | ||
| 1854 | +```json | ||
| 1855 | +{ | ||
| 1856 | + "text": ["商品名称1", "商品名称2"], | ||
| 1857 | + "target_lang": "en", | ||
| 1858 | + "source_lang": "zh", | ||
| 1859 | + "translated_text": ["Product name 1", "Product name 2"], | ||
| 1860 | + "status": "success", | ||
| 1861 | + "model": "qwen" | ||
| 1862 | +} | ||
| 1863 | +``` | ||
| 1864 | + | ||
| 1842 | **完整 curl 示例**: | 1865 | **完整 curl 示例**: |
| 1843 | 1866 | ||
| 1844 | 中文 → 英文: | 1867 | 中文 → 英文: |
indexer/product_annotator.py
| @@ -33,10 +33,6 @@ MAX_RETRIES = 3 | @@ -33,10 +33,6 @@ MAX_RETRIES = 3 | ||
| 33 | RETRY_DELAY = 5 # 秒 | 33 | RETRY_DELAY = 5 # 秒 |
| 34 | REQUEST_TIMEOUT = 180 # 秒 | 34 | REQUEST_TIMEOUT = 180 # 秒 |
| 35 | 35 | ||
| 36 | -# 禁用代理 | ||
| 37 | -os.environ['NO_PROXY'] = '*' | ||
| 38 | -os.environ['no_proxy'] = '*' | ||
| 39 | - | ||
| 40 | # 文件路径 | 36 | # 文件路径 |
| 41 | INPUT_FILE = "saas_170_products.csv" | 37 | INPUT_FILE = "saas_170_products.csv" |
| 42 | OUTPUT_DIR = Path("output_logs") | 38 | OUTPUT_DIR = Path("output_logs") |