home, lyric, song, video에 대한 app 추가, 각 app별 모델 추가, admin 추가, debug 모드 추가, lifespan에 debug시 동작하는 것으로 업데이트
This commit is contained in:
1 parent
6180c23151
commit
5f1b9da77e
74 files changed
+3437
-416
No files matched your search
Whitespace-only changes.
@@ -0,0 +1,56 @@
|
||||
from sqladmin import ModelView
|
||||
|
||||
from app.lyric.models import Lyric
|
||||
|
||||
|
||||
class LyricAdmin(ModelView, model=Lyric):
|
||||
name = "가사"
|
||||
name_plural = "가사 목록"
|
||||
icon = "fa-solid fa-music"
|
||||
category = "가사 관리"
|
||||
page_size = 20
|
||||
|
||||
column_list = [
|
||||
"id",
|
||||
"project_id",
|
||||
"task_id",
|
||||
"status",
|
||||
"created_at",
|
||||
]
|
||||
|
||||
column_details_list = [
|
||||
"id",
|
||||
"project_id",
|
||||
"task_id",
|
||||
"status",
|
||||
"lyric_prompt",
|
||||
"lyric_result",
|
||||
"created_at",
|
||||
]
|
||||
|
||||
# 폼(생성/수정)에서 제외
|
||||
form_excluded_columns = ["created_at", "songs", "videos"]
|
||||
|
||||
column_searchable_list = [
|
||||
Lyric.task_id,
|
||||
Lyric.status,
|
||||
]
|
||||
|
||||
column_default_sort = (Lyric.created_at, True) # True: DESC (최신순)
|
||||
|
||||
column_sortable_list = [
|
||||
Lyric.id,
|
||||
Lyric.project_id,
|
||||
Lyric.status,
|
||||
Lyric.created_at,
|
||||
]
|
||||
|
||||
column_labels = {
|
||||
"id": "ID",
|
||||
"project_id": "프로젝트 ID",
|
||||
"task_id": "작업 ID",
|
||||
"status": "상태",
|
||||
"lyric_prompt": "프롬프트",
|
||||
"lyric_result": "생성 결과",
|
||||
"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.lyric.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