Download app/Http/Controllers/Chatbot/ChatbotAssetsController.php from pnacorp/magicai: direct link, hf CLI and curl.
- Browser
- Download file 1.09 kB
-
https://huggingface.co/pnacorp/magicai/resolve/main/app/Http/Controllers/Chatbot/ChatbotAssetsController.php
- Command line
-
hf download hf://pnacorp/magicai/app/Http/Controllers/Chatbot/ChatbotAssetsController.php
-
curl -L -o ChatbotAssetsController.php https://huggingface.co/pnacorp/magicai/resolve/main/app/Http/Controllers/Chatbot/ChatbotAssetsController.php
1.09 kB
| declare(strict_types=1); | |
| namespace App\Http\Controllers\Chatbot; | |
| use App\Support\Chatbot\ChatbotHelper; | |
| use Illuminate\Http\Request; | |
| use Illuminate\Support\Facades\File; | |
| class ChatbotAssetsController | |
| { | |
| public function asset(Request $request, string $entryPoint) | |
| { | |
| $path = public_path($entryPoint); | |
| $contentType = ChatbotHelper::getContentTypeFromEntryPoint($entryPoint); | |
| if (File::exists($path)) { | |
| $content = File::get($path); | |
| return response($content, 200)->withHeaders([ | |
| 'Content-Type' => $contentType, | |
| // 'Cache-Control' => 'public, max-age=31536000', | |
| 'Vary' => 'Accept-Encoding', | |
| 'Access-Control-Allow-Origin' => '*', | |
| 'Access-Control-Allow-Methods' => 'GET, HEAD, OPTIONS', | |
| 'Access-Control-Allow-Headers' => 'Accept, Origin, Content-Type, X-MagicAI-Chatbot, X-Livewire', | |
| // 'Access-Control-Allow-Credentials' => 'false', | |
| ]); | |
| } | |
| abort(404); | |
| } | |
| } | |