This commit is contained in:
Your Name
2026-10-23 10:40:43 +08:00
parent e974d3cfa5
commit a3d2d3170d
14 changed files with 1660 additions and 83 deletions
@@ -29,7 +29,16 @@ namespace app\common\service {
if ($scenario === 'cancel') $GLOBALS['requiredCancelled'] = true;
$progress = $handle->options[defined('CURLOPT_XFERINFOFUNCTION') ? CURLOPT_XFERINFOFUNCTION : CURLOPT_PROGRESSFUNCTION] ?? null;
if (is_callable($progress) && $progress($handle, 0, 0, 100, 100)) return false;
if ($handle->code !== 200) return $stream ? true : '{}';
if ($handle->code !== 200) {
$errorBody = json_encode(['code' => $scenario === 'fallback' ? 'not_found' : 'invalid_param',
'message' => $scenario === 'reject' ? 'Number of files exceeds the limit.'
: ($scenario === 'input_rejected' ? 'Unknown input variable: synthetic_undeclared' : 'Synthetic path not found')]);
if ($stream) {
($handle->options[CURLOPT_WRITEFUNCTION])($handle, $errorBody);
return true;
}
return $errorBody;
}
if (!$stream) return json_encode(['answer' => '合成回答']);
$write = $handle->options[CURLOPT_WRITEFUNCTION];
if (str_ends_with($handle->url, '/chat-messages')) {