perf: 优化 Ollama AI

This commit is contained in:
kuaifan
2025-02-22 01:29:37 +08:00
parent b3e83e13bc
commit a8f3b02ee7
5 changed files with 57 additions and 2 deletions

View File

@@ -331,7 +331,8 @@ class SystemController extends AbstractController
* @apiGroup system
* @apiName setting__aibot_defmodels
*
* @apiParam {String} type AI类型
* @apiParam {String} type AI类型
* @apiParam {String} [base_url] 基础URL仅 type=ollama 时有效)
*
* @apiSuccess {Number} ret 返回状态码1正确、0错误
* @apiSuccess {String} msg 返回信息(错误描述)
@@ -340,6 +341,13 @@ class SystemController extends AbstractController
public function setting__aibot_defmodels()
{
$type = trim(Request::input('type'));
$baseUrl = trim(Request::input('base_url'));
if ($type == 'ollama') {
if (empty($baseUrl)) {
return Base::retError('请填写基础URL');
}
return Extranet::ollamaModels($baseUrl);
}
$models = Setting::AIDefaultModels($type);
if (empty($models)) {
return Base::retError('未找到默认模型');