code-debug228 / HostetskiGPT

FreeScout module for requests to GPT
MIT License
26 stars 7 forks source link

Error after enabling module error due to wrong directory name #1

Closed ioscanner closed 1 year ago

ioscanner commented 1 year ago

production.ERROR: Class "Modules\HostetskiGPT\Providers\HostetskiGPTServiceProvider" not found {"exception":"[object] (Symfony\Component\Debug\Exception\FatalThrowableError(code: 0): Class \"Modules\HostetskiGPT\Providers\HostetskiGPTServiceProvider\" not found at /var/www/html/overrides/laravel/framework/src/Illuminate/Foundation/ProviderRepository.php:279) [stacktrace]

0 /var/www/html/overrides/laravel/framework/src/Illuminate/Foundation/ProviderRepository.php(189): Illuminate\Foundation\ProviderRepository->createProvider()

1 /var/www/html/overrides/laravel/framework/src/Illuminate/Foundation/ProviderRepository.php(70): Illuminate\Foundation\ProviderRepository->compileManifest()

2 /var/www/html/vendor/nwidart/laravel-modules/src/Laravel/Module.php(27): Illuminate\Foundation\ProviderRepository->load()

3 /var/www/html/overrides/nwidart/laravel-modules/src/Module.php(279): Nwidart\Modules\Laravel\Module->registerProviders()

4 /var/www/html/overrides/nwidart/laravel-modules/src/Repository.php(366): Nwidart\Modules\Module->register()

5 /var/www/html/vendor/nwidart/laravel-modules/src/Providers/BootstrapServiceProvider.php(22): Nwidart\Modules\Repository->register()

6 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(586): Nwidart\Modules\Providers\BootstrapServiceProvider->register()

7 /var/www/html/vendor/nwidart/laravel-modules/src/ModulesServiceProvider.php(38): Illuminate\Foundation\Application->register()

8 /var/www/html/vendor/nwidart/laravel-modules/src/LaravelModulesServiceProvider.php(15): Nwidart\Modules\ModulesServiceProvider->registerModules()

9 [internal function]: Nwidart\Modules\LaravelModulesServiceProvider->boot()

10 /var/www/html/overrides/laravel/framework/src/Illuminate/Container/BoundMethod.php(29): call_user_func_array()

11 /var/www/html/overrides/laravel/framework/src/Illuminate/Container/BoundMethod.php(87): Illuminate\Container\BoundMethod::Illuminate\Container\{closure}()

12 /var/www/html/overrides/laravel/framework/src/Illuminate/Container/BoundMethod.php(31): Illuminate\Container\BoundMethod::callBoundMethod()

13 /var/www/html/overrides/laravel/framework/src/Illuminate/Container/Container.php(549): Illuminate\Container\BoundMethod::call()

14 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(792): Illuminate\Container\Container->call()

15 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(775): Illuminate\Foundation\Application->bootProvider()

16 [internal function]: Illuminate\Foundation\Application->Illuminate\Foundation\{closure}()

17 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(776): array_walk()

18 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/BootProviders.php(17): Illuminate\Foundation\Application->boot()

19 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(213): Illuminate\Foundation\Bootstrap\BootProviders->bootstrap()

20 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(296): Illuminate\Foundation\Application->bootstrapWith()

21 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(119): Illuminate\Foundation\Console\Kernel->bootstrap()

22 /var/www/html/artisan(62): Illuminate\Foundation\Console\Kernel->handle()

23 {main}

"}

ioscanner commented 1 year ago

I then see this error: production.ERROR: The HostetskiGPT module has been deactivated due to an error: include(/start.php): Failed to open stream: No such file or directory

ioscanner commented 1 year ago

I suspect it is this line in Providers/HostetskiGPTServiceProvider.php : array_push($javascripts, \Module::getPublicPath("hostetskigpt").'/js/module.js'); should be: array_push($javascripts, \Module::getPublicPath("HostetskiGPT").'/js/module.js');

AliakseyM commented 1 year ago

Hi @ioscanner. We're already working to resolve the issue quickly.

ioscanner commented 1 year ago

I had to roll to a backup. I couldn't remove the module it hung the top menus and couldn't deactivate the module. Let me know when you have it ready to test again. I can test for you. Since it installs in so many places outside of Modules might help to have a remove module script.

code-debug228 commented 1 year ago

@ioscanner, hello. Did you clone the repository in folder hostetskigpt or in HostetskiGPT? If you clone it in folder HostetskiGPT, then there are no problems, but if you clone it in hostetskigpt, the module doesn't work. Also please tell me your FreeScout version, I'll check the module on it(I checked on 1.8.71).

ioscanner commented 1 year ago

I cloned and it names it hostetskiGPT. I renamed the folder to HostetskiGPT. I added the api key and modified the message. Then, added activated in Modules. I am using: 1.8.71

code-debug228 commented 1 year ago

And after renaming folder the module still doesn't work?

ioscanner commented 1 year ago

correct. I can test it again. I had to restore the whole VM from backup. This time I will take a snapshot

code-debug228 commented 1 year ago

If it's not difficult for you, please try again. I just checked it again on the newest FreeScout version and it works. I cloned the repo to Modules/ with git clone https://github.com/code-debug228/HostetskiGPT, changed token in Http/Controllers/HostetskiGPTController.php, activated module and everything works. If error still occurs, the module can be disabled by renaming the folder with it, for example HostetskiGPT to HostetskiGPT2

ioscanner commented 1 year ago

Well it says activated now and I can still use the modules. But it doesn't seems to work. Is it suppose to auto reply? I see when I click on Generate Answer with ChatGPT it doesn't do anything when I select it. I did confirm my token is correct and can use it from nodejs.

ioscanner commented 1 year ago

I created a new token to see if the module used it. I don't see that it makes a call to openai using the token openai platform says last accessed: never. I don't see any errors in the logs.

I notice there is a Resources section and it seems it should have a setting blade. But I don't see that in the gui. If I go to settings it is not there.

I wonder if this is a PHP issue? Did you need any PHP modules not already installed? I am using PHP 8.1.2-1ubuntu2.11.

code-debug228 commented 1 year ago

Could you check if the button click sends a request to http://[your-freescout-domain]/hostetskigpt/get (or https, it shouldn't make a difference)? You can check this by opening the developer tools in your browser, tab "Network". if it is sent and a "server error" is returned, check FreeScout logs for a more specific error. So far, I have not had time to do normal error logging, but I will soon implement this functionality.

code-debug228 commented 1 year ago

About settings. Yes, I started making them, so you can find this blade template, but, again, I didn’t have time to properly implement them, so I postponed the implementation of this functionality for a while. I think I will do it this week.

AliakseyM commented 1 year ago

@ioscanner By the way, you can create a test mailbox in your FreeScout instance and invite the user with the email alexey.m@cloudcenter.ovh We will then check the error logs in the developer console to help troubleshoot any issues you might be experiencing.

ioscanner commented 1 year ago

About settings. Yes, I started making them, so you can find this blade template, but, again, I didn’t have time to properly implement them, so I postponed the implementation of this functionality for a while. I think I will do it this week.

I see it tries using the test ticket I created. I see this when I click create chatgpt answer link, in the development tool: 697773bca0d5e38542589bdafda8b61a87326940149.js:1 XHR failed loading: GET "https://server.com/hostetskigpt/get?query=%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3Cp%3EHow%20do%20I%20reset%20the%20print%20spooler%20on%20windows%2010?%3C/p%3E%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20&thread_id=397".

ioscanner commented 1 year ago

Any update on getting this to work?

code-debug228 commented 1 year ago

Hello. I'm sorry, I've been a little busy this week. I wanted to make convenient error logging, but so far I have not had time. Could you create a new mailbox and a new user dmemsmdmemsm@gmail.com in your FreeScout? If no error status is displayed on the request, I don't have any idea yet what might be causing this error, I'd like to see it myself.

ioscanner commented 1 year ago

Hello. I'm sorry, I've been a little busy this week. I wanted to make convenient error logging, but so far I have not had time. Could you create a new mailbox and a new user dmemsmdmemsm@gmail.com in your FreeScout? If no error status is displayed on the request, I don't have any idea yet what might be causing this error, I'd like to see it myself.

Invite was sent.

code-debug228 commented 1 year ago

I see that everything works.

image

Could you try again please?

ioscanner commented 1 year ago

I am going to guess you are using a different browser than Chrome. It still doesn't work in Chrome or Edge. Seems it only works in Firefox.

code-debug228 commented 1 year ago

Yes, it looks like there are errors in the module in Chrome and some other browsers. When I developed the module, I tested it in Firefox and Safari. I'll try to check and fix it today.

code-debug228 commented 1 year ago

I think the problem should be fixed now. Check it, please.