feat(bot): screenshot OCR pipeline + ack delay 120s
D fix: screenshots were silently dropped (empty body + OOB url). - register xep_0066, capture msg['oob']['url'] when body empty - also handle body-as-URL messages (some clients put URL in body) - download from upload.yoin.fun, OCR via SenseNova (sensenova-6.7-flash-lite) - inject OCR text as context into LLM call - config at /home/hmo/.config/mofin/ocr_config.json (outside repo) - replaces dead node122 GLM-OCR path (host unreachable) A+B fix: ACK_DELAY 15s -> 120s. 15s fired on every normal LLM cold-start (20-100s), now only signals genuine hangs.
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
import sys
|
||||
sys.argv = ['test', '--agent', 'zhiwei']
|
||||
# Prevent bot from actually connecting — just test the image functions
|
||||
src = open('/home/hmo/MoFin/deploy/bot/xmpp_agent_core.py').read()
|
||||
# Cut off at main entry to avoid starting the bot
|
||||
cut = src.find("if __name__ ==")
|
||||
if cut > 0:
|
||||
src = src[:cut]
|
||||
ns = {}
|
||||
exec(compile(src, 'xmpp_agent_core.py', 'exec'), ns)
|
||||
|
||||
url = "https://upload.yoin.fun/upload/d22cef590582300cc5580c722a19280054bf0d6a/brEbU8RxXwipU9VuhZqhhFOIAmQI4epG5dp5so6U/LBbTaPJdRfmzxjBg0uh21A.jpg"
|
||||
print("== _is_image_url ==", ns['_is_image_url'](url))
|
||||
print("== download ==")
|
||||
img = ns['_download_image'](url)
|
||||
print("bytes:", len(img) if img else None)
|
||||
if img:
|
||||
print("== OCR ==")
|
||||
ok, text = ns['_ocr_image'](img)
|
||||
print("ok:", ok)
|
||||
print("text:", text[:600])
|
||||
print("== full pipeline ==")
|
||||
print(ns['_process_image_message'](url)[:700])
|
||||
Reference in New Issue
Block a user