Documentation IndexFetch the complete documentation index at: /llms.txtUse this file to discover all available pages before exploring further.
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
說明如何以官方 SDK 風格使用 Laravel Copilot SDK,並一併確認 Laravel 中的建議風格。
use Revolution\Copilot\Client; use Revolution\Copilot\Session; use Revolution\Copilot\Types\SessionEvent; $client = new Client([ 'cli_path' => 'copilot', 'cli_args' => [], 'cwd' => base_path(), 'log_level' => 'info', 'env' => null, ]); $client->start(); /** @var Session $session */ $session = $client->createSession([ 'model' => 'gpt-5', ]); $done = $session->on(function (SessionEvent $event) { if($event->isAssistantMessage()) { echo $event->content(); } }); $session->send(prompt: 'Tell me something about Laravel.'); $session->wait(timeout: 60.0); // 在 True async 正式實作前,先以 wait() 等待。 $done(); $session->disconnect(); $client->stop();
相關主題