ocr: 用腾讯云 QuestionSplitOCR 替换 TextIn 擦除

- 新增 backend/tencent_ocr.py(TC3 签名 + 结果解析,零依赖)
- create_paper_from_image 改为 腾讯 -> 本机 OCR+正则 -> 演示题库 三级兜底
- 删掉 TextIn 客户端、擦除页路由 /api/papers/{pid}/clean 与相关测试
- 新增 tests/test_tencent_ocr.py(13 例,全打桩);单测 114 例、冒烟 39 项全过
This commit is contained in:
dsh
2026-11-18 20:57:45 +08:00
parent 05347e04f8
commit c1cce198fd
12 changed files with 515 additions and 417 deletions
+5 -1
View File
@@ -24,9 +24,13 @@ from backend import wechat # noqa: E402
class QueryTokenTest(unittest.TestCase):
def test_link_endpoints_allow_query_token(self):
for p in ("/api/export/csv", "/api/print/weekly", "/api/papers/p_1/clean"):
for p in ("/api/export/csv", "/api/print/weekly"):
self.assertTrue(appmod.query_token_ok(p), p)
def test_clean_endpoint_gone_with_textin(self):
# 手写擦除(TextIn)已下线,这条链接不再接受 query 令牌
self.assertFalse(appmod.query_token_ok("/api/papers/p_1/clean"))
def test_other_endpoints_reject_query_token(self):
for p in ("/api/today", "/api/me", "/api/mistakes",
"/api/export/csv2", "/api/papers/p_1", "/apipapers/x"):