Coder Social home page Coder Social logo

jtwhu / chatgpt Goto Github PK

View Code? Open in Web Editor NEW

This project forked from dirk1983/chatgpt

0.0 0.0 0.0 97 KB

PHP版调用chatgpt接口进行问答的Demo。页面UI简洁,支持连续会话,支持保存查询日志。源码只有两个文件,没用任何框架,支持所有PHP版本,只需要修改message.php中的API_KEY即可使用。

JavaScript 6.52% PHP 12.30% CSS 81.19%

chatgpt's Introduction

chatgpt

PHP版调用openai的api接口进行问答的Demo。

页面UI简洁,支持连续对话,支持保存查询日志。

核心代码只有一两个文件,没有用任何框架,修改调试很方便,只需要修改message.php中的API_KEY即可使用。

index.php前面的代码还可以实现区分内外网IP,内网直接访问,外网通过BASIC认证后可访问。可以根据需要删掉注释并进行修改。

适合放在公司内网,让同事们一起体验chatGPT的强大功能,或者自己用。

微信截图_20230216175637

FAQ: 部署调试时请注意两点,一个是要有curl扩展,一个是chat.txt文件要有写权限。

严格地说,这个接口和官网的网页版chatgpt是不一样的,基于GPT3(官方chatgpt是GPT3.5),可以理解为稍弱版chatgpt。由于接口限制,问题和答案最多4096个字节,UTF-8编码一个汉字3个字节,所以只有1000多个汉字。由于接口是官方提供的,所以其实这个版本的稳定性是很好的。

github上也有一些大神提供了基于官方web版chatgpt的代码,原理就是把服务器模拟成一个客户端来和openai交互,用户所有请求通过服务器中转到openai。这个模式需要服务器IP是chatgpt支持的区域,并且稳定性差一些,问多了一段时间内可能会一直失败。好处是不限制问题和答案长度,不需要扣费。各位有兴趣可以了解一下:https://github.com/slippersheepig/chatgpt-html

对chatgpt感兴趣的同学们欢迎加群讨论

微信截图_20230216182019

chatgpt's People

Contributors

dirk1983 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.