first commit
This commit is contained in:
commit
1ff70c7925
71 files changed
+4175
No files matched your search
Whitespace-only changes.
@@ -0,0 +1,135 @@
|
||||
from sqladmin import ModelView
|
||||
|
||||
from app.lyrics.models import PromptTemplate # noqa: F401
|
||||
from app.lyrics.models import Attribute, SongResultsAll, SongSample, StoreDefaultInfo
|
||||
|
||||
|
||||
class LyricsStoreDefaultInfoAdmin(ModelView, model=StoreDefaultInfo):
|
||||
name = "상가 기본 정보"
|
||||
name_plural = "상가 정보 목록"
|
||||
icon = "fa-solid fa-store"
|
||||
category = "상가 정보 관리"
|
||||
page_size = 20
|
||||
|
||||
column_list = ["id", "store_name"]
|
||||
|
||||
# 폼(생성/수정)에서 제외
|
||||
form_excluded_columns = ["created_at"]
|
||||
|
||||
column_searchable_list = [
|
||||
StoreDefaultInfo.store_name,
|
||||
StoreDefaultInfo.store_phone_number,
|
||||
]
|
||||
|
||||
column_default_sort = (StoreDefaultInfo.store_name, False) # False: ASC, True: DESC
|
||||
|
||||
column_sortable_list = [
|
||||
StoreDefaultInfo.created_at,
|
||||
StoreDefaultInfo.store_phone_number,
|
||||
]
|
||||
|
||||
# 폼 컬럼 (기존 유지, user_posts가 관계라면 모델에 정의 필요)
|
||||
# form_columns = [
|
||||
# Post.user_id,
|
||||
# Post.title,
|
||||
# Post.content,
|
||||
# Post.is_published,
|
||||
# Post.user_posts, # Many-to-Many 또는 One-to-Many 관계 가정
|
||||
# ]
|
||||
|
||||
|
||||
class LyricsAttributeAdmin(ModelView, model=Attribute):
|
||||
name = "속성"
|
||||
name_plural = "속성 목록"
|
||||
icon = "fa-solid fa-tags"
|
||||
category = "속성 관리"
|
||||
page_size = 20
|
||||
|
||||
column_list = ["id", "attr_category"]
|
||||
|
||||
# 폼(생성/수정)에서 제외
|
||||
form_excluded_columns = ["created_at"]
|
||||
|
||||
column_searchable_list = [
|
||||
Attribute.attr_category,
|
||||
Attribute.attr_value,
|
||||
]
|
||||
|
||||
column_default_sort = (Attribute.created_at, False) # False: ASC, True: DESC
|
||||
|
||||
column_sortable_list = [
|
||||
Attribute.created_at,
|
||||
]
|
||||
|
||||
|
||||
class LyricsSongSampleAdmin(ModelView, model=SongSample):
|
||||
name = "가사 샘플"
|
||||
name_plural = "가사 샘플 목록"
|
||||
icon = "fa-solid fa-flask"
|
||||
category = "가사 샘플 관리"
|
||||
page_size = 20
|
||||
|
||||
column_list = [
|
||||
"id",
|
||||
"ai_model",
|
||||
"season",
|
||||
"num_of_people",
|
||||
"people_category",
|
||||
"genre",
|
||||
]
|
||||
|
||||
# 폼(생성/수정)에서 제외
|
||||
form_excluded_columns = ["created_at"]
|
||||
|
||||
column_default_sort = (SongSample.created_at, False) # False: ASC, True: DESC
|
||||
|
||||
|
||||
class LyricsPromptTemplateAdmin(ModelView, model=PromptTemplate):
|
||||
name = "프롬프트 템플릿"
|
||||
name_plural = "프롬프트 템플릿 목록"
|
||||
icon = "fa-solid fa-file-alt"
|
||||
category = "프롬프트 템플릿 관리"
|
||||
page_size = 20
|
||||
|
||||
column_list = [
|
||||
"id",
|
||||
"description",
|
||||
]
|
||||
|
||||
# 폼(생성/수정)에서 제외
|
||||
form_excluded_columns = ["created_at"]
|
||||
|
||||
column_default_sort = (PromptTemplate.created_at, False) # False: ASC, True: DESC
|
||||
|
||||
|
||||
class LyricsSongResultsAllAdmin(ModelView, model=SongResultsAll):
|
||||
name = "가사 결과"
|
||||
name_plural = "가사 결과 목록"
|
||||
icon = "fa-solid fa-music"
|
||||
category = "가사 결과 관리"
|
||||
page_size = 20
|
||||
|
||||
column_list = [
|
||||
"id",
|
||||
"store_name",
|
||||
]
|
||||
|
||||
# 폼(생성/수정)에서 제외
|
||||
form_excluded_columns = ["created_at"]
|
||||
|
||||
column_searchable_list = [
|
||||
SongResultsAll.ai,
|
||||
SongResultsAll.ai_model,
|
||||
]
|
||||
|
||||
column_default_sort = (SongResultsAll.created_at, False) # False: ASC, True: DESC
|
||||
|
||||
column_sortable_list = [
|
||||
SongResultsAll.store_name,
|
||||
SongResultsAll.store_category,
|
||||
SongResultsAll.ai,
|
||||
SongResultsAll.ai_model,
|
||||
SongResultsAll.num_of_people,
|
||||
SongResultsAll.genre,
|
||||
SongResultsAll.created_at,
|
||||
]
|
||||
Whitespace-only changes.
Whitespace-only changes.
@@ -0,0 +1,146 @@
|
||||
from typing import Any
|
||||
|
||||
from fastapi import APIRouter, Depends, Request # , UploadFile, File, status
|
||||
from sqlalchemy.ext.asyncio import AsyncSession
|
||||
|
||||
from app.database.session import get_session
|
||||
from app.lyrics.services import lyrics
|
||||
|
||||
router = APIRouter(prefix="/lyrics", tags=["lyrics"])
|
||||
|
||||
|
||||
@router.get("/store")
|
||||
async def home(
|
||||
request: Request,
|
||||
conn: AsyncSession = Depends(get_session),
|
||||
):
|
||||
# store_info_list: List[StoreData] = await lyrics_svc.get_store_info(conn)
|
||||
result: Any = await lyrics.get_store_info(conn)
|
||||
|
||||
# return templates.TemplateResponse(
|
||||
# request=request,
|
||||
# name="store.html",
|
||||
# context={"store_info_list": result},
|
||||
# )
|
||||
pass
|
||||
|
||||
|
||||
@router.post("/attributes")
|
||||
async def attribute(
|
||||
request: Request,
|
||||
conn: AsyncSession = Depends(get_session),
|
||||
):
|
||||
print("attributes")
|
||||
print(await request.form())
|
||||
|
||||
result: Any = await lyrics.get_attribute(conn)
|
||||
print(result)
|
||||
|
||||
# return templates.TemplateResponse(
|
||||
# request=request,
|
||||
# name="attribute.html",
|
||||
# context={
|
||||
# "attribute_group_dict": result,
|
||||
# "before_dict": await request.form(),
|
||||
# },
|
||||
# )
|
||||
pass
|
||||
|
||||
|
||||
@router.post("/fewshot")
|
||||
async def sample_song(
|
||||
request: Request,
|
||||
conn: AsyncSession = Depends(get_session),
|
||||
):
|
||||
print("fewshot")
|
||||
print(await request.form())
|
||||
|
||||
result: Any = await lyrics.get_sample_song(conn)
|
||||
print(result)
|
||||
|
||||
# return templates.TemplateResponse(
|
||||
# request=request,
|
||||
# name="fewshot.html",
|
||||
# context={"fewshot_list": result, "before_dict": await request.form()},
|
||||
# )
|
||||
pass
|
||||
|
||||
|
||||
@router.post("/prompt")
|
||||
async def prompt_template(
|
||||
request: Request,
|
||||
conn: AsyncSession = Depends(get_session),
|
||||
):
|
||||
print("prompt_template")
|
||||
print(await request.form())
|
||||
|
||||
result: Any = await lyrics.get_prompt_template(conn)
|
||||
print(result)
|
||||
|
||||
print("prompt_template after")
|
||||
print(await request.form())
|
||||
|
||||
# return templates.TemplateResponse(
|
||||
# request=request,
|
||||
# name="prompt.html",
|
||||
# context={"prompt_list": result, "before_dict": await request.form()},
|
||||
# )
|
||||
|
||||
pass
|
||||
|
||||
|
||||
@router.post("/result")
|
||||
async def song_result(
|
||||
request: Request,
|
||||
conn: AsyncSession = Depends(get_session),
|
||||
):
|
||||
print("song_result")
|
||||
print(await request.form())
|
||||
|
||||
result: Any = await lyrics.make_song_result(request, conn)
|
||||
print("result : ", result)
|
||||
|
||||
# return templates.TemplateResponse(
|
||||
# request=request,
|
||||
# name="result.html",
|
||||
# context={"result_dict": result},
|
||||
# )
|
||||
pass
|
||||
|
||||
|
||||
@router.get("/result")
|
||||
async def get_song_result(
|
||||
request: Request,
|
||||
conn: AsyncSession = Depends(get_session),
|
||||
):
|
||||
print("get_song_result")
|
||||
print(await request.form())
|
||||
|
||||
result: Any = await lyrics.get_song_result(conn)
|
||||
print("result : ", result)
|
||||
|
||||
# return templates.TemplateResponse(
|
||||
# request=request,
|
||||
# name="result.html",
|
||||
# context={"result_dict": result},
|
||||
# )
|
||||
pass
|
||||
|
||||
|
||||
@router.post("/automation")
|
||||
async def automation(
|
||||
request: Request,
|
||||
conn: AsyncSession = Depends(get_session),
|
||||
):
|
||||
print("automation")
|
||||
print(await request.form())
|
||||
|
||||
result: Any = await lyrics.make_automation(request, conn)
|
||||
print("result : ", result)
|
||||
|
||||
# return templates.TemplateResponse(
|
||||
# request=request,
|
||||
# name="result.html",
|
||||
# context={"result_dict": result},
|
||||
# )
|
||||
pass
|
||||
Whitespace-only changes.
Reference in new issue
Block a user