更新
This commit is contained in:
@@ -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')) {
|
||||
|
||||
Reference in New Issue
Block a user