|
|
@@ -2674,6 +2674,7 @@ class DeepSeekService
|
|
|
$bid = getProp($data, 'bid', 0);
|
|
|
$script_id = getProp($data, 'script_id', 0);
|
|
|
$prompt = getProp($data, 'prompt');
|
|
|
+ $user_anime_name = getProp($anime, 'anime_name');
|
|
|
|
|
|
// 处理文本模型
|
|
|
$model = getProp($data, 'model');
|
|
|
@@ -2724,6 +2725,7 @@ class DeepSeekService
|
|
|
|
|
|
// 美术风格
|
|
|
$input_art_style = getProp($data, 'art_style');
|
|
|
+ $mappedArtStyle = $this->getArtStylePromptByInput($input_art_style);
|
|
|
$timbres_content = "青年男:北京小爷、阳光青年、傲娇霸总、优柔公子、解说小明、青涩小生、低音沉郁、亲切青年
|
|
|
青年女:柔美女友、魅力女友、爽快思思、高冷御姐、知性温婉、甜心小美、清新女声、甜美桃子、温柔文雅、甜美小源、贴心闺蜜
|
|
|
中年男:胡子叔叔、油腻大叔、神秘法师、优柔帮主
|
|
|
@@ -2739,6 +2741,13 @@ class DeepSeekService
|
|
|
$content_generation_requirement = $need_generate_content
|
|
|
? "\n5.如果用户只提供了创作要求而没有提供具体文档内容,你需要根据要求创作完整的原文内容(小说形式,包含对话和叙述),并将原文内容放在最后一个板块###原文内容中输出。原文内容应该详细、生动,如果用户没有明确生成的字数,则字数不少于1000字。"
|
|
|
: "";
|
|
|
+
|
|
|
+ // 美术风格
|
|
|
+ if (!$mappedArtStyle) {
|
|
|
+ $mappedArtStyle_prompt = '美术风格:根据剧本内容自定义美术风格';
|
|
|
+ }else {
|
|
|
+ $mappedArtStyle_prompt = "美术风格:必须按照\n<基础画风风格词: {$input_art_style}\n{$mappedArtStyle}>\n原样输出,不得更改任何内容";
|
|
|
+ }
|
|
|
|
|
|
$systemPrompt = $is_single
|
|
|
? "你是一个专业的文档分析助手及资深编剧,请根据用户提供的文档内容输出单剧集完整策划稿。单剧集模式下,必须一次性输出可直接保存的大纲与完整分镜,不允许只输出大纲。
|
|
|
@@ -2750,6 +2759,7 @@ class DeepSeekService
|
|
|
5.强制按照示例格式返回内容,不要更改格式或随意增加符号\n
|
|
|
普通要求:
|
|
|
1.剧集标题必须与文档内容高度相关,剧集序号是1。
|
|
|
+ 2.{$mappedArtStyle_prompt}
|
|
|
2.<主体列表>中出现的主体必须尽可能统一,只允许同一个角色年龄段相差较大的情况下可重复,比如角色-少年、角色-青年、角色-中年、角色-老年这种情况,不得出现角色-愤怒、角色-隐忍、角色-求生等情绪和状态变化的同一角色;并且角色的样貌、形体及穿着描述尽可能详细
|
|
|
2.1<主体列表>的音色必须在以下音色中($timbres_content)选择,需要角色描述的年纪和性别选择,比如角色是青年男性就只能在北京小爷、阳光青年、傲娇霸总、优柔公子、解说小明、青涩小生、低音沉郁、亲切青年中选择,选好的音色放在描述的最后用{{}}框起来。
|
|
|
3.2.<场景列表>与主体列表同理,需尽可能的对场景环境进行详细描述
|
|
|
@@ -2861,6 +2871,7 @@ class DeepSeekService
|
|
|
5.强制按照示例格式返回内容,不要更改格式或随意增加符号\n
|
|
|
普通要求:\n
|
|
|
1.<主体列表>中出现的主体必须尽可能统一,只允许同一个角色年龄段相差较大的情况下可重复,比如梁萧-少年、梁萧-青年、梁萧-中年、梁萧-老年这种情况,不得出现梁萧-愤怒、梁萧-隐忍、梁萧-求生等情绪和状态变化的同一角色;并且角色的样貌、形体及穿着描述尽可能详细\n
|
|
|
+ 2.{$mappedArtStyle_prompt}
|
|
|
2.<场景列表>与主体列表同理,需尽可能的对场景环境进行详细描述\n\n
|
|
|
示例如下:\n
|
|
|
###剧本名:西昆仑
|
|
|
@@ -3101,58 +3112,62 @@ class DeepSeekService
|
|
|
}
|
|
|
|
|
|
// 新建动漫
|
|
|
- $anime_name = getProp($script_arr, 'script_name');
|
|
|
- $origin_anime_name = $anime_name;
|
|
|
- if (!$anime_name) {
|
|
|
- // 未识别到剧本名,保存对话记录并返回提示
|
|
|
- dLog('deepseek')->info('未能识别到剧本名称');
|
|
|
- try {
|
|
|
- DB::beginTransaction();
|
|
|
- $now = date('Y-m-d H:i:s');
|
|
|
+ if ($user_anime_name == '新剧本策划') {
|
|
|
+ $anime_name = getProp($script_arr, 'script_name');
|
|
|
+ $origin_anime_name = $anime_name;
|
|
|
+ if (!$anime_name) {
|
|
|
+ // 未识别到剧本名,保存对话记录并返回提示
|
|
|
+ dLog('deepseek')->info('未能识别到剧本名称');
|
|
|
+ try {
|
|
|
+ DB::beginTransaction();
|
|
|
+ $now = date('Y-m-d H:i:s');
|
|
|
+
|
|
|
+ // 保存对话记录
|
|
|
+ $records = [
|
|
|
+ [
|
|
|
+ 'uid' => $uid,
|
|
|
+ 'anime_id' => $anime_id,
|
|
|
+ 'sequence' => 0,
|
|
|
+ 'role' => 'user',
|
|
|
+ 'content' => $prompt,
|
|
|
+ 'created_at' => $now,
|
|
|
+ 'updated_at' => $now
|
|
|
+ ],
|
|
|
+ [
|
|
|
+ 'uid' => $uid,
|
|
|
+ 'anime_id' => $anime_id,
|
|
|
+ 'sequence' => 0,
|
|
|
+ 'role' => 'assistant',
|
|
|
+ 'content' => '未能生成剧本名称,请重试',
|
|
|
+ 'created_at' => $now,
|
|
|
+ 'updated_at' => $now
|
|
|
+ ]
|
|
|
+ ];
|
|
|
+ DB::table('mp_anime_records')->insert($records);
|
|
|
+ DB::commit();
|
|
|
+ } catch (\Exception $e) {
|
|
|
+ DB::rollBack();
|
|
|
+ dLog('deepseek')->error('保存对话记录失败', ['error' => $e->getMessage()]);
|
|
|
+ }
|
|
|
|
|
|
- // 保存对话记录
|
|
|
- $records = [
|
|
|
- [
|
|
|
- 'uid' => $uid,
|
|
|
- 'anime_id' => $anime_id,
|
|
|
- 'sequence' => 0,
|
|
|
- 'role' => 'user',
|
|
|
- 'content' => $prompt,
|
|
|
- 'created_at' => $now,
|
|
|
- 'updated_at' => $now
|
|
|
- ],
|
|
|
- [
|
|
|
- 'uid' => $uid,
|
|
|
- 'anime_id' => $anime_id,
|
|
|
- 'sequence' => 0,
|
|
|
- 'role' => 'assistant',
|
|
|
- 'content' => '未能生成剧本名称,请重试',
|
|
|
- 'created_at' => $now,
|
|
|
- 'updated_at' => $now
|
|
|
- ]
|
|
|
+ yield [
|
|
|
+ 'type' => 'done',
|
|
|
+ 'script' => [],
|
|
|
+ 'episode' => [],
|
|
|
+ 'answer' => $fullContent,
|
|
|
+ 'reasoning' => $fullReasoningContent,
|
|
|
+ 'usage' => $usage,
|
|
|
+ 'error' => '未能识别到剧本名称,请调整提示词再试'
|
|
|
];
|
|
|
- DB::table('mp_anime_records')->insert($records);
|
|
|
- DB::commit();
|
|
|
- } catch (\Exception $e) {
|
|
|
- DB::rollBack();
|
|
|
- dLog('deepseek')->error('保存对话记录失败', ['error' => $e->getMessage()]);
|
|
|
+ return;
|
|
|
}
|
|
|
-
|
|
|
- yield [
|
|
|
- 'type' => 'done',
|
|
|
- 'script' => [],
|
|
|
- 'episode' => [],
|
|
|
- 'answer' => $fullContent,
|
|
|
- 'reasoning' => $fullReasoningContent,
|
|
|
- 'usage' => $usage,
|
|
|
- 'error' => '未能识别到剧本名称,请调整提示词再试'
|
|
|
- ];
|
|
|
- return;
|
|
|
- }
|
|
|
|
|
|
- // 确认对话名称唯一性
|
|
|
- if (DB::table('mp_animes')->where('anime_name', $anime_name)->value('id')) {
|
|
|
- $anime_name = $anime_name . '_' . date('YmdHis');
|
|
|
+ // 确认对话名称唯一性
|
|
|
+ if (DB::table('mp_animes')->where('anime_name', $anime_name)->value('id')) {
|
|
|
+ $anime_name = $anime_name . '_' . date('YmdHis');
|
|
|
+ }
|
|
|
+ }else {
|
|
|
+ $origin_anime_name = $anime_name = $user_anime_name;
|
|
|
}
|
|
|
|
|
|
$table_data = [
|
|
|
@@ -3335,6 +3350,7 @@ class DeepSeekService
|
|
|
if (!$anime) {
|
|
|
Utils::throwError('20003:该对话不存在');
|
|
|
}
|
|
|
+ $user_anime_name = getProp($anime, 'anime_name');
|
|
|
$prompt = getProp($data, 'prompt');
|
|
|
|
|
|
// 处理文本模型
|
|
|
@@ -3838,11 +3854,16 @@ class DeepSeekService
|
|
|
$fullContent = $this->replaceArtStyleSection($fullContent, $mappedArtStyle);
|
|
|
}
|
|
|
|
|
|
- $anime_name = isset($script_arr['script_name']) ? $script_arr['script_name'] : '';
|
|
|
- // 确认对话名称唯一性
|
|
|
- if ($anime_name && $id = DB::table('mp_animes')->where('anime_name', $anime_name)->value('id')) {
|
|
|
- if ($id != $anime_id) $anime_name = $anime_name . '_' . date('YmdHis');
|
|
|
+ if ($user_anime_name != '新剧本策划') {
|
|
|
+ $anime_name = isset($script_arr['script_name']) ? $script_arr['script_name'] : '';
|
|
|
+ // 确认对话名称唯一性
|
|
|
+ if ($anime_name && $id = DB::table('mp_animes')->where('anime_name', $anime_name)->value('id')) {
|
|
|
+ if ($id != $anime_id) $anime_name = $anime_name . '_' . date('YmdHis');
|
|
|
+ }
|
|
|
+ }else {
|
|
|
+ $anime_name = $user_anime_name;
|
|
|
}
|
|
|
+
|
|
|
|
|
|
$table_data = [
|
|
|
'user_id' => $uid,
|