Code Monkey home page Code Monkey logo

chatgpt-web's Introduction

chatgpt-web

使用GPT-3.5中的text-davinci-003模型,利用OpenAI API实现简单HTML网页版在线聊天(基于此项目调整而来)

该版本基于OPENAI API KEY开发,想使用ChatGPT的请访问chatgpt-html

G L%7VF I~{@83}SVRI_WPN(重要)ChatGPT与GPT-3.5(OpenAI API)的区别

  • OpenAI官方网页中,我们可以看到官方对ChatGPT的描述为“ChatGPT is fine-tuned from a model in the GPT-3.5 series, which finished training in early 2022. You can learn more about the 3.5 series here. ChatGPT and GPT 3.5 were trained on an Azure AI supercomputing infrastructure”,从而得知ChatGPT与GPT-3.5是两个不同产品
  • 官方对GPT-3.5系列的介绍里,text-davinci-003是其中的模型之一
  • 我们再查阅官方对OpenAI API KEY的介绍,其中有一句“The API is powered by a set of models with different capabilities and price points. Our base GPT-3 models are called Davinci, Curie, Babbage and Ada”,davinci赫然在列

I4{CU~ G( OH$WR_ T_1JWF 至此,我们可以得出结论:现在所有使用OpenAI API KEY的项目,都不是基于ChatGPT开发的项目,官方并未发布ChatGPT的API接口

  • 事实上,ChatGPT最近发生过登录认证风波,想了解详细过程的可以查看这个issue
  • 如果你自己有分别使用过ChatGPT的官方chat和OpenAI的API接口chat,你会发现API接口chat比ChatGPT的官方chat“笨”得多

部署

获取OpenAI API KEY

配置

从源码配置

使用Docker Compose

  • 新建chat.html网页文件,粘贴以下代码并保存(UI很丑,建议各自美化)
<!DOCTYPE html>
<html lang="en">

<!--自适应屏幕大小-->
<meta name="viewport" content="width=device-width,initial-scale=1" />

<head>
    <!-- <link rel="shortcut icon" href="" type="image/x-icon" /> -->
    <meta charset="UTF-8">
    <title>OpenAI</title>
    <style>
      body {
        color: #333;
        background-color: #eee;
      }
    @media (prefers-color-scheme: dark) {
      body {
        background: black;
        color: white;
      }
    }
    </style>
</head>

<body>
    <div align="center">
        <h2>Fake ChatGPT</h2>
        <div>注意:接口返回可能比较慢(服务在国外,并且OpenAI返回速度也比较慢),提交后需要等待处理完成,请勿重复提交!!!</div>
        <div>~接口返回有长度限制~</div>
        <hr />
        {% if message %} {{ message }} {% endif %}
        <form method="post" onsubmit="submit.disabled=true">
            <textarea style="width:35%;" name="question" placeholder="点击这里输入问题" rows="11" id="form"></textarea>
            <br>
            <input type="submit" style="width:150px;height:50px;background-color:green;font-size:30px" value="提交" id="submit" />
        </form>
        <div id="loading" style="display:none; color:red"><b>后端正在处理,请稍等...</b></div>
        {% if question %}
        <div style="text-align: left"><b>人类:</b>
            <pre id="question">{{ question }}</pre>
        </div>
        <hr />
        <div style="text-align: left"><b>人工智障:</b>
            <pre style="text-align:left; white-space: pre-wrap;" id="res">{{ res }}</pre>
        </div>
        {% endif %}
    </div>
</body>
<script>
    let loading = document.getElementById('loading');
    let form = document.querySelector('form');
    form.addEventListener('submit', () => {
        loading.style.display = 'block';
    });
</script>
</html>
  • 新建docker-compose.yml配置文件,粘贴以下内容并保存,放在与chat.html文件相同的目录下
version: '3'
services:
  chatgpt:
    image: sheepgreen/chatgpt-web #如果是arm架构,需要改成chatgpt-web:arm
    container_name: webchat
    environment:
      - OPENAI_API_KEY=前面你获取到的OpenAI API KEY
    volumes:
      - ./chat.html:/chatgpt-web/templates/chat.html
    ports:
      - "8888:80" #80为容器内部端口,不可更改;8888为外部映射端口,可自行更改
    restart: always
  • 输入docker-compose up -d即启动成功

注意事项

  • 访问地址为http://ip:port/chat
  • 修改chat.html文件后,需要docker restart webchat才能生效

chatgpt-web's People

Contributors

slippersheepig avatar gyjmy111 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.