diff --git a/api/DTO/movie_start_dto.ts b/api/DTO/movie_start_dto.ts index 898ec98..b56d85c 100644 --- a/api/DTO/movie_start_dto.ts +++ b/api/DTO/movie_start_dto.ts @@ -209,7 +209,11 @@ export interface CreateMovieProjectV3Request { /**角色名 */ role_name: string; /**角色描述 */ - role_description: string; + role_description: { + name: string; + image_url: string; + character_analysis: Record; + }; /**照片URL */ photo_url: string; /**声音URL */ diff --git a/app/service/Interaction/templateStoryService.ts b/app/service/Interaction/templateStoryService.ts index 30d3413..4159746 100644 --- a/app/service/Interaction/templateStoryService.ts +++ b/app/service/Interaction/templateStoryService.ts @@ -126,12 +126,11 @@ export const useTemplateStoryServiceHook = (): UseTemplateStoryService => { } try { - const character_briefs = { + const character_brief = { name: selectedTemplate.storyRole[activeRoleIndex].role_name, image_url: imageUrl, character_analysis: JSON.parse(desc).character_analysis, }; - console.log("character_briefs", character_briefs); const updatedTemplate = { ...selectedTemplate, storyRole: selectedTemplate.storyRole.map((role, index) => @@ -139,7 +138,7 @@ export const useTemplateStoryServiceHook = (): UseTemplateStoryService => { ? { ...role, photo_url: imageUrl, - role_description: JSON.stringify(character_briefs), + role_description: character_brief, } : role ), diff --git a/app/service/domain/Entities.ts b/app/service/domain/Entities.ts index 3a7dca7..322c1eb 100644 --- a/app/service/domain/Entities.ts +++ b/app/service/domain/Entities.ts @@ -146,8 +146,12 @@ export interface StoryTemplateEntity { storyRole: { /**角色名 */ role_name: string; - /**角色描述 */ - role_description: string; + /**角色描述 对应后端是单个的character_brief */ + role_description: { + name: string; + image_url: string; + character_analysis: Record; + }; /**照片URL */ photo_url: string; /**声音URL */ diff --git a/components/ChatInputBox/AudioRecorder.tsx b/components/ChatInputBox/AudioRecorder.tsx index 43a2d3a..2e35188 100644 --- a/components/ChatInputBox/AudioRecorder.tsx +++ b/components/ChatInputBox/AudioRecorder.tsx @@ -72,6 +72,44 @@ const audioRecorderStyles = ` background: #2563eb; transform: scale(1.1); } + + /* 音量滑块样式 */ + .volume-slider { + -webkit-appearance: none; + appearance: none; + background: transparent; + cursor: pointer; + } + + .volume-slider::-webkit-slider-track { + background: transparent; + height: 16px; + border-radius: 8px; + } + + .volume-slider::-webkit-slider-thumb { + -webkit-appearance: none; + appearance: none; + width: 0; + height: 0; + box-shadow: -100px 0 5px 100px #92ff77, -100px 0px 20px 100px #92ff77; + cursor: pointer; + } + + .volume-slider::-moz-range-track { + background: transparent; + height: 16px; + border-radius: 8px; + border: none; + } + + .volume-slider::-moz-range-thumb { + width: 0; + height: 0; + border-radius: 0; + border: none; + box-shadow: -100px 0 5px 100px #92ff77, -100px 0px 20px 100px #92ff77; + } `; interface AudioRecorderProps { @@ -229,8 +267,11 @@ export function AudioRecorder({ // 音量调节 const handleVolumeChange = (e: React.ChangeEvent) => { const newVolume = parseFloat(e.target.value); - setVolume(newVolume); - if (isMuted && newVolume > 0) { + // 确保音量值在 0-1 范围内 + const clampedVolume = Math.max(0, Math.min(1, newVolume)); + console.log("newVolume", newVolume, "clampedVolume", clampedVolume); + setVolume(clampedVolume); + if (isMuted && clampedVolume > 0) { setIsMuted(false); } }; @@ -446,7 +487,7 @@ export function AudioRecorder({ data-alt="audio-player-container" > {/* 大旋转的播放圆盘 */} -
+
{/* 外层边框 - 唱片边缘 */}
- + {/* 播放控制 */} + {/* 头部 - 只显示操作按钮 */} -
+
- {/* 播放控制 */} -
- - {/* WaveSurfer 波形图区域 */} -
- -
-
- {/* 音频设置 */} -
-
- {/* 音量控制 */} -
-
-
- {/* 可拖拽的音量滑块 */} - - {/* 视觉滑块指示器 */} -
-
- {/* 音频图标 */} -
- -
-
-
+
+ +
+ {/* WaveSurfer 波形图区域 */} +
+
@@ -721,3 +729,130 @@ function WaveformPlayer({
); } + +function VolumeSlider({ + volume, + onVolumeChange, +}: { + volume: number; + onVolumeChange: (e: React.ChangeEvent) => void; +}) { + const [isHovered, setIsHovered] = useState(false); + + return ( +
+ + +
+ ); +} diff --git a/components/ChatInputBox/ChatInputBox.tsx b/components/ChatInputBox/ChatInputBox.tsx index 90614ce..8055c03 100644 --- a/components/ChatInputBox/ChatInputBox.tsx +++ b/components/ChatInputBox/ChatInputBox.tsx @@ -365,7 +365,7 @@ const RenderTemplateStoryMode = ({
{/* 弹窗头部 */} -
+

Template Story Selection