import asyncio
import base

from sqlalchemy import select
from api.model.embedding_search.title_index import TitleIndexModel
import local
from service.database import DatabaseService

from service.embedding_search import EmbeddingSearchService

async def main():
    dbs = await DatabaseService.create()

    async with dbs.create_session() as session:
        stmt = select(TitleIndexModel).where(TitleIndexModel.title == "代号:曙光的世界/黄昏的阿瓦隆")
        res = await session.scalar(stmt)
        print(res.__dict__)

    await asyncio.sleep(0.5)
    await local.noawait.end()

if __name__ == '__main__':
    local.loop.run_until_complete(main())