#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Project      : AI.  @by PyCharm
# @File         : hailuo
# @Time         : 2024/12/6 09:05
# @Author       : betterme
# @WeChat       : meutils
# @Software     : PyCharm
# @Description  :
import os

import logfire

from meutils.pipe import *
from meutils.async_utils import async_to_sync_pro

from meutils.async_task import dramatiq
from meutils.apis.hailuoai.openai_videos import SoraVideoRequest, Tasks

logfire.configure(token=os.getenv("LOGFIRE_TOKEN_TASKS"))


@dramatiq.actor()
@async_to_sync_pro
async def create_task(request: SoraVideoRequest, **kwargs):
    token = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE3NzU3NDU3NTksInVzZXIiOnsiaWQiOiI0ODQxNjM2NzE3MDE4MzE2ODgiLCJuYW1lIjoi5p2wIOiigSIsImF2YXRhciI6IiIsImRldmljZUlEIjoiMzAyODMzNzU5NTEyNzY0NDE3IiwiaXNBbm9ueW1vdXMiOmZhbHNlfX0.U3oQESgf7qReJ_18WbP5FiGhzrl-eBCaw5K3K6nQD28"

    response = await Tasks(api_key=token).create(request)
    return response


if __name__ == '__main__':
    request = SoraVideoRequest()
    result = create_task(request)
    print(result)