diff --git a/core/websocket_client.py b/core/websocket_client.py index 396d144..a6e4d2e 100755 --- a/core/websocket_client.py +++ b/core/websocket_client.py @@ -468,7 +468,12 @@ class QingjianAPIClient: """判断文本是否指代之前的图片(图一/图二/这张/那张/上面那张等)""" if not msg: return False - refs = ("图一", "图二", "第一张", "第二张", "这张", "那张", "上面那张", "下面那张", "刚才那张", "上一张", "下一张") + refs = ( + "图一", "图二", "第一张", "第二张", + "这张", "那张", "这图", "那个图", + "这个", "这个呢", + "上面那张", "下面那张", "刚才那张", "上一张", "下一张", + ) return any(r in msg for r in refs) def _extract_image_urls(self, msg: str) -> list: @@ -612,7 +617,9 @@ class QingjianAPIClient: old.cancel() async def _delay_flush(capture_key, capture_data): await asyncio.sleep(self._DEBOUNCE_SECONDS + 4) - await self._flush_pending_images(capture_key, capture_data) + # 与同客户 agent_reply 串行,避免“延迟报价”和“当前追问”并发打架 + async with self._get_customer_lock(capture_key): + await self._flush_pending_images(capture_key, capture_data) task = asyncio.create_task(_delay_flush(key, data)) self._pending_image_tasks[key] = task return diff --git a/image/image_analyzer.py b/image/image_analyzer.py index 33e3198..5ded00f 100755 --- a/image/image_analyzer.py +++ b/image/image_analyzer.py @@ -241,6 +241,7 @@ class ImageAnalyzer: DENSE_TEXT_SUBJECT_KEYWORDS = ( "宣传栏", "公告栏", "展板", "海报墙", "通知栏", "知识栏", "制度牌", "公示栏", "墙报", "密密麻麻", + "宣传海报", "知识海报", "科普海报", "防灾减灾", "宣传板", "宣传页", "表格", "检索表", "配伍表", "药物配伍", "课程表", "流程表", "说明表", "数据表", "word wall", "poster wall", "bulletin board", ) @@ -571,6 +572,10 @@ class ImageAnalyzer: kw in scene_text for kw in self.DENSE_TEXT_SUBJECT_KEYWORDS ) + dense_text_hint = any( + kw in scene_text + for kw in ("密集文字", "大量文字", "小字", "多板块", "细字") + ) # 校验比例合法性 valid_ratios = {"1:1", "9:16", "16:9", "3:4", "4:3", "3:2", "2:3", "5:4", "4:5"} @@ -640,7 +645,8 @@ class ImageAnalyzer: # 硬规则1:文字很多(>100)且密密麻麻不接单 text_gt_100 = text_amount in ["大量 (51-200 字)", "极多 (200 字以上)"] - if text_gt_100 or dense_text_scene: + dense_text_hard_reject = text_gt_100 or dense_text_scene or (has_text == "yes" and dense_text_hint) + if dense_text_hard_reject: feasibility = "no" risk = "high" note = "文字内容过于密集(如宣传栏/公告栏),暂不接单处理"