已比較的版本

索引鍵

  • 此行已新增。
  • 此行已移除。
  • 格式已變更。

...

註記:為了運作穩定,目前 OpenAPI Plugin 只能運作在 GPT4-Turbo 上,無法在其他 Model 上使用。

OpenAPI Plugin 如何撈取 user_id?

您可以在 Server 端獲得來自 MediaTek DaVinci 發出的 request 之後,從 header 拿到 “Davinci-Cookie”,並透過 userinfo 的 api 撈取到 user_id。

程式碼區塊
languagepy
import aiohttp
import quart
import traceback

async def get_username():
    async with aiohttp.ClientSession() as session:
        cookie = quart.request.headers["Davinci-Cookie"]
        url = 'https://prod.dvcbot.net'
        async with session.post(
            f"{url}/api/userinfo",
            json={"cookie": cookie},
            verify_ssl=False,
        ) as resp:
            try:
                result = await resp.json()

                return result["username"]
            except Exception as e:
                error_message = traceback.format_exc()

參考來源: