Download app/Http/Controllers/Chatbot/ChatbotEmbedController.php from pnacorp/magicai: direct link, hf CLI and curl.
- Browser
- Download file 1.07 kB
-
https://huggingface.co/pnacorp/magicai/resolve/main/app/Http/Controllers/Chatbot/ChatbotEmbedController.php
- Command line
-
hf download hf://pnacorp/magicai/app/Http/Controllers/Chatbot/ChatbotEmbedController.php
-
curl -L -o ChatbotEmbedController.php https://huggingface.co/pnacorp/magicai/resolve/main/app/Http/Controllers/Chatbot/ChatbotEmbedController.php
1.07 kB
| declare(strict_types=1); | |
| namespace App\Http\Controllers\Chatbot; | |
| use App\Http\Requests\Chatbot\ChatbotEmbedRequest; | |
| use App\Support\Chatbot\ChatbotHelper; | |
| use Illuminate\Support\Facades\Blade; | |
| use Livewire\Features\SupportScriptsAndAssets\SupportScriptsAndAssets; | |
| use ReflectionException; | |
| class ChatbotEmbedController | |
| { | |
| /** | |
| * @throws ReflectionException | |
| */ | |
| public function __invoke(ChatbotEmbedRequest $request) | |
| { | |
| $appKey = $request->input('appKey'); | |
| $componentName = 'chatbot'; | |
| $componentParams = []; | |
| if (ChatbotHelper::isEmbeddable($componentName) === false) { | |
| return [$componentName => null]; | |
| } | |
| $components = collect([ | |
| $componentName => Blade::render('@livewire($component, $params)', [ | |
| 'component' => $componentName, | |
| 'params' => $componentParams, | |
| ], true), | |
| ]); | |
| return [ | |
| 'components' => $components, | |
| 'assets' => SupportScriptsAndAssets::getAssets(), | |
| ]; | |
| } | |
| } | |