chatgpt
chatgpt copied to clipboard
How to use "Draw"
"Support calling the official OpenAI interface to draw pictures, and the first word of the question is "draw" to generate pictures."
Pictures is a wonderful addition; kids will love it. I was trying it out on the latest release and cannot get it to work?
I assume that you enter "Draw" into prompt area? Like: Draw photo on a unicorn
Thanks in advance for input.
可能因为作者只适配了中文的画图功能,你可能需要修改js和php文件搜索'画'来修改相关代码并且改成draw这个单词
Perhaps because the author only adapted the Chinese drawing function, you may need to modify the js and php files to search for '画' to modify the relevant code and change to the word draw
Thank you @xy3xy3 for response. Providing the '画" help me much. Still cannot get it to work after changing to english word: draw:
I’m sorry, as an AI language model, I don’t have the ability to provide images. Can I assist you with anything else?
I assume you simply use like: draw unicorn
you should also change setsession.php
<?php $context = json_decode($_POST['context'] ?: "[]") ?: []; if (mb_substr($_POST["message"], 0, 1, 'UTF-8') === '画'||mb_substr($_POST["message"], 0, 4, "UTF-8") === "draw") { $postData = [ "prompt" => $_POST['message'], "n" => 1, "size" => "1024x1024" ]; } else { $postData = [ "model" => "gpt-3.5-turbo", "temperature" => 0, "stream" => true, "messages" => [], ]; if (!empty($context)) { $context = array_slice($context, -5); foreach ($context as $message) { $postData['messages'][] = ['role' => 'user', 'content' => str_replace("\n", "\\n", $message[0])]; $postData['messages'][] = ['role' => 'assistant', 'content' => str_replace("\n", "\\n", $message[1])]; } } $postData['messages'][] = ['role' => 'user', 'content' => $_POST['message']]; } $postData = json_encode($postData); session_start(); $_SESSION['data'] = $postData; if ((isset($_POST['key'])) && (!empty($_POST['key']))) { $_SESSION['key'] = $_POST['key']; } echo '{"success":true}'; ![Uploading Screenshot_2023-06-25-00-07-04-581_com.kiwibrowser.browser.jpg…]()
I think on my first try there was caching issues. After waiting some time, the "draw" seems to work but no picture returning. I used "draw a cat". Processing took some time and then return success message but no picture. Error in dev console is:
Uncaught TypeError: Cannot read properties of undefined (reading '0')
at es.onmessage (chat.js?v2.8:320:33)
Looks like I have some troubleshooting to do.
Thank you @xy3xy3 for your help!