#!/usr/bin/env python3 # -*- coding: utf-8 -*- """专题四 · 步骤 2:读取 plugin_daemon 容器内出站 messages 调试日志。""" from __future__ import annotations import sys import _bootstrap # noqa: F401 import _config as C from dify_api import Dify def main() -> int: d = Dify(C.DIFY_EMAIL, C.DIFY_PASSWORD) try: d.login() out, err = d.sh( "docker exec %s cat /tmp/dify_openai_messages.log" % C.PLUGIN_CONTAINER ) text = out or err if not text.strip(): print("[提示] 日志为空。请先在 Agent 里发一条问题触发报错,再运行本脚本。") return 1 print(text) return 0 finally: d.close() if __name__ == "__main__": sys.exit(main())