Giter VIP home page Giter VIP logo

unigpt's Introduction

在Unity编辑器中使用ChatGPT、BingChat来生成并执行代码。

输出文本支持流式传输


chatgpt

binggpt

安装要求

Unity版本 >= 2019.3

初始化环境

  1. 进入Unity工程,等待Python环境初始化完成,然后 Edit -> Project Settings -> Python Scripting ->

    Launch Terminal (打开命令行工具)

    image-20230324020733689

  2. 按顺序执行以下命令

    python -m pip install --upgrade pip
    python -m pip install revChatGPT
    python -m pip install EdgeGPT
  3. 按照下面的教程配置AI

使用教程

配置ChatGPT

  1. 获取 ChatGPT 的 api_key,具体参考:https://platform.openai.com/account/api-keys
  2. 编辑该Json配置:Assets/IntegrationGPT/Config~/chat_gpt_config.json
  3. 国内的可以参考这里部署个腾讯云函数:openai-api-proxy,然后替换掉配置中的 api_url 即可
{
  # 将获取到的 api_key 替换掉下面的
  "api_key": "sk-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
  # chatgpt使用的模型, 如果你是Plus用户, 可以修改模型为 gpt-4
  "model": "gpt-3.5-turbo",
  # 代理设置,如果不需要则删除,在国内的必须要设置,否则无法访问openai的api
  "proxy": "http://127.0.0.1:1080",
  # 如果有国内镜像的,可以将api地址填写在这里
  # 官方API:https://api.openai.com/v1/chat/completions
  "api_url": "",
  # 这个是ChatGPT的提示语,可以根据需要增删
  "prompt": {
    "聊天": "",
	"生成并执行代码": "我想让你在Unity里面实现一个需求, 然后你给我回复代码, 你需要将实现逻辑写在TemplateClass中的Test静态方法里面, 我希望我不需要设置任何东西, 只手动调用Test方法后就能得到正确的结果, 我希望你只回复代码, 而不是其他任何内容, 不要注释.\n我的第一个需求是\n"
  }
}

配置New Bing

  1. 首先确保你已经加入了 New Bing,具体参考:https://github.com/acheong08/EdgeGPT#checking-access-required

  2. 然后获取 cookies,具体参考:https://github.com/acheong08/EdgeGPT#getting-authentication-required

  3. 将获取的 cookies 拷贝到 Assets/IntegrationGPT/Config~/new_bing_cookies.json 中

  4. 编辑该Json配置:Assets/IntegrationGPT/Config~/new_bing_config.json

    {
      # 对话样式
      # 更具创造力:creative 平衡:balanced 精确:precise
      "style": "precise",
      # 代理设置,如果不需要则删除,在国内的必须要设置,否则无法访问bing的api
      "proxy": "http://127.0.0.1:1080",
      # 如果有国内镜像的,可以将api地址填写在这里
      # 官方API:https://edgeservices.bing.com/edgesvc/turing/conversation/create
      "api_url": "",
      # 这个是Bing的提示语,可以根据需要增删
      "prompts": {
        "聊天": "",
        "生成并执行代码": "我想让你在Unity里面实现一个需求, 然后你给我回复代码, 你需要将实现逻辑写在TemplateClass中的Test静态方法里面, 并正确引用命名空间, 我希望我不需要设置任何东西, 只手动调用Test方法后就能得到正确的结果,我希望你只回复代码, 而不是其他任何内容, 不要注释.\n我的第一个需求是\n"
      }
    }

配置Brad

  1. 后续增加

引用

unigpt's People

Contributors

tylearymf avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.