mirror of
https://github.com/RYGhub/royalnet.git
synced 2024-11-23 19:44:20 +00:00
First commit
This commit is contained in:
parent
2d59bca0bd
commit
ebaff84017
9 changed files with 48 additions and 9 deletions
|
@ -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",
|
||||
]
|
||||
|
|
@ -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!
|
23
keipack/stars/api_kei.py
Normal file
23
keipack/stars/api_kei.py
Normal file
|
@ -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,
|
||||
})
|
0
keipack/utils/__init__.py
Normal file
0
keipack/utils/__init__.py
Normal file
13
keipack/utils/emotion.py
Normal file
13
keipack/utils/emotion.py
Normal file
|
@ -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}>"
|
|
@ -0,0 +1,3 @@
|
|||
starlette
|
||||
royalnet
|
||||
royalpack
|
10
setup.py
10
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",
|
||||
|
|
Loading…
Reference in a new issue