This commit is contained in:
2026-07-11 12:38:03 +08:00
parent cba3450596
commit c64cf06c33
31 changed files with 703 additions and 1971 deletions
+6 -12
View File
@@ -978,7 +978,7 @@ const AIChatPage: React.FC = () => {
}
// console.log(mediaReferences);
console.log(mediaReferences);
// 创建用户消息对象
const newMessage: Message = {
@@ -1240,7 +1240,7 @@ const AIChatPage: React.FC = () => {
try {
const { width, height } = await getImageDimensions(file);
const error = validateImageDimensions(width, height);
const error = validateVideoDimensions(width, height);
if (error) {
antdMessage.error(error);
return false;
@@ -1316,7 +1316,7 @@ const AIChatPage: React.FC = () => {
if (isImage) {
try {
const { width, height } = await getImageDimensions(file);
const error = validateImageDimensions(width, height);
const error = validateVideoDimensions(width, height);
if (error) {
antdMessage.error(error);
return false;
@@ -1456,7 +1456,7 @@ const AIChatPage: React.FC = () => {
if (isImage) {
try {
const { width, height } = await getImageDimensions(file);
const error = validateImageDimensions(width, height);
const error = validateVideoDimensions(width, height);
if (error) {
antdMessage.error(error);
return false;
@@ -2183,16 +2183,13 @@ const AIChatPage: React.FC = () => {
onClick={(e) => {
e.stopPropagation();
setInputValue(msg.originalPrompt || '');
if (msg.genType) {
setMediaType(msg.genType);
}
if (msg.mediaReferences && msg.mediaReferences.length > 0) {
const hasFirstLastFrame = msg.mediaReferences.some((ref: any) => ref.role === 'first_frame' || ref.role === 'last_frame');
if (hasFirstLastFrame && msg.genType === 'video') {
const first = msg.mediaReferences.find((ref: any) => ref.role === 'first_frame');
const last = msg.mediaReferences.find((ref: any) => ref.role === 'last_frame');
setFirstFrame(first ? { ...first, label: first.label || '', duration: first.duration } : null);
setLastFrame(last ? { ...last, label: last.label || '', duration: last.duration } : null);
setFirstFrame(first ? { ...first, label: first.label || '' } : null);
setLastFrame(last ? { ...last, label: last.label || '' } : null);
setCurrentMedia([]);
setReferenceMode('first_last_frame');
} else {
@@ -2202,7 +2199,6 @@ const AIChatPage: React.FC = () => {
url: ref.url,
label: ref.label || '',
role: ref.role,
duration: ref.duration,
})));
setFirstFrame(null);
setLastFrame(null);
@@ -2891,7 +2887,6 @@ const AIChatPage: React.FC = () => {
usedAudioCount={currentMedia.filter(m => m.type === 'audio').length}
maxAudioDuration={15}
usedAudioDuration={currentMedia.filter(m => m.type === 'audio').reduce((sum, m) => sum + (m.duration || 0), 0)}
hideLimitHint={mediaType === 'image'}
>
<div
style={{
@@ -3073,7 +3068,6 @@ const AIChatPage: React.FC = () => {
usedAudioCount={currentMedia.filter(m => m.type === 'audio').length}
maxAudioDuration={15}
usedAudioDuration={currentMedia.filter(m => m.type === 'audio').reduce((sum, m) => sum + (m.duration || 0), 0)}
hideLimitHint={mediaType === 'image'}
>
<div
style={{