v1.2修复优化

This commit is contained in:
2026-05-08 10:05:31 +08:00
parent 80b71a973a
commit 4cf6bd4b4b
12 changed files with 238 additions and 128 deletions

View File

@@ -84,6 +84,9 @@ class ChatController
ob_end_flush();
}
// 使用供应商配置中的 type 字段确定实际驱动
$providerType = $providerConfig['type'] ?? 'newapi';
$options = [
'provider' => $providerConfig,
'systemPrompt' => $systemPrompt,
@@ -91,7 +94,7 @@ class ChatController
];
try {
AIService::streamChat($providerKey, $model, $messages, $options, function ($chunk, $type = 'content') {
AIService::streamChat($providerType, $model, $messages, $options, function ($chunk, $type = 'content') {
if ($type === 'thinking') {
self::sendSSE(['thinking' => $chunk]);
} else {

View File

@@ -72,10 +72,9 @@ class InstallController
echo json_encode(['success' => false, 'message' => '请填写数据库配置']);
return;
}
if (!is_array($providers) || count($providers) === 0) {
http_response_code(400);
echo json_encode(['success' => false, 'message' => '请至少配置一个AI服务提供商']);
return;
// 供应商配置可选,安装后可在设置页面添加
if (!is_array($providers)) {
$providers = [];
}
try {