|
|
@@ -71,11 +71,18 @@ class AIClientFactory
|
|
|
'data'=>$data
|
|
|
];
|
|
|
} else {
|
|
|
- throw new Exception('Invalid response format from Claude API');
|
|
|
+ //throw new Exception('Invalid response format from Claude API');
|
|
|
+ return [
|
|
|
+ 'success' => false,
|
|
|
+ 'error' => "Invalid response format from claude API",
|
|
|
+ 'model' => 'claude',
|
|
|
+ 'full_response' => $response,
|
|
|
+ 'data'=>$data
|
|
|
+ ];
|
|
|
}
|
|
|
} catch (Exception $e) {
|
|
|
// Log and return error
|
|
|
- error_log('Claude 3.7', $e->getMessage());
|
|
|
+ error_log('Claude 3.7: '. $e->getMessage());
|
|
|
|
|
|
return [
|
|
|
'success' => false,
|
|
|
@@ -141,7 +148,14 @@ class AIClientFactory
|
|
|
'data'=>$data
|
|
|
];
|
|
|
} else {
|
|
|
- throw new Exception('Invalid response format from DeepSeek API');
|
|
|
+ //throw new Exception('Invalid response format from DeepSeek API');
|
|
|
+ return [
|
|
|
+ 'success' => false,
|
|
|
+ 'error' => "Invalid response format from DeepSeek API",
|
|
|
+ 'model' => 'deepseek',
|
|
|
+ 'full_response' => $response,
|
|
|
+ 'data'=>$data
|
|
|
+ ];
|
|
|
}
|
|
|
} catch (Exception $e) {
|
|
|
// Log and return error
|
|
|
@@ -187,7 +201,7 @@ class AIClientFactory
|
|
|
? $responseData['error']['message']
|
|
|
: "HTTP error code: $httpCode";
|
|
|
|
|
|
- error_log($url, $errorMsg, $responseData);
|
|
|
+ error_log($url.", ".$errorMsg.", ".$responseData);
|
|
|
throw new Exception("API error: $errorMsg");
|
|
|
}
|
|
|
|