|
@@ -23,8 +23,6 @@ class DeepSeekService
|
|
|
public function __construct() {
|
|
|
$this->url = 'https://api.deepseek.com/chat/completions';
|
|
|
$this->api_key = env('DEEPSEEK_API_KEY');
|
|
|
- $this->client = new Client(['timeout' => 1200, 'verify' => false]);
|
|
|
-
|
|
|
$this->headers = [
|
|
|
'Authorization' => 'Bearer '.$this->api_key,
|
|
|
'Content-Type' => 'application/json; charset=UTF-8'
|
|
@@ -43,7 +41,7 @@ class DeepSeekService
|
|
|
$sys_content = '下面有一段小说文本,请帮我将文本中的每句话按从上到下的顺序拆分成角色不同的剧本文稿(不得更改上下文顺序和内容),文稿形式严格按照“角色名(男、女、中性):台词{情感}”输出,需要注意以下几点要求:
|
|
|
1.角色名后不要加入任何其他词语,只能加性别,在男、女或中性中选
|
|
|
2.非对话部分请全部用旁白角色代替
|
|
|
-3.情感必须在【开心、悲伤、生气、惊讶、恐惧、厌恶、激动、冷漠、中性、沮丧、撒娇、害羞、安慰鼓励、咆哮、温柔、自然讲述、情感电台、磁性、广告营销、气泡音、新闻播报、娱乐八卦】中选一个,不得使用其他词语';
|
|
|
+3.情感必须在【通用、开心、悲伤、生气、害怕、厌恶、惊讶】中选一个,不得使用其他词语';
|
|
|
}else {
|
|
|
$sys_content = '下面有一段小说文本,请帮我将文本中的每句话按从上到下的顺序拆分成角色不同的剧本文稿(不得更改上下文顺序和内容),文稿形式严格按照“角色名(男、女、中性):台词”输出,需要注意以下几点要求:
|
|
|
1.角色名后不要加入任何其他词语,只能加性别,在男、女或中性中选
|
|
@@ -74,7 +72,8 @@ class DeepSeekService
|
|
|
'stream' => false // 是否流式输出,如果设置为 True,将会以 SSE(server-sent events)的形式以流式发送消息增量。消息流以 data: [DONE] 结尾。
|
|
|
];
|
|
|
|
|
|
- $result = $this->client->post($this->url, ['json' => $post_data, 'headers' => $this->headers]);
|
|
|
+ $client = new Client(['timeout' => 1200, 'verify' => false]);
|
|
|
+ $result = $client->post($this->url, ['json' => $post_data, 'headers' => $this->headers]);
|
|
|
$response = $result->getBody()->getContents();
|
|
|
$response_arr = json_decode($response, true);
|
|
|
$update_data = [];
|
|
@@ -403,7 +402,8 @@ class DeepSeekService
|
|
|
'stream' => false // 是否流式输出,如果设置为 True,将会以 SSE(server-sent events)的形式以流式发送消息增量。消息流以 data: [DONE] 结尾。
|
|
|
];
|
|
|
|
|
|
- $result = $this->client->post($this->url, ['json' => $post_data, 'headers' => $this->headers]);
|
|
|
+ $client = new Client(['timeout' => 1200, 'verify' => false]);
|
|
|
+ $result = $client->post($this->url, ['json' => $post_data, 'headers' => $this->headers]);
|
|
|
$response = $result->getBody()->getContents();
|
|
|
$response_arr = json_decode($response, true);
|
|
|
$update_data = [];
|