diff --git a/{packname}/__init__.py b/keipack/__init__.py similarity index 87% rename from {packname}/__init__.py rename to keipack/__init__.py index 8d53497f..574f6040 100644 --- a/{packname}/__init__.py +++ b/keipack/__init__.py @@ -1,6 +1,6 @@ # This is a template Pack __init__. You can use this without changing anything in other packages too! -from . import commands, tables, stars +from . import commands, tables, stars, utils from .commands import available_commands from .tables import available_tables from .stars import available_page_stars, available_exception_stars @@ -9,9 +9,9 @@ __all__ = [ "commands", "tables", "stars", + "utils", "available_commands", "available_tables", "available_page_stars", "available_exception_stars", ] - diff --git a/{packname}/commands/__init__.py b/keipack/commands/__init__.py similarity index 100% rename from {packname}/commands/__init__.py rename to keipack/commands/__init__.py diff --git a/{packname}/stars/__init__.py b/keipack/stars/__init__.py similarity index 89% rename from {packname}/stars/__init__.py rename to keipack/stars/__init__.py index dcfea74b..04aa7046 100644 --- a/{packname}/stars/__init__.py +++ b/keipack/stars/__init__.py @@ -1,9 +1,9 @@ # Imports go here! - +from .api_kei import ApiKei # Enter the PageStars of your Pack here! available_page_stars = [ - + ApiKei ] # Enter the ExceptionStars of your Pack here! diff --git a/keipack/stars/api_kei.py b/keipack/stars/api_kei.py new file mode 100644 index 00000000..55fa7335 --- /dev/null +++ b/keipack/stars/api_kei.py @@ -0,0 +1,23 @@ +from starlette.requests import Request +from starlette.responses import * +from royalnet.web import * +from royalnet.utils import * +import royalnet.packs.common.tables as cpt +import royalpack.tables as rpt + + +class ApiKei(PageStar): + path = "/api/kei" + + tables = {} + + async def _generate(self, request: Request, session) -> typing.Tuple[str, str]: + return "happy", "Ciao!" + + async def page(self, request: Request) -> JSONResponse: + async with self.session_acm() as session: + emotion, text = await self._generate(request, session) + return JSONResponse({ + "emotion": emotion, + "text": text, + }) diff --git a/{packname}/tables/__init__.py b/keipack/tables/__init__.py similarity index 100% rename from {packname}/tables/__init__.py rename to keipack/tables/__init__.py diff --git a/keipack/utils/__init__.py b/keipack/utils/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/keipack/utils/emotion.py b/keipack/utils/emotion.py new file mode 100644 index 00000000..0ad88a95 --- /dev/null +++ b/keipack/utils/emotion.py @@ -0,0 +1,13 @@ +from enum import Enum, auto + + +class Emotion(Enum): + HAPPY = auto() + SAD = auto() + ANGRY = auto() + + def __str__(self): + return self.name + + def __repr__(self): + return f"<{self.__class__.__qualname__} {self.name}: {self.value}>" diff --git a/requirements.txt b/requirements.txt index e69de29b..faa4e12f 100644 --- a/requirements.txt +++ b/requirements.txt @@ -0,0 +1,3 @@ +starlette +royalnet +royalpack \ No newline at end of file diff --git a/setup.py b/setup.py index e625dbff..ea6869cf 100644 --- a/setup.py +++ b/setup.py @@ -7,14 +7,14 @@ with open("requirements.txt", "r") as f: install_requires = f.readlines() setuptools.setup( - name="{packname}", + name="keipack", version="0.1", - author="{packauthorname}", - author_email="{packauthoremail}", - description="{packdescription}", + author="Stefano Pigozzi", + author_email="ste.pigozzi@gmail.com", + description="A mysterious AI assistant", long_description=long_description, long_description_content_type="text/markdown", - url="{packgithublink}", + url="https://github.com/Steffo99/keipack", packages=setuptools.find_packages(), install_requires=install_requires, python_requires=">=3.7",