Skip to content

Forum in maintenance, we will back soon 🙂

Tool not functionin...
 
Notifications
Clear all

Tool not functioning

66 Posts
4 Users
11 Reactions
969 Views
Hasan Aboul Hasan
(@admin)
Posts: 1220
Member Admin
 

@vickywm33 you dont need Python or anything to test; please review the course; you can also use this online tool to do so:

https://reqbin.com/

This month, I will publish a step-by-step course on building a tool from scratch; I think it will help you a lot. I finished recording the course, and it is now in the editing phase.

 
Posted : 02/18/2024 1:46 pm
SSAdvisor
(@ssadvisor)
Posts: 1139
Noble Member
 

@admin there is also a VS Code extension called Postman that can help.

 

image

Regards,
Earnie Boyd, CEO
Seasoned Solutions Advisor LLC
Schedule 1-on-1 help
Join me on Slack

 
Posted : 02/18/2024 4:27 pm
(@vickywm33)
Posts: 27
Eminent Member
Topic starter
 

Thank you Gentlemen. I tried https://reqbin.com/ it blocked me out after 2 attempts to check.

I know I am probably asking too much but Is there any way, you can resolve this for me as I really want to get this website up and running with the tool. Its an old project before I came across to Hasan's video. I am learning through the course and from errors as well, but need help on this one. please. 

 

Thank you

Waqas

 
Posted : 02/19/2024 12:37 am
SSAdvisor
(@ssadvisor)
Posts: 1139
Noble Member
 

@vickywm33 how is your backend coded?  Are you using Python or something else?  Your answer will help us guide you.

Regards,
Earnie Boyd, CEO
Seasoned Solutions Advisor LLC
Schedule 1-on-1 help
Join me on Slack

 
Posted : 02/19/2024 1:17 am
Hasan Aboul Hasan
(@admin)
Posts: 1220
Member Admin
 

@vickywm33 Friend, did you go through the WordPress SaaS Course? 

some patience. We are learning here 🙂 We all had bugs and problems when we started. that's normal

We solved the first two problems, let's get into this too 🙂 

 
Posted : 02/19/2024 6:29 am
Hasan Aboul Hasan
(@admin)
Posts: 1220
Member Admin
 

Friend, I copied the code to my backend, and tested it, it is working, but got this:

{
  "success": false,
  "data": "API request failed. Response: {\n    \"error\": {\n        \"message\": \"You exceeded your current quota, please check your plan and billing details. For more information on this error, read the docs:  https://platform.openai.com/docs/guides/error-codes/api-errors. \",\n        \"type\": \"insufficient_quota\",\n        \"param\": null,\n        \"code\": \"insufficient_quota\"\n    }\n}\n"
}

 

It means that you have no more credits in OpenAI.

 

When I replaced it with my API Key, it worked perfectly!

 

 
Posted : 02/19/2024 6:35 am
SSAdvisor reacted
SSAdvisor
(@ssadvisor)
Posts: 1139
Noble Member
 

Error number 429:

429 - You exceeded your current quota, please check your plan and billing details Cause: You have run out of credits or hit your maximum monthly spend.
Solution: Buy more credits or learn how to increase your limits.

Regards,
Earnie Boyd, CEO
Seasoned Solutions Advisor LLC
Schedule 1-on-1 help
Join me on Slack

 
Posted : 02/19/2024 2:55 pm
(@vickywm33)
Posts: 27
Eminent Member
Topic starter
 

Thank you, Gentlemen! Thank you so much for your help. Sorry, I was busy with lecturing last few days. 
I have changed the API Key and ensured there are enough tokens.

Unfortunately, now the issue is stuck. (below screenshot of front end)
and below error keeps coming when I test the code online. 
"<a class='gotoLine' href='#157:1'>157:1</a> Uncaught SyntaxError: Unexpected token '&lt;'"

This is what Copilot/GPT4 says:

This error usually means that the code received some non-JSON data, such as HTML, instead of the expected JSON12.This could happen if the code is requesting an HTML file from a server, or if the file path is incorrect34. To fix this error, you should check the following:

  • Make sure the file you are requesting is a valid JSON file, not an HTML file.
  • Make sure the file path is correct and the file exists on the server.
  • Make sure the file is not corrupted or malformed.
  • Make sure the file is not empty or contains only whitespace.

If none of these steps solve the problem, you may need to debug your code using a tool like Chrome DevTools or Firefox Developer Tools. You can also post your code on a platform like Stack Overflow or Bobbyhadz and ask for help from other developers.

image

Kindly guide what to do?

 
Posted : 02/21/2024 5:25 pm
(@vickywm33)
Posts: 27
Eminent Member
Topic starter
 

I forgot to mention that I also see an error in the response placeholder and the html design placeholder. When the respone is generated, the placeholder expands but not in the page 'elementor borders' 

 

image
 
Posted : 02/21/2024 5:29 pm
SSAdvisor
(@ssadvisor)
Posts: 1139
Noble Member
 

@vickywm33 not seeing the code I can only guess based on the error. My opinion of the error is that you have a misplaced '<' character somewhere in the response. '&lt;' is HTML code for this character when you need to display it.

Regards,
Earnie Boyd, CEO
Seasoned Solutions Advisor LLC
Schedule 1-on-1 help
Join me on Slack

 
Posted : 02/21/2024 8:44 pm
(@vickywm33)
Posts: 27
Eminent Member
Topic starter
 

Thank you Earnie, 

I checked multiple times, but can't find any missing or extra '<' . 

However I used a AIPRM promprt to reduce the code, didn't do much but after copying that code, now that error is gone. However, the fetching is not taking place still. 

my backend is made using Hasan's python code.

 
Posted : 02/21/2024 11:04 pm
Hasan Aboul Hasan
(@admin)
Posts: 1220
Member Admin
 

@vickywm33 Did you change something in the backend? It is not working anymore?

 
Posted : 02/22/2024 11:36 am
(@vickywm33)
Posts: 27
Eminent Member
Topic starter
 

@admin I did apply a fix from Github which gave a small code to kill the error, but it didnt work. I have removed it now, still no difference. 

Is the below code snippet okay? It looks like my API is not talking with the program. Is the API url for open ai correct?

function openai_generate_recipe() {
    // Get the ingredients from the AJAX request
		$ingredients = $_POST['prompt'];
	$prompt = "Generate 2 yummy recipes and provide a step-by-step guide on how to cook these. Do not use any other ingredients, for every step also list down the ingredient quantity required" . $ingredients;

    // OpenAI API URL and key
    $api_url = 'https://api.openai.com/v1/chat/completions';
    $api_key = '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';  // Replace with your actual OpenAI API key

    // Headers for the OpenAI API
    $headers = [
        'Content-Type' => 'application/json',
        'Authorization' => 'Bearer ' . $api_key
    ];

    // Body for the OpenAI API
    $body = [
        'model' => 'gpt-3.5-turbo',
        'messages' => [['role' => 'user', 'content' => $prompt]],
        'temperature' => 0.7
    ];

    // Args for the WordPress HTTP API
    $args = [
        'method' => 'POST',
        'headers' => $headers,
        'body' => json_encode($body),
        'timeout' => 120
    ];

    // Send the request
   $response = wp_remote_request($api_url, $args);

// Handle the response
if (is_wp_error($response)) {
    wp_send_json_error("Something went wrong: " . $response->get_error_message());
}

$body = wp_remote_retrieve_body($response);
$data = json_decode($body, true);

if (json_last_error() !== JSON_ERROR_NONE || !isset($data['choices'])) {
    wp_send_json_error('API request failed. Response: ' . $body);
}

wp_send_json_success($data);

    }

    // Always die in functions echoing AJAX content
   wp_die();
}

add_action('wp_ajax_openai_generate_recipe', 'openai_generate_recipe');
add_action('wp_ajax_nopriv_openai_generate_recipe', 'openai_generate_recipe');
 
Posted : 02/22/2024 4:04 pm
SSAdvisor
(@ssadvisor)
Posts: 1139
Noble Member
 

@vickywm33 did you restart the service executing the code? You may be running the previous version unaware.

Regards,
Earnie Boyd, CEO
Seasoned Solutions Advisor LLC
Schedule 1-on-1 help
Join me on Slack

 
Posted : 02/22/2024 8:52 pm
(@vickywm33)
Posts: 27
Eminent Member
Topic starter
 

Not sure how to do that (restart the service). I am sorry for being a pain, I am not a techy. Sorry, I forgot to remove the API key twice in my replies. 

 
Posted : 02/23/2024 12:08 am
Page 2 / 5
Share: