落地海运协同群:测服靠会话存档听群话,报价单能带上协同字段。
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -110,6 +110,7 @@ class WorkerRuntime:
|
||||
threading.Thread(target=self._llm_loop, name="llm-loop", daemon=True),
|
||||
threading.Thread(target=self._recognition_loop, name="recog-loop", daemon=True),
|
||||
threading.Thread(target=self._archive_loop, name="archive-loop", daemon=True),
|
||||
threading.Thread(target=self._wshoto_poll_loop, name="wshoto-poll", daemon=True),
|
||||
threading.Thread(target=self._pdf_loop, name="pdf-loop", daemon=True),
|
||||
]
|
||||
for t in self._threads:
|
||||
@@ -241,6 +242,34 @@ class WorkerRuntime:
|
||||
self.http_jobs.run(_job, label="archive")
|
||||
time.sleep(0.2)
|
||||
|
||||
def _wshoto_poll_loop(self) -> None:
|
||||
"""
|
||||
独立线程轮询微盛群消息,写入 inbox。
|
||||
|
||||
不占回调、不占 HTTP 槽、不与 soffice 串队。建群或刚有人说话会立刻再扫。
|
||||
未配钥匙时只空等,避免打无密钥请求。
|
||||
"""
|
||||
from agent.channel.wshoto.client import wshoto_ready
|
||||
from agent.channel.wshoto.poll import poll_once
|
||||
from agent.channel.wshoto.rooms import has_hot_room, wait_wshoto_poll
|
||||
|
||||
interval = float(getattr(self.settings, "wshoto_poll_interval_sec", 2.0) or 2.0)
|
||||
interval = min(30.0, max(1.0, interval))
|
||||
logged_skip = False
|
||||
while not self._stop.is_set():
|
||||
if not wshoto_ready(self.settings):
|
||||
if not logged_skip:
|
||||
logger.info("微盛轮询未开启:缺少 WSHOTO_APP_ID/SECRET 或开关已关")
|
||||
logged_skip = True
|
||||
self._stop.wait(15.0)
|
||||
continue
|
||||
try:
|
||||
poll_once(settings=self.settings, redis=self.redis.client if self.redis else None)
|
||||
except Exception:
|
||||
logger.exception("微盛轮询失败")
|
||||
wait = 1.0 if has_hot_room() else interval
|
||||
wait_wshoto_poll(wait)
|
||||
|
||||
def _pdf_loop(self) -> None:
|
||||
"""仅 LibreOffice 单槽消费 PDF Stream。"""
|
||||
if not self.redis:
|
||||
|
||||
Reference in New Issue
Block a user