爱意满满的作品展示区。
TristanYang

低成本做个 ChatGPT 聊天机器人

  •  
  •   TristanYang ·
    zerosoul · Jun 2, 2023 · 2201 views
    This topic created in 1096 days ago, the information mentioned may be changed or developed.

    许多同学还不知道,Vocechat 可以创建机器人啦! 这里我们使用 ChatGPT 相关 API ,演示下如何做个 ChatGPT 聊天机器人

    前置条件

    新建一个 Vocechat 机器人

    create bot

    • 创建时,webhook 可暂时不写
    • 记住该 Bot 的 ID ,后面会用到

    借助 Vercel ,部署自己的 ChatGPT API

    具体流程请移步: https://github.com/Privoce/vocechat-chatbot-ui#readme

    简述一下环境变量的配置:

    环境变量 描述
    VOCECHAT_ORIGIN Vocechat API 地址,一般和你的 vocechat 访问地址一致,比如 https://vocechat.example.com
    VOCECHAT_BOT_ID Vocechat 机器人 ID ,在你新建的机器人名称下面可以找到,#开头
    VOCECHAT_BOT_SECRET Vocechat 机器人 API Key ,用于 Vocechat 接口授权
    OPENAI_API_KEY 用于认证 OpenAI API 的调用

    回填 webhook

    Vercel 部署成功后,就有一个专属的 ChatGPT API ,假设你的 Vercel 访问地址是:mygpt.vercel.com ,则 webhook 地址是: https://mygpt.vercel.com/api/bot ,将该地址作为 webhook 回填给上面新建的机器人

    一切就绪

    至此,已完成 ChatGPT 机器人的初始化工作,可以通过在频道里 AT(@)该机器人对话,或直接私聊。

    create bot

    No Comments Yet
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   990 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 55ms · UTC 22:17 · PVG 06:17 · LAX 15:17 · JFK 18:17
    ♥ Do have faith in what you're doing.