|
|
@@ -13012,10 +13012,16 @@ Q版卡通风格,头大身小,造型圆润可爱,线条简单,色彩明
|
|
|
|
|
|
}
|
|
|
|
|
|
- // 仅调用deepseek对话接口
|
|
|
- private function chatOnly($post_data) {
|
|
|
+ /**
|
|
|
+ * 仅调用 deepseek 对话接口(非流式)
|
|
|
+ *
|
|
|
+ * @param array $post_data
|
|
|
+ * @param int $timeout
|
|
|
+ * @return array
|
|
|
+ */
|
|
|
+ private function chatOnly($post_data, $timeout = 1800) {
|
|
|
$post_data['max_tokens'] = 300000;
|
|
|
- $client = new Client(['timeout' => 1800, 'verify' => false]);
|
|
|
+ $client = new Client(['timeout' => $timeout, 'verify' => false]);
|
|
|
$result = $client->post($this->url, ['json' => $post_data, 'headers' => $this->headers]);
|
|
|
$response = $result->getBody()->getContents();
|
|
|
$response_arr = json_decode($response, true);
|
|
|
@@ -13035,6 +13041,49 @@ Q版卡通风格,头大身小,造型圆润可爱,线条简单,色彩明
|
|
|
];
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 用 deepseek-v4-flash 非流式分析报错,返回不超过50字的用户友好提示
|
|
|
+ *
|
|
|
+ * @param string $errorMessage
|
|
|
+ * @return string|null
|
|
|
+ */
|
|
|
+ public function analyzeErrorMessage($errorMessage)
|
|
|
+ {
|
|
|
+ try {
|
|
|
+ $post_data = [
|
|
|
+ 'model' => 'deepseek-v4-flash',
|
|
|
+ 'messages' => [
|
|
|
+ [
|
|
|
+ 'role' => 'system',
|
|
|
+ 'content' => '你是视频生成任务的报错分析助手。请根据用户给出的原始报错,用一句中文提示告诉用户问题原因和下一步怎么做,不超过50个字,直接输出提示内容,不要解释、不要输出代码。',
|
|
|
+ ],
|
|
|
+ [
|
|
|
+ 'role' => 'user',
|
|
|
+ 'content' => (string)$errorMessage,
|
|
|
+ ],
|
|
|
+ ],
|
|
|
+ 'temperature' => 0.3,
|
|
|
+ 'frequency_penalty' => 0,
|
|
|
+ 'presence_penalty' => 0,
|
|
|
+ 'response_format' => ['type' => 'text'],
|
|
|
+ 'stream' => false,
|
|
|
+ ];
|
|
|
+
|
|
|
+ $result = $this->chatOnly($post_data, 8);
|
|
|
+ $content = trim((string)($result['fullContent'] ?? ''));
|
|
|
+ if ($content === '') {
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+
|
|
|
+ return mb_substr($content, 0, 50);
|
|
|
+ } catch (\Exception $e) {
|
|
|
+ dLog('deepseek')->error('视频任务报错分析失败: ' . $e->getMessage(), [
|
|
|
+ 'error_message' => $errorMessage
|
|
|
+ ]);
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
// 仅调用 GPT-5.4 对话接口(非流式)
|
|
|
private function gpt54ChatOnly($post_data) {
|
|
|
$apiKey = env('GPT_54_API_KEY');
|