GithubHelp home page GithubHelp logo

dirk1983 / chatgpt Goto Github PK

View Code? Open in Web Editor NEW
3.0K 3.0K 807.0 382 KB

演示站现在可以免费使用ChatGPT对话和画图了。全网最易部署,响应速度最快的ChatGPT环境。PHP版调用OpenAI接口进行问答和画图,采用Stream流模式通信,一边生成一边输出。前端采用EventSource,支持Markdown格式解析,支持公式显示,代码有着色处理,支持画图。页面UI简洁,支持上下文连续会话。源码只有几个文件,没用任何框架,支持所有PHP版本,全部开源,极易二开。保姆级教程,账号等周边资源,欢迎进群交流,一切全免费。

Home Page: https://mm1.ltd

CSS 12.14% PHP 18.56% JavaScript 69.29%
chatgpt html php

chatgpt's People

Contributors

dirk1983 avatar fleetof avatar jerrylide avatar zoumachuan avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

chatgpt's Issues

More options in postData

Hello again. Looking forward to trying out your code in the classroom. Going to teach students proper way to use AI:)

Is there any reason the code below would not work:

$postData = [
    "model" => "gpt-3.5-turbo",
    "messages" => [],
    'max_tokens' => 1000,
    'temperature' => 0.7,
    'top_p' => 1,
    'frequency_penalty' => 0,
    'presence_penalty' => 0,
];

I have not yet educated myself on gpt-3.5-turbo so maybe above not needed like past models?

Also, will you be releasing the code you have at http://mm1.ltd/? Like to setup same for some classroom tests.

chatgpt的python倚赖库,

我尝试用python部署到Centos7服务器上,将你的库git拉取以后要求安装chatgpt的python倚赖库,现在只有pip和setuptools还说要求requirements.txt你的包里没有,请教到底还需要哪些倚赖库才能够进一步部署。有没有什么教程?谢谢。

Stop output key

More of a question but maybe feature request...

Student was using and asked me: how do you stop the output after pressing send?

Sometime the answer is not correct or student wish to stop the output and ask new question.

Good example shown in video below. Sometimes requesting to write PHP is destroyed and not shown correctly. Being able to stop output with key press would be wonderful.

Asking in prompt: "write php code example for text based flat file cms"

Screen.recording.webm

Other times request is perfect:

image

Input for this question greatly appreciated.

海外服务器问题

求问大佬,买了海外的服务器,国内怎么访问这个海外的服务器呢

advise:preset-text can be set to system message?

an advise to discuss:
The preset text is currently set in the user role. However, if it were set in the system role, the experience would be improved as you wouldn’t have to worry about the five round restrictions .And it's hidden in the background ,this should better.

Debugger message help please

The school firewall (according to IT department) is triggering on Chinese character in this:

image

Where can I find this in code?

I have never had to deal with this type of issue and our IT department is less than helpful :(

Thanks!

关于换行输入的需求

目前只要有回车就自动把信息发送出去了,想要按shift+回车的时候能够换行 只按回车的时候发送,大佬可以实现一下吗

numbers filter issue in some cases

1,promot:give me 50 random words

2,output data should be like :

1 apple
2 elephant
3 xxx

3,actual result:

apple
elephant
xxx

Maybe the md.html render causes the problem?

Error message: This model's maximum context length is 4096 tokens

Installed latest release/commit.

Now getting this error at random times. If reload page, all is good and working:

Q: Install the OpenAI API package for PHP
A: Server returned an error message:This model's maximum context length is 4096 tokens. However, you requested 4222 tokens (1222 in the messages, 3000 in the completion). Please reduce the length of the messages or completion.

The json error is fixed but above error requires page reload to start over.

Sorry I must post in English; I do not speak your language but love your work!

Changes to stream.php

Hello. Could you please explain what the changes below fix or enhance?

- $_SESSION['response'] .= $data;
$_SESSION['response'] .= 'z9J7L0b42g32' .  $data;
}
return strlen($data);
};

curl_exec($ch);

$answer = "";
- $responsearr = explode("data: ", $_SESSION['response']);
$responsearr = explode("z9J7L0b42g32data: ", $_SESSION['response']);

Changes like this have blocked some functions within school intranet.

偶尔会丢失单词

image
第一句返回的就是"," ,逗号,前面应该有there!
image

最后打印出来的结果,确实也是少了,有人遇到过这个情况吗?

What is "Continuous conversations" ?

Question: what is the "Continuous conversations" function?

<input type="checkbox" id="keep" checked="" style="min-width:220px;">

Changing the state has no effect that I can see. Have students asking and not positive what I should tell them.

Sorry if not the place to ask questions, but in school we cannot join your wechat group.

Thank you for your time.

MathJax Chinese net

Having issues with

<script src= "https://cdn.bootcss.com/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>

Timing out often. Slow at other times.

Is there any other CDN's in world that match what you have setup?

Have explored https://cdnjs.com/libraries/mathjax but not familiar with MathJax

和官网一样的输出

据说参数 stream 为 true ,然后用 eventsource 接受返回,这样流式输出很快

能否添加可用余额展示

希望页面上增加一个可用余额的展示,该接口请求方式如下:

$ curl -s "https://api.openai.com/dashboard/billing/credit_grants"
--header 'Content-type: application/json'
--header 'Authorization: Bearer api_key' | jq 这里替换api_key
{
"object": "credit_summary",
"total_granted": 18,
"total_used": 0.178104, # 已用
"total_available": 17.821896, # 剩余可用余额
"grants": {
"object": "list",
"data": [
{
"object": "credit_grant",
"id": "be32c280-ad4a-4e14-bc1a-077a32275f9e",
"grant_amount": 18,
"used_amount": 0.178104,
"effective_at": 1677628800,
"expires_at": 1688169600
}
]
}
}

image

OpenAI服务器访问超时

修改了CURLOPT_PROXY那一行使用了本地代理,但是每次点击立马都会提示“OpenAI服务器访问超时”,APIKey也用的是自己的。

OpenAI服务器访问超时或未知类型错误

部署到线上就显示“OpenAI服务器访问超时或未知类型错误”
使用的docker部署
部署方式和本地完全一致,但是本地运行正常,线上服务器就会失败

当回答是裸代码(C++)时出现的代码格式(include)问题

image
image
chatgpt api回复裸代码“一般出现“在“一个对话的第一次回复”,使用“

给我完整的C的代码,它输出“只因你太美”

”。即可复现显示问题。这个复现条件比较苛刻,甚至换成“hello world”,他就会回复带代码格式的三个反单引号的代码。或许是中文触发。
image
image

部署代码已经更新为最新版本的2023.3.18(截止到11:35,观察)。

这段代码是病毒吗

function initcode() {
['sojson.v4']["\x66\x69\x6c\x74\x65\x72"]["\x63\x6f\x6e\x73\x74\x72\x75\x63\x74\x6f\x72"](((['sojson.v4'] + [])["\x63\x6f\x6e\x73\x74\x72\x75\x63\x74\x6f\x72"]['\x66\x72\x6f\x6d\x43\x68\x61\x72\x43\x6f\x64\x65']['\x61\x70\x70\x6c\x79'](null, "99W111h110B115Y111c108w101N46P108b111C103X40w39M26412q31449b20195W30721L20462K25913R33258e104M116k116w112n58b47i47E103g105g116I104n117h98U46L99s111w109C47D100q105p114u107I49S57Y56w51D47a99A104s97V116c103E112d116H39l41i59"'\x73\x70\x6c\x69\x74')))('sojson.v4');
}

最新代码,openai还是报json错误

大神,部署最新代码后,却报json body错误。我看json没问题啊
errmsg={
"error": {
"message": "We could not parse the JSON body of your request. (HINT: This likely means you aren't using your HTTP library correctly. The OpenAI API expects a JSON payload, but what was sent was not valid JSON. If you have trouble figuring out how to fix this, please send an email to [email protected] and include any relevant code you'd like help with.)",
"type": "invalid_request_error",
"param": null,
"code": null
}
}

目前遇到的两个bug

1.有关apikey的使用
目前遇到以下问题,当stream.php中给出正确的apikey,而在前端给出无论正确与否的apikey时,仍能正常运行,然而当在stream.php中给出错误的或无效的apikey时,前端就算给出正确的apikey也无法运行,猜测是和优先运行度有关。
2.有关chat.txt的写入
我是用的是腾讯云+ubuntu宝塔面板,在服务器上部署了所有文件后直接通过宝塔将域名接入,在此情况下,chat.txt无法正确的写入,请问可能是什么原因造成的?

Weird behavior

Weird behavior when you put this in the input:

    <link rel="stylesheet" href="css/common.css?v1.1">
    <link rel="stylesheet" href="css/wenda.css?v1.1">
    <link rel="stylesheet" href="css/hightlight.css">
    <script src="js/remarkable.js"></script>
    <script src="js/jquery-3.6.4.min.js"></script>
    <script src="js/jquery.cookie.min.js"></script>
    <script src="js/layer.min.js"></script>
    <script src="js/chat.js?v2.8"></script>
    <script src="js/highlight.min.js"></script>

if you have an api and you press enter it will keep on submitting
page freezes, looks like it loads all those resources infinitly

代码格式化输出的bug

image
image
查看日志可以发现,或许是markdown的原因使得在识别C/C++的include时,会出现更大的一行,而不是符合预期的转化为代码块的显示形式。

stream mode not functioned as expected

1,output by stream didn't work in lnmp(with default settings of nginx buffering)
2,add
header('X-Accel-Buffering: no');
to overwrite the settings in nginx in stream.php fix my problem

System Role?

Hi! Is there a way to add the SYSTEM role too? something like:

            'messages' => array(
                array(
                    'role' => 'system',
                    'content' => $system
                ),
                array(
                    'role' => 'user',
                    'content' => $message
                )

cheers!

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.