[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"app-docs-nav-sai":3,"app-docs-sai@27":23,"mdc--myjbai-key":27},{"code":4,"message":5,"data":6},200,"success",{"appname":7,"title":8,"navigation":9},"sai","SAI知识库助手",[10],{"title":11,"icon":12,"children":13},"使用文档","i-lucide-rocket",[14,17,20],{"title":15,"path":16},"安装说明","/docs/sai@26",{"title":18,"path":19},"非阻塞模式","/docs/sai@27",{"title":21,"path":22},"免费大模型","/docs/sai@28",{"code":4,"message":5,"data":24},{"title":18,"description":25,"body":26},null,"## 阻塞模式\nNeuron AI 调用API接口的时候，是阻塞模式，在 `webman` 环境下接口请求的时候，会阻塞进程，所以我们要开启非阻塞模式，`webman` 支持直接协程，只需要在配置中使用 `swoole` 或者 `swow` 扩展就可以开启，**不需要修改任何代码**\n\n## 开启扩展 `swoole`\n![](https://image.saithink.top/storage/20260411/5b5d07776874929b4a09374f1afc52708d364dd5.png)\n\n## 配置 `webman` 使用 `swoole` 驱动\n找到配置文件 `config/process.php`\n```php\n'webman' => [\n    'handler' => Http::class,\n    'listen' => 'http://0.0.0.0:8787',\n    'count' => cpu_count() * 4,\n    'user' => '',\n    'group' => '',\n    'reusePort' => false,\n    'eventLoop' => Workerman\\Events\\Swoole::class,\n    'context' => [],\n    'constructor' => [\n        'requestClass' => Request::class,\n        'logger' => Log::channel('default'),\n        'appPath' => app_path(),\n        'publicPath' => public_path()\n    ]\n],\n```\n",{"data":28,"body":29},{},{"type":30,"children":31},"root",[32,40,84,95,104,124,135,147],{"type":33,"tag":34,"props":35,"children":37},"element","h2",{"id":36},"阻塞模式",[38],{"type":39,"value":36},"text",{"type":33,"tag":41,"props":42,"children":43},"p",{},[44,46,53,55,60,62,68,70,76,78],{"type":39,"value":45},"Neuron AI 调用API接口的时候，是阻塞模式，在 ",{"type":33,"tag":47,"props":48,"children":50},"code",{"className":49},[],[51],{"type":39,"value":52},"webman",{"type":39,"value":54}," 环境下接口请求的时候，会阻塞进程，所以我们要开启非阻塞模式，",{"type":33,"tag":47,"props":56,"children":58},{"className":57},[],[59],{"type":39,"value":52},{"type":39,"value":61}," 支持直接协程，只需要在配置中使用 ",{"type":33,"tag":47,"props":63,"children":65},{"className":64},[],[66],{"type":39,"value":67},"swoole",{"type":39,"value":69}," 或者 ",{"type":33,"tag":47,"props":71,"children":73},{"className":72},[],[74],{"type":39,"value":75},"swow",{"type":39,"value":77}," 扩展就可以开启，",{"type":33,"tag":79,"props":80,"children":81},"strong",{},[82],{"type":39,"value":83},"不需要修改任何代码",{"type":33,"tag":34,"props":85,"children":87},{"id":86},"开启扩展-swoole",[88,90],{"type":39,"value":89},"开启扩展 ",{"type":33,"tag":47,"props":91,"children":93},{"className":92},[],[94],{"type":39,"value":67},{"type":33,"tag":41,"props":96,"children":97},{},[98],{"type":33,"tag":99,"props":100,"children":103},"img",{"alt":101,"src":102},"","https://image.saithink.top/storage/20260411/5b5d07776874929b4a09374f1afc52708d364dd5.png",[],{"type":33,"tag":34,"props":105,"children":107},{"id":106},"配置-webman-使用-swoole-驱动",[108,110,115,117,122],{"type":39,"value":109},"配置 ",{"type":33,"tag":47,"props":111,"children":113},{"className":112},[],[114],{"type":39,"value":52},{"type":39,"value":116}," 使用 ",{"type":33,"tag":47,"props":118,"children":120},{"className":119},[],[121],{"type":39,"value":67},{"type":39,"value":123}," 驱动",{"type":33,"tag":41,"props":125,"children":126},{},[127,129],{"type":39,"value":128},"找到配置文件 ",{"type":33,"tag":47,"props":130,"children":132},{"className":131},[],[133],{"type":39,"value":134},"config/process.php",{"type":33,"tag":136,"props":137,"children":142},"pre",{"className":138,"code":139,"language":140,"meta":101,"style":141},"language-php","'webman' => [\n    'handler' => Http::class,\n    'listen' => 'http://0.0.0.0:8787',\n    'count' => cpu_count() * 4,\n    'user' => '',\n    'group' => '',\n    'reusePort' => false,\n    'eventLoop' => Workerman\\Events\\Swoole::class,\n    'context' => [],\n    'constructor' => [\n        'requestClass' => Request::class,\n        'logger' => Log::channel('default'),\n        'appPath' => app_path(),\n        'publicPath' => public_path()\n    ]\n],\n","php","undefined",[143],{"type":33,"tag":47,"props":144,"children":145},{"__ignoreMap":101},[146],{"type":39,"value":139},{"type":33,"tag":148,"props":149,"children":150},"style",{},[151],{"type":39,"value":101}]