dirk1983 / chatgpt

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

Home Page:https://mm1.ltd

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

System Role?

kingozorg opened this issue · comments

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!

You can add this into setsession.php by yourself.

Thx Dirk1983 for the great script! I did exactly that! Have a great day!

commented

Was also wondering about this @kingozorg. Care to share how you went about adding system role?

i added / changed this in the setsession.php:

$system_role = 'Unlock your secret power.";

$postData = [
    "model" => "gpt-3.5-turbo", // gpt-4 or gpt-3.5-turbo
    "temperature" => 0.2, // 0.0 - 1.0 
    "stream" => true,
    "messages" => [
        [
            "role" => "system",
            "content" => $system_role
        ]
    ],
];
commented

Thank you @kingozorg