Broken ChatGPT search link

Created on 27 January 2023, over 1 year ago
Updated 9 May 2023, over 1 year ago

Problem/Motivation

First, thanks for building a nice module!

When I install it on a fresh version of Drupal 10.0.2, I find that there's a link on the content editing page with the words "ChatGPT search". It goes to this URL:

chatgpt/search_form

But the URL doesn't work and it generates a 404 error. The reason is that my version is running in a sub directory and it's not including this part of the root domain in the URL. The link should be "rootdomain.com/subdirectory/subdirectory/chatgpt/search_form".

When I add the extra "subdomain/subdomain" the form appears.

But when I type in something, I get:

invalid_request_error: Invalid URL (POST /v1

This may be because I don't have the SSL set up correctly. I'm not sure.

🐛 Bug report
Status

Closed: works as designed

Version

1.0

Component

Code

Created by

🇺🇸United States bogdog400

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @bogdog400
  • Status changed to Closed: works as designed over 1 year ago
  • 🇮🇳India anup.sinha Bengaluru

    Hi @bogdog400,

    First of all, many thanks for trying it out. Looks like you are trying it out in your local Drupal setup where the base URL is not configured. I have provided relative path in the form href as Drupal will automatically append your base URL with the relative path. If you want to try it out in your local, you can set a local URL like "drupal10-local" to your site using virtual host config in Apache. Please follow the step below -

    Link Broken Issue:
    1. open this file - wamp3.2\bin\apache\apache2.4.51\conf\extra\httpd-vhosts.conf
    2. Add a virtual host for your Drupal 10 site like this. I have the exact sub folder D10 setup which you are referring in my local.


    ServerName drupal10-local
    ServerAlias www.drupal10-local
    DocumentRoot "${INSTALL_DIR}/www/drupal10dev/web"

    Options +Indexes +Includes +FollowSymLinks +MultiViews
    AllowOverride All
    Require local

    3. Now your ChatGPT link will come as - http://drupal10-local/chatgpt/search_form and it will work. PFA the screenshot from my local setup.

    I hope this answer your query as we should not use full URL in form href.

    API Error:
    PFA ChatGPT_API_Config.png to know how your API configuration should look like. Endpoint should be - https://api.openai.com/v1/completions. Also if you want to enable SSL for cURL call, please go through the "*** Important Info" part in the module description page - https://www.drupal.org/project/chatgpt_plugin . ChatGPT will not allow you make cURL call if it's not a secure connection.

    I hope with these two explanations you are able to run the plugin in your local setup. Please send me your API config details if you are still having issues (remove the access token part while sending.)

    Thanks & Regards,
    Anup

  • 🇺🇸United States bogdog400

    Wow. Thanks for a detailed write up. I'll try this tomorrow (or maybe Monday.)

  • Hello Anup,

    I have install Drupal 9 with xampp (localy) but when I try to open ChatGPT Content Generator I go to a page "404 Not Found", with the following mensage:

    Apache/2.4.54 (Win64) OpenSSL/1.1.1p PHP/8.2.0 Server at localhost Port 8080

    The botton as the following path: http://localhost:8080/chatgpt/search_form/body

    If I try to open the path http://localhost:8080/drupal/chatgpt/search_form/body I can access to chatgpt and generate some content.

    Could you please help me?

    Thank you very much

Production build 0.71.5 2024