From 137455af8e6c4efe8d2cea544df7f298ac34d0ed Mon Sep 17 00:00:00 2001 From: tangwang Date: Mon, 16 Mar 2026 22:47:34 +0800 Subject: [PATCH] doc --- docs/工作总结-微服务性能优化与架构.md | 2 +- docs/搜索API对接指南.md | 27 +++++++++++++++++++++++++-- indexer/product_annotator.py | 4 ---- 3 files changed, 26 insertions(+), 7 deletions(-) diff --git a/docs/工作总结-微服务性能优化与架构.md b/docs/工作总结-微服务性能优化与架构.md index d45e42e..503cbf7 100644 --- a/docs/工作总结-微服务性能优化与架构.md +++ b/docs/工作总结-微服务性能优化与架构.md @@ -154,7 +154,7 @@ instruction: "Given a shopping query, rank product titles by relevance" ## 三、性能测试报告摘要 -以下数据来自 `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**。 +以下数据来自 `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**。 **复现命令(四场景×四并发)**: ```bash diff --git a/docs/搜索API对接指南.md b/docs/搜索API对接指南.md index d50469f..3463299 100644 --- a/docs/搜索API对接指南.md +++ b/docs/搜索API对接指南.md @@ -1808,7 +1808,7 @@ curl "http://localhost:6007/health" 支持 Qwen(默认)与 DeepL 模型,适用于商品名称、描述等电商场景。 -**请求体**: +**请求体**(支持单条字符串或字符串列表): ```json { "text": "商品名称", @@ -1819,9 +1819,20 @@ curl "http://localhost:6007/health" } ``` +也支持批量列表形式: +```json +{ + "text": ["商品名称1", "商品名称2"], + "target_lang": "en", + "source_lang": "zh", + "model": "qwen", + "context": "sku_name" +} +``` + | 参数 | 类型 | 必填 | 说明 | |------|------|------|------| -| `text` | string | Y | 待翻译文本 | +| `text` | string \| string[] | Y | 待翻译文本,既支持单条字符串,也支持字符串列表(批量翻译) | | `target_lang` | string | Y | 目标语言:`zh`、`en`、`ru` 等 | | `source_lang` | string | N | 源语言,不传则自动检测 | | `model` | string | N | `qwen`(默认)、`deepl` 或 `llm` | @@ -1839,6 +1850,18 @@ curl "http://localhost:6007/health" } ``` +当请求为列表形式时,`text` 与 `translated_text` 均为等长数组: +```json +{ + "text": ["商品名称1", "商品名称2"], + "target_lang": "en", + "source_lang": "zh", + "translated_text": ["Product name 1", "Product name 2"], + "status": "success", + "model": "qwen" +} +``` + **完整 curl 示例**: 中文 → 英文: diff --git a/indexer/product_annotator.py b/indexer/product_annotator.py index a94eb67..6660820 100644 --- a/indexer/product_annotator.py +++ b/indexer/product_annotator.py @@ -33,10 +33,6 @@ MAX_RETRIES = 3 RETRY_DELAY = 5 # 秒 REQUEST_TIMEOUT = 180 # 秒 -# 禁用代理 -os.environ['NO_PROXY'] = '*' -os.environ['no_proxy'] = '*' - # 文件路径 INPUT_FILE = "saas_170_products.csv" OUTPUT_DIR = Path("output_logs") -- libgit2 0.21.2