eye_agent.cpython-310.pyc•2.5 kB
o
R/�g
� @ sh d Z ddlZddlZddlZddlmZmZ ddlZddl Z ddl
mZ ddlm
Z
G dd� de�ZdS )u
视觉智能体
� N)�Dict�Any)� BaseAgent)�ImageMessagec sJ e Zd Zdededef� fdd�Z� fdd�Z� fdd �Zd
d� Z� Z S )�EyeAgent�agent_id�host�portc s. t � �|d||� d | _d| _d| _d| _d S )N�visionFr g @)�super�__init__�camera�is_capturing�last_analysis_time�analysis_interval)�selfr r r �� __class__� �4D:\DeepSeek\MCPAgent\mcpTest\src\agents\eye_agent.pyr s
zEyeAgent.__init__c � s\ �t � �� I dH t�d�| _| j�� s| j�d� dS d| _t �
| �� � | j�d� dS )u 启动视觉智能体Nr zFailed to open cameraTu 视觉智能体已启动)
r �start�cv2ZVideoCapturer
ZisOpened�logger�errorr �asyncio�create_task�
_capture_loop�info�r r r r r s �
zEyeAgent.startc � s, �d| _ | jr| j�� t� �� I dH dS )u 停止视觉智能体FN)r r
�releaser �stopr r r r r "