feat: OCR 并发识别控制,支持多用户同时上传
- config.py: 新增 OCR_CONCURRENCY 参数(默认1,范围1-10) - images.py: 用 asyncio.Semaphore 控制 OCR 并发,4个上传端点统一受控 - settings API: 新增 ocr_concurrency 字段读写 - 前端设置页: 新增 OCR 并发数量输入框 - .env / .env.example: 新增 OCR_CONCURRENCY 配置项 - Semaphore 动态重建:修改配置后立即生效,无需重启
This commit is contained in:
@@ -1093,6 +1093,14 @@
|
||||
<span style="color:var(--text-secondary); font-size:13px;">篇(1-50)</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="form-label">OCR 并发识别数量</label>
|
||||
<div style="display:flex; align-items:center; gap:8px;">
|
||||
<input type="number" id="setting-ocr-concurrency" min="1" max="10" value="1"
|
||||
style="width:80px;" class="input-field">
|
||||
<span style="color:var(--text-secondary); font-size:13px;">张(1-10,多用户同时上传时控制并发)</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -2644,6 +2652,9 @@
|
||||
if (data.judge_batch_size != null) {
|
||||
document.getElementById('setting-judge-batch-size').value = data.judge_batch_size;
|
||||
}
|
||||
if (data.ocr_concurrency != null) {
|
||||
document.getElementById('setting-ocr-concurrency').value = data.ocr_concurrency;
|
||||
}
|
||||
// 企业微信机器人
|
||||
document.getElementById('setting-wework-bot-enabled').checked = data.wework_bot_enabled;
|
||||
document.getElementById('setting-wework-bot-id').value = data.wework_bot_id || '';
|
||||
@@ -2673,6 +2684,10 @@
|
||||
if (!isNaN(judgeBatchSize) && judgeBatchSize >= 1 && judgeBatchSize <= 50) {
|
||||
body.judge_batch_size = judgeBatchSize;
|
||||
}
|
||||
const ocrConcurrency = parseInt(document.getElementById('setting-ocr-concurrency').value);
|
||||
if (!isNaN(ocrConcurrency) && ocrConcurrency >= 1 && ocrConcurrency <= 10) {
|
||||
body.ocr_concurrency = ocrConcurrency;
|
||||
}
|
||||
// 企业微信机器人
|
||||
body.wework_bot_enabled = document.getElementById('setting-wework-bot-enabled').checked;
|
||||
const botId = document.getElementById('setting-wework-bot-id').value.trim();
|
||||
|
||||
Reference in New Issue
Block a user