georgerabus's avatar

POST request works only once, after this returns "An error occurred while processing your request."

EDIT: apparently the problem is from LLM API requests, don't waste your time reading this.

I am working on a project which the main purpose is to scrape pdf files and with help of LLM api help to shape the format of the text as wanted, so that it can gen parsed in database. Currently the LLM returns the response of the scraped text from a php library in form of a json, but it's invalid syntax (because AI dumb). So I wanted to find a workaround by extracting the "json's" key entries using regex and putting them into a multidimensional array. ChatGPT helped me with that, but after implementing those two function, the program behaves weirdly.

First request (file upload and then submit) works perfectly, laravel returns the data as expected, but the second time, nothing works. I tried lots of debugging, and after a var_dump in views I see this returned: string(48) "An error occurred while processing your request." . Tried clearing site cache, restarting artisan. It works only after like 2-3 minutes of waiting and then doing a request again. And no its not the problem from LLM requests. It worked perfectly before every time before implementing this:

       return redirect()->route('/response')->with('response', $json);
        Session::flush(); 
        Artisan::call('cache:clear');
        Artisan::call('route:cache');
        Artisan::call('route:clear');

still nothing. Only starts working after some time passed. It really weird because these functions are just some local machine algorithms, it should work at any time in no time. Any ideas?

0 likes
0 replies

Please or to participate in this conversation.