dify/api/core/plugin/entities/plugin_daemon.py

29 lines
534 B
Python
Raw Normal View History

2024-09-20 21:35:19 +08:00
from enum import Enum
2024-09-20 14:43:01 +08:00
from typing import Generic, Optional, TypeVar
from pydantic import BaseModel
2024-09-20 21:35:19 +08:00
T = TypeVar("T", bound=(BaseModel | dict | bool))
2024-09-20 14:43:01 +08:00
class PluginDaemonBasicResponse(BaseModel, Generic[T]):
"""
Basic response from plugin daemon.
"""
code: int
message: str
data: Optional[T]
2024-09-20 21:35:19 +08:00
class InstallPluginMessage(BaseModel):
"""
Message for installing a plugin.
"""
class Event(Enum):
Info = "info"
Done = "done"
Error = "error"
event: Event
data: str