|
@@ -17,26 +17,22 @@ import PopupTryout from "./components/popup-tryout/index";
|
|
import style from "./index.module.less";
|
|
import style from "./index.module.less";
|
|
import { useVoiceStore } from "@/store/voiceStore";
|
|
import { useVoiceStore } from "@/store/voiceStore";
|
|
import { EVoiceStatus, TVoiceItem } from "@/types/voice";
|
|
import { EVoiceStatus, TVoiceItem } from "@/types/voice";
|
|
|
|
+import { TAgentDetail } from "@/types/agent";
|
|
|
|
|
|
interface Props {
|
|
interface Props {
|
|
|
|
+ agent: TAgentDetail|null
|
|
value?: ICharacter;
|
|
value?: ICharacter;
|
|
setValue?: (value: ICharacter) => void;
|
|
setValue?: (value: ICharacter) => void;
|
|
onPlay?: (voice: any) => void;
|
|
onPlay?: (voice: any) => void;
|
|
}
|
|
}
|
|
|
|
|
|
-export default ({ onPlay }: Props) => {
|
|
|
|
- const playerRef = useRef<IVoicePlayerBar>(null);
|
|
|
|
|
|
+export default ({ onPlay, agent }: Props) => {
|
|
const intervalRef = useRef<NodeJS.Timeout | null>(null);
|
|
const intervalRef = useRef<NodeJS.Timeout | null>(null);
|
|
const [show, setShow] = useState(false);
|
|
const [show, setShow] = useState(false);
|
|
const [popupType, setPopupType] = useState<"clone" | "try" | "reclone">(
|
|
const [popupType, setPopupType] = useState<"clone" | "try" | "reclone">(
|
|
"clone",
|
|
"clone",
|
|
);
|
|
);
|
|
-
|
|
|
|
- const [voiceName, setVoiceName] = useState("");
|
|
|
|
- const [voiceIndex, setVoiceIndex] = useState(-1);
|
|
|
|
-
|
|
|
|
- // const { saveCharacter, fetchCharacter, fetchVoiceCloneHistory } =
|
|
|
|
- // useCharacterStore();
|
|
|
|
|
|
+
|
|
const {getVoices} = useVoiceStore()
|
|
const {getVoices} = useVoiceStore()
|
|
const voices = useVoiceStore(state => state.voices)
|
|
const voices = useVoiceStore(state => state.voices)
|
|
const myVoices = useVoiceStore(state => state.myVoices)
|
|
const myVoices = useVoiceStore(state => state.myVoices)
|
|
@@ -45,26 +41,21 @@ export default ({ onPlay }: Props) => {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
- const handleSelect = (item: TVoiceItem, index: number) => {
|
|
|
|
- setVoiceIndex(index);
|
|
|
|
-
|
|
|
|
- if (item.status == CloneVoiceStatus.CloneVoiceStatusSuccess) {
|
|
|
|
|
|
+ const handleSelect = (item: TVoiceItem) => {
|
|
|
|
+ if (item.status == EVoiceStatus.DONE) {
|
|
if (item.voiceName) {
|
|
if (item.voiceName) {
|
|
- setVoiceName(item.voiceName);
|
|
|
|
|
|
+ // setVoiceName(item.voiceName);
|
|
onPlay &&
|
|
onPlay &&
|
|
- onPlay({
|
|
|
|
- voiceName: item.voiceName,
|
|
|
|
- voiceIndex: index,
|
|
|
|
- });
|
|
|
|
|
|
+ onPlay(item);
|
|
}
|
|
}
|
|
// save
|
|
// save
|
|
}
|
|
}
|
|
|
|
|
|
- if (item.status == CloneVoiceStatus.CloneVoiceStatusUnconfirmed) {
|
|
|
|
- // 未确认,弹出试听框
|
|
|
|
- setPopupType("try");
|
|
|
|
- setShow(true);
|
|
|
|
- }
|
|
|
|
|
|
+ // if (item.status == CloneVoiceStatus.CloneVoiceStatusUnconfirmed) {
|
|
|
|
+ // // 未确认,弹出试听框
|
|
|
|
+ // setPopupType("try");
|
|
|
|
+ // setShow(true);
|
|
|
|
+ // }
|
|
};
|
|
};
|
|
|
|
|
|
// 克隆按钮状态
|
|
// 克隆按钮状态
|
|
@@ -84,8 +75,8 @@ export default ({ onPlay }: Props) => {
|
|
|
|
|
|
const handleSureAction = async () => {
|
|
const handleSureAction = async () => {
|
|
setShow(false);
|
|
setShow(false);
|
|
- await voiceCloneConfirm(myVoices[voiceIndex].voiceName!);
|
|
|
|
- fetchVoiceList();
|
|
|
|
|
|
+ // await voiceCloneConfirm(myVoices[voiceIndex].voiceName!);
|
|
|
|
+ // fetchVoiceList();
|
|
};
|
|
};
|
|
|
|
|
|
const handleRecloneAction = () => {
|
|
const handleRecloneAction = () => {
|
|
@@ -136,7 +127,7 @@ export default ({ onPlay }: Props) => {
|
|
// 克隆列表右侧操作栏
|
|
// 克隆列表右侧操作栏
|
|
const renderRightColumn = (item: TVoiceItem) => {
|
|
const renderRightColumn = (item: TVoiceItem) => {
|
|
if (item.status == EVoiceStatus.DONE) {
|
|
if (item.status == EVoiceStatus.DONE) {
|
|
- return <WemetaRadio></WemetaRadio>;
|
|
|
|
|
|
+ return <WemetaRadio checked={item.voiceId === agent?.voiceId}></WemetaRadio>;
|
|
}
|
|
}
|
|
|
|
|
|
return <></>;
|
|
return <></>;
|
|
@@ -147,7 +138,7 @@ export default ({ onPlay }: Props) => {
|
|
if (item.status === EVoiceStatus.DONE) {
|
|
if (item.status === EVoiceStatus.DONE) {
|
|
return (
|
|
return (
|
|
<View className={`text-12 leading-20 text-gray-45`}>
|
|
<View className={`text-12 leading-20 text-gray-45`}>
|
|
- {item.createTime && formatDateFull(new Date(item.createTime))}
|
|
|
|
|
|
+ {item.createTime && formatDateFull(new Date(item.createTime.replace(/-/g,'/')))}
|
|
</View>
|
|
</View>
|
|
);
|
|
);
|
|
}
|
|
}
|
|
@@ -181,7 +172,7 @@ export default ({ onPlay }: Props) => {
|
|
rightRenderer={() => {
|
|
rightRenderer={() => {
|
|
return renderRightColumn(item);
|
|
return renderRightColumn(item);
|
|
}}
|
|
}}
|
|
- onClick={() => handleSelect(item, _index)}
|
|
|
|
|
|
+ onClick={() => handleSelect(item)}
|
|
>
|
|
>
|
|
<View className="flex items-center gap-16">
|
|
<View className="flex items-center gap-16">
|
|
<View className="flex flex-col gap-4">
|
|
<View className="flex flex-col gap-4">
|
|
@@ -218,20 +209,16 @@ export default ({ onPlay }: Props) => {
|
|
show={show}
|
|
show={show}
|
|
setShow={setShow}
|
|
setShow={setShow}
|
|
setCloneStatus={(status) => handleCloneStatus(status)}
|
|
setCloneStatus={(status) => handleCloneStatus(status)}
|
|
- voiceName={
|
|
|
|
- popupType == "reclone" ? myVoices[voiceIndex].voiceName! : ""
|
|
|
|
- }
|
|
|
|
></PopupRecorder>
|
|
></PopupRecorder>
|
|
)}
|
|
)}
|
|
- {popupType == "try" && (
|
|
|
|
|
|
+ {/* {popupType == "try" && (
|
|
<PopupTryout
|
|
<PopupTryout
|
|
show={show}
|
|
show={show}
|
|
onSure={handleSureAction}
|
|
onSure={handleSureAction}
|
|
onReclone={handleRecloneAction}
|
|
onReclone={handleRecloneAction}
|
|
- voiceName={myVoices[voiceIndex].voiceName!}
|
|
|
|
showName={getCloneVoiceIdentifier(voiceIndex + 1)}
|
|
showName={getCloneVoiceIdentifier(voiceIndex + 1)}
|
|
></PopupTryout>
|
|
></PopupTryout>
|
|
- )}
|
|
|
|
|
|
+ )} */}
|
|
</View>
|
|
</View>
|
|
</Popup>
|
|
</Popup>
|
|
|
|
|