diff --git a/components/ChatInputBox/ChatInputBox.tsx b/components/ChatInputBox/ChatInputBox.tsx index 673bf0b..7765048 100644 --- a/components/ChatInputBox/ChatInputBox.tsx +++ b/components/ChatInputBox/ChatInputBox.tsx @@ -215,147 +215,129 @@ const RenderTemplateStoryMode = ({ > Template Configuration -
+
{selectedTemplate.fillable_content.map((field, index) => (
- {/* 字段名称 */} -
- {/* 图片缩略图 - 显示对应角色的图片 */} -
- -
- role.role_name === field.field_name - )?.photo_url || "/assets/empty_video.png" + {/* 图片容器 */} +
+ + + updateFillableContentField( + field.field_name, + e.target.value + ) } - alt={field.field_name} - className="w-full h-full object-cover" - preview={{ - mask: null, - maskClassName: "hidden", - }} - fallback="/assets/empty_video.png" + placeholder={`${field.field_description}`} + className="w-[30rem] px-3 py-2 pr-16 bg-white/0 border border-white/10 rounded-lg text-white placeholder-gray-400 focus:outline-none focus:border-blue-500 focus:ring-1 focus:ring-blue-500/30 transition-all duration-200 text-sm" /> +
+ {/* AI生成按钮 */} + + handleFieldBlur( + field.field_name, + field.field_value || "" + ) + } + icon={} + width="w-8" + height="h-8" + /> +
- - - {/* 上传按钮 - 右上角 */} - { - // 验证文件类型 - const isImage = file.type.startsWith("image/"); - if (!isImage) { - console.error("只能上传图片文件"); - return false; - } - - // 验证文件大小 (5MB) - const isLt5M = file.size / 1024 / 1024 < 5; - if (!isLt5M) { - console.error("图片大小不能超过5MB"); - return false; - } - - return true; - }} - customRequest={async ({ - file, - onSuccess, - onError, - }) => { - try { - const fileObj = file as File; - console.log( - "开始上传字段图片文件:", - fileObj.name, - fileObj.type, - fileObj.size - ); - - // 使用 hook 上传文件到七牛云 - const uploadedUrl = await uploadFile( - fileObj, - (progress) => { - console.log(`上传进度: ${progress}%`); - } - ); - console.log( - "字段图片上传成功,URL:", - uploadedUrl - ); - - // 调用 AvatarAndAnalyzeFeatures 更新对应角色的图片 - await AvatarAndAnalyzeFeatures( - uploadedUrl, - field.field_name - ); - - onSuccess?.(uploadedUrl); - } catch (error) { - console.error("字段图片上传失败:", error); - onError?.(error as Error); - } - }} + } + placement="top" + classNames={{ + root: "max-w-none", + }} + trigger="hover" + styles={{ root: { zIndex: 1000 } }} + > + {/* 图片 */} +
+ role.role_name === field.field_name + )?.photo_url || "/assets/empty_video.png" + } + alt={field.field_name} + className="w-full h-full object-cover" + preview={{ + mask: null, + maskClassName: "hidden", + }} + fallback="/assets/empty_video.png" + /> +
+ + + {/* 角色名称 - 图片下方 */} +
+ + {field.field_name} + +
+ + {/* 上传按钮 - 右上角 */} + { + const isImage = file.type.startsWith("image/"); + if (!isImage) { + console.error("只能上传图片文件"); + return false; + } + const isLt5M = file.size / 1024 / 1024 < 5; + if (!isLt5M) { + console.error("图片大小不能超过5MB"); + return false; + } + return true; + }} + customRequest={async ({ file, onSuccess, onError }) => { + try { + const fileObj = file as File; + const uploadedUrl = await uploadFile( + fileObj, + (progress) => { + console.log(`上传进度: ${progress}%`); + } + ); + await AvatarAndAnalyzeFeatures( + uploadedUrl, + field.field_name + ); + onSuccess?.(uploadedUrl); + } catch (error) { + console.error("字段图片上传失败:", error); + onError?.(error as Error); + } + }} + > + - -
-
- - {/* 输入框 */} -
- - updateFillableContentField( - field.field_name, - e.target.value - ) - } - onBlur={(e) => - handleFieldBlur(field.field_name, e.target.value) - } - placeholder={`${field.field_description}`} - className="w-full px-3 py-2 pr-10 bg-white/10 border border-white/20 rounded-lg text-white placeholder-gray-400 focus:outline-none focus:border-blue-500 focus:ring-1 focus:ring-blue-500/30 transition-all duration-200" - /> - - {/* 问号提示 - 直接放在输入框内部右侧 */} - {field.field_description && ( - -
- - ? - -
- )} +
))} diff --git a/components/common/ActionButton.tsx b/components/common/ActionButton.tsx index 4de10bf..58b130b 100644 --- a/components/common/ActionButton.tsx +++ b/components/common/ActionButton.tsx @@ -5,19 +5,25 @@ export function ActionButton({ isCreating, handleCreateVideo, icon, + width = "w-12", + height = "h-12", + className = "", }: { isCreating: boolean; handleCreateVideo: () => void; icon: React.ReactNode; + width?: string; + height?: string; + className?: string; }) { return ( -
+
-
+
-
+
);