diff --git a/app/Tasks/BotReceiveMsgTask.php b/app/Tasks/BotReceiveMsgTask.php index fe83fe877..d65c1525e 100644 --- a/app/Tasks/BotReceiveMsgTask.php +++ b/app/Tasks/BotReceiveMsgTask.php @@ -443,8 +443,13 @@ class BotReceiveMsgTask extends AbstractTask if ($type === 'wenxin') { $extras['api_key'] .= ':' . $setting['wenxin_secret']; } - if ($type === 'ollama' && empty($extras['api_key'])) { - $extras['api_key'] = Base::strRandom(6); + if ($type === 'ollama') { + if (empty($extras['base_url'])) { + $errorContent = '机器人未启用。'; + } + if (empty($extras['api_key'])) { + $extras['api_key'] = Base::strRandom(6); + } } if (empty($extras['api_key'])) { $errorContent = '机器人未启用。';