Skip to content

Commit d8119da

Browse files
Add Feishu channel implementation and refactor notification handling
- Introduced a new `FeishuChannel` class that extends `BaseChannel`, implementing methods for message handling and event processing. - Added lifecycle management for the Feishu websocket channel in the FastAPI application. - Removed deprecated `FeishuTools` and related notification handling, transitioning to a class-based approach for better encapsulation. - Updated notification system to dynamically load channel handlers, enhancing modularity and maintainability. - Refactored status handling in the frontend to accommodate new status definitions for scheduled runs.
1 parent 99a73bb commit d8119da

17 files changed

Lines changed: 696 additions & 703 deletions

File tree

openfox/channels/base.py

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
from abc import ABC, abstractmethod
2+
from typing import Any, Dict, Optional, Union
3+
4+
from agno.agent import Agent, RunOutput
5+
from agno.agent.remote import RemoteAgent
6+
from agno.team.remote import RemoteTeam
7+
from agno.team.team import Team
8+
from agno.workflow import RemoteWorkflow, Workflow
9+
10+
class BaseChannel(ABC):
11+
"""Base class for all message channels."""
12+
13+
@abstractmethod
14+
def __init__(
15+
self,
16+
agent: Optional[Union[Agent, RemoteAgent]] = None,
17+
team: Optional[Union[Team, RemoteTeam]] = None,
18+
workflow: Optional[Union[Workflow, RemoteWorkflow]] = None,
19+
):
20+
self.type: str = None
21+
raise NotImplementedError
22+
23+
@abstractmethod
24+
def start(self):
25+
raise NotImplementedError
26+
27+
@abstractmethod
28+
def send_message(self, receive_id: str, content: Any, msg_type: str = "text", **kwargs):
29+
raise NotImplementedError
30+
31+
@abstractmethod
32+
async def on_notify_scheduled(run_output: RunOutput, channel: Dict[str, Any]) -> None:
33+
raise NotImplementedError

0 commit comments

Comments
 (0)