“重新编辑修改”
This commit is contained in:
+7
-7
File diff suppressed because one or more lines are too long
Vendored
+1
-1
@@ -28,7 +28,7 @@
|
||||
}
|
||||
})();
|
||||
</script>
|
||||
<script type="module" crossorigin src="/assets/index-OcL9GWjl.js"></script>
|
||||
<script type="module" crossorigin src="/assets/index-BeB-hsdi.js"></script>
|
||||
<link rel="stylesheet" crossorigin href="/assets/index-JhRVnnL-.css">
|
||||
</head>
|
||||
<body>
|
||||
|
||||
@@ -174,6 +174,8 @@ const AIChatPage: React.FC = () => {
|
||||
|
||||
const [loading, setLoading] = useState<boolean>(false);
|
||||
|
||||
const [enginesLoaded, setEnginesLoaded] = useState(false);
|
||||
|
||||
const [referenceMode, setReferenceMode] = useState<'universal' | 'first_last_frame'>('universal');
|
||||
const [firstFrame, setFirstFrame] = useState<MediaReference | null>(null);
|
||||
const [lastFrame, setLastFrame] = useState<MediaReference | null>(null);
|
||||
@@ -203,6 +205,7 @@ const AIChatPage: React.FC = () => {
|
||||
// @ 提及相关状态
|
||||
const [mentionVisible, setMentionVisible] = useState(false);
|
||||
const mentionInputRef = useRef<any>(null);
|
||||
const isReEditingRef = useRef(false);
|
||||
const [mentionPosition, setMentionPosition] = useState({ top: 0, left: 0 });
|
||||
|
||||
// 数字转中文数字(一、二、三、四)
|
||||
@@ -539,16 +542,19 @@ const AIChatPage: React.FC = () => {
|
||||
}, [gen_list.length, scrollToBottom]);
|
||||
|
||||
useEffect(() => {
|
||||
if (isReEditingRef.current) {
|
||||
isReEditingRef.current = false;
|
||||
return;
|
||||
}
|
||||
if (!enginesLoaded) return;
|
||||
const newOptions = mediaType === 'image' ? enginesele.image : enginesele.video;
|
||||
if (newOptions && newOptions.length > 0) {
|
||||
// 如果当前 countType 不在新选项中,重置为第一个选项
|
||||
const isValidOption = newOptions.some((item: any) => item.id === countType);
|
||||
if (!isValidOption) {
|
||||
setCountType(newOptions[0].id);
|
||||
}
|
||||
|
||||
}
|
||||
}, [mediaType, enginesele]);
|
||||
}, [mediaType, enginesele, enginesLoaded]);
|
||||
|
||||
// 点击外部关闭弹窗
|
||||
useEffect(() => {
|
||||
@@ -579,6 +585,10 @@ const AIChatPage: React.FC = () => {
|
||||
}, [showMediaTypeModal, showEngineModal, showImageSettingsModal, showVideoSettingsModal]);
|
||||
|
||||
useEffect(() => {
|
||||
if (isReEditingRef.current) {
|
||||
isReEditingRef.current = false;
|
||||
return;
|
||||
}
|
||||
if (mediaType !== 'video') return;
|
||||
const engine = enginesele?.video?.find((e: any) => e.id === countType);
|
||||
if (!engine) return;
|
||||
@@ -602,6 +612,7 @@ const AIChatPage: React.FC = () => {
|
||||
// console.log('引擎', data);
|
||||
|
||||
setEnginesele(data.engine);
|
||||
setEnginesLoaded(true);
|
||||
|
||||
// 如果是视频模式,初始化视频参数选项
|
||||
if (data.engine.video && data.engine.video.length > 0) {
|
||||
@@ -2183,7 +2194,60 @@ const AIChatPage: React.FC = () => {
|
||||
onClick={(e) => {
|
||||
e.stopPropagation();
|
||||
setInputValue(msg.originalPrompt || '');
|
||||
let engineFound = true;
|
||||
const engineId = msg.engineId || msg.engineSnapshot?.id || msg.engine_id;
|
||||
if (engineId && msg.genType) {
|
||||
const engineList = msg.genType === 'image' ? enginesele.image : enginesele.video;
|
||||
const engine = engineList?.find((e: any) => e.id === engineId);
|
||||
if (engine) {
|
||||
setCountType(engine.id);
|
||||
if (msg.genType === 'video') {
|
||||
setEngineOptions({
|
||||
ratios: engine.supportedRatios || ['16:9', '4:3', '1:1', '3:4', '9:16', '21:9'],
|
||||
resolutions: engine.supportedResolutions || ['480p', '720p', '1080p'],
|
||||
durations: engine.supportedDurations || [5, 8, 10, 12, 15],
|
||||
});
|
||||
}
|
||||
if (msg.genType === 'image') {
|
||||
const supportedSizes = engine.supportedSizes || {};
|
||||
const resolutionLevels = Object.keys(supportedSizes).sort((a, b) => {
|
||||
const levelOrder = { '1K': 0, '2K': 1, '4K': 2 };
|
||||
return (levelOrder[a] || 0) - (levelOrder[b] || 0);
|
||||
});
|
||||
const primaryResolution = resolutionLevels[0] || '2K';
|
||||
const supportedResolutions = Object.keys(supportedSizes[primaryResolution] || {});
|
||||
const newRatioOptions = supportedResolutions.map((res: any) => ({
|
||||
value: res,
|
||||
label: res,
|
||||
}));
|
||||
setRatioOptions(newRatioOptions);
|
||||
setCurrentEngineSupportedSizes(supportedSizes);
|
||||
setResolutionOptions(resolutionLevels.map((level) => {
|
||||
const match = level.match(/(\d+)K/);
|
||||
const num = match ? parseInt(match[1]) : 1;
|
||||
const labels: Record<number, string> = { 1: '标清', 2: '高清', 4: '超清' };
|
||||
return {
|
||||
value: level,
|
||||
label: `${labels[num] || '高清'} ${level}`,
|
||||
};
|
||||
}));
|
||||
if (supportedSizes[primaryResolution] && supportedSizes[primaryResolution][supportedResolutions[0]]) {
|
||||
const defaultSize = supportedSizes[primaryResolution][supportedResolutions[0]];
|
||||
const [w, h] = defaultSize.split(/[×x]/);
|
||||
setWidth(Number(w));
|
||||
setHeight(Number(h));
|
||||
setSelectedRatio(supportedResolutions[0]);
|
||||
setSelectedResolution(primaryResolution);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
msgApi.error('该引擎已删除,无法重新编辑');
|
||||
engineFound = false;
|
||||
}
|
||||
}
|
||||
if (!engineFound) return;
|
||||
if (msg.genType) {
|
||||
isReEditingRef.current = true;
|
||||
setMediaType(msg.genType);
|
||||
}
|
||||
if (msg.mediaReferences && msg.mediaReferences.length > 0) {
|
||||
|
||||
@@ -1037,7 +1037,7 @@ const HomePage: React.FC = () => {
|
||||
</div>
|
||||
|
||||
{/* 素材案例网格 */}
|
||||
<div className="stagger-children" style={{ display: 'flex', flexWrap: 'wrap', gap: 16, justifyContent: 'space-between', overflowX: 'auto', paddingBottom: 8 }}>
|
||||
<div className="stagger-children" style={{ display: 'flex', flexWrap: 'wrap', gap: 16, justifyContent: 'flex-start', overflowX: 'auto', paddingBottom: 8 }}>
|
||||
{caseAssets.length === 0 ? (
|
||||
<div style={{
|
||||
flex: 1,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import React, { useMemo } from 'react';
|
||||
import { Button, Card, Result, Typography } from 'antd';
|
||||
import { Button, Card, Result, Typography, message } from 'antd';
|
||||
|
||||
const successStatuses = new Set(['group_active', 'callback_success']);
|
||||
|
||||
@@ -9,6 +9,40 @@ const PrivatePortraitAuthorizeResult: React.FC = () => {
|
||||
const resultCode = params.get('resultCode') || '';
|
||||
const isSuccess = successStatuses.has(status) || resultCode === '10000';
|
||||
|
||||
const handleClose = () => {
|
||||
const isWeChat = /MicroMessenger/i.test(navigator.userAgent);
|
||||
const isAlipay = /AlipayClient/i.test(navigator.userAgent);
|
||||
const isMobile = /Android|iPhone|iPad/i.test(navigator.userAgent);
|
||||
|
||||
if (isWeChat) {
|
||||
try {
|
||||
window.opener = null;
|
||||
window.open('', '_self');
|
||||
window.close();
|
||||
} catch {
|
||||
message.info('请点击右上角关闭按钮');
|
||||
}
|
||||
} else if (isAlipay) {
|
||||
try {
|
||||
window.close();
|
||||
} catch {
|
||||
message.info('请点击左上角返回');
|
||||
}
|
||||
} else if (isMobile) {
|
||||
try {
|
||||
window.history.back();
|
||||
} catch {
|
||||
window.location.href = '/';
|
||||
}
|
||||
} else {
|
||||
try {
|
||||
window.close();
|
||||
} catch {
|
||||
window.location.href = '/';
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
<div style={{ minHeight: '100vh', display: 'flex', alignItems: 'center', justifyContent: 'center', background: '#f8fafc', padding: 20 }}>
|
||||
<Card style={{ width: '100%', maxWidth: 520, borderRadius: 18 }}>
|
||||
@@ -17,11 +51,11 @@ const PrivatePortraitAuthorizeResult: React.FC = () => {
|
||||
title={isSuccess ? '真人认证已完成' : '真人认证未完成'}
|
||||
subTitle={isSuccess ? '请回到电脑端查看,项目组已创建成功。' : '请回到电脑端重新发起创建项目组。'}
|
||||
extra={[
|
||||
<Button key="close" type="primary" onClick={() => window.close()}>关闭页面</Button>,
|
||||
<Button key="close" type="primary" onClick={handleClose}>关闭页面</Button>,
|
||||
]}
|
||||
/>
|
||||
<Typography.Paragraph type="secondary" style={{ textAlign: 'center', marginBottom: 0 }}>
|
||||
当前状态:{status || '-'},结果码:{resultCode || '-'}
|
||||
<Typography.Paragraph type="secondary" style={{ textAlign: 'center', marginBottom: 0, fontSize: 13, marginTop: 12 }}>
|
||||
如无法自动关闭,请手动关闭页面
|
||||
</Typography.Paragraph>
|
||||
</Card>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user