File size: 623 Bytes
105b369
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
from typing import List, Optional

from pydantic import BaseModel, ConfigDict

from phi.app.base import AppBase


class AppGroup(BaseModel):
    """AppGroup is a collection of Apps"""

    name: Optional[str] = None
    enabled: bool = True
    apps: Optional[List[AppBase]] = None

    model_config = ConfigDict(arbitrary_types_allowed=True)

    def get_apps(self) -> List[AppBase]:
        if self.enabled and self.apps is not None:
            for app in self.apps:
                if app.group is None and self.name is not None:
                    app.group = self.name
            return self.apps
        return []