add ai
This commit is contained in:
parent
9336508260
commit
62762c955c
@ -199,7 +199,7 @@ export default function Main({ sidebar, header, footer, Page }: Props) {
|
|||||||
))}
|
))}
|
||||||
<ButtonTestPublication />
|
<ButtonTestPublication />
|
||||||
<ButtonRecallQuiz />
|
<ButtonRecallQuiz />
|
||||||
{quiz?.status === "start" &&
|
{(quiz?.status === "start" || quiz?.status === "ai") &&
|
||||||
(!isLinkButton ? (
|
(!isLinkButton ? (
|
||||||
<Box
|
<Box
|
||||||
data-cy="link-test"
|
data-cy="link-test"
|
||||||
@ -249,7 +249,7 @@ export default function Main({ sidebar, header, footer, Page }: Props) {
|
|||||||
<LinkSimple />
|
<LinkSimple />
|
||||||
</Box>
|
</Box>
|
||||||
))}
|
))}
|
||||||
{isMobile && quiz?.status === "start" && (
|
{isMobile && (quiz?.status === "start" || quiz?.status === "ai") && (
|
||||||
<Box
|
<Box
|
||||||
data-cy="link-test"
|
data-cy="link-test"
|
||||||
component={Link}
|
component={Link}
|
||||||
|
@ -44,6 +44,7 @@ import Extra from "./extra";
|
|||||||
import TooltipClickInfo from "@ui_kit/Toolbars/TooltipClickInfo";
|
import TooltipClickInfo from "@ui_kit/Toolbars/TooltipClickInfo";
|
||||||
import { VideoElement } from "./VideoElement";
|
import { VideoElement } from "./VideoElement";
|
||||||
import UploadVideoModal from "../Questions/UploadVideoModal";
|
import UploadVideoModal from "../Questions/UploadVideoModal";
|
||||||
|
import { SwitchAI } from "@/ui_kit/crutchFunctionAI";
|
||||||
|
|
||||||
const designTypes = [
|
const designTypes = [
|
||||||
["standard", (color: string) => <LayoutStandartIcon color={color} />, "Standard"],
|
["standard", (color: string) => <LayoutStandartIcon color={color} />, "Standard"],
|
||||||
@ -89,9 +90,9 @@ export default function StartPageSettings() {
|
|||||||
let cropAspectRatio:
|
let cropAspectRatio:
|
||||||
| undefined
|
| undefined
|
||||||
| {
|
| {
|
||||||
width: number;
|
width: number;
|
||||||
height: number;
|
height: number;
|
||||||
};
|
};
|
||||||
switch (designType) {
|
switch (designType) {
|
||||||
case "standard":
|
case "standard":
|
||||||
cropAspectRatio = { width: 1680.8, height: 960.5 };
|
cropAspectRatio = { width: 1680.8, height: 960.5 };
|
||||||
@ -595,6 +596,7 @@ export default function StartPageSettings() {
|
|||||||
Favicon
|
Favicon
|
||||||
</Typography>
|
</Typography>
|
||||||
{favIconDropZoneElement}
|
{favIconDropZoneElement}
|
||||||
|
{isSmallMonitor && <SwitchAI />}
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
</Box>
|
</Box>
|
||||||
@ -674,6 +676,7 @@ export default function StartPageSettings() {
|
|||||||
Favicon
|
Favicon
|
||||||
</Typography>
|
</Typography>
|
||||||
{favIconDropZoneElement}
|
{favIconDropZoneElement}
|
||||||
|
<SwitchAI />
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
{(!isSmallMonitor || (isSmallMonitor && formState === "content")) && (
|
{(!isSmallMonitor || (isSmallMonitor && formState === "content")) && (
|
||||||
@ -872,6 +875,7 @@ export default function StartPageSettings() {
|
|||||||
Включить защиту от копирования
|
Включить защиту от копирования
|
||||||
</Typography>
|
</Typography>
|
||||||
</Box>
|
</Box>
|
||||||
|
{!isSmallMonitor &&<SwitchAI />}
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
</Box>
|
</Box>
|
||||||
|
@ -18,13 +18,13 @@ export const selectSendingMethod = async ({messageField, isSnackbar = true, syst
|
|||||||
|
|
||||||
console.log("click 2")
|
console.log("click 2")
|
||||||
let successful = false;
|
let successful = false;
|
||||||
if (!(window.location.hostname == 'localhost' && systemError)) { //предупреждать о системных ошибках вне локалхост
|
if (!(window.location.hostname == 'localhost' && systemError )) { //предупреждать о системных ошибках вне локалхост
|
||||||
if (!ticket.sessionData?.ticketId) {
|
if (!ticket.sessionData?.ticketId) {
|
||||||
console.log("autorisated 2")
|
console.log("autorisated 2")
|
||||||
const [data, createError] = await createTicket(
|
const [data, createError] = await createTicket(
|
||||||
messageField,
|
messageField,
|
||||||
Boolean(user),
|
Boolean(user),
|
||||||
systemError,
|
false,
|
||||||
);
|
);
|
||||||
|
|
||||||
if (createError || !data) {
|
if (createError || !data) {
|
||||||
@ -41,7 +41,7 @@ export const selectSendingMethod = async ({messageField, isSnackbar = true, syst
|
|||||||
const [_, sendTicketMessageError] = await sendTicketMessage(
|
const [_, sendTicketMessageError] = await sendTicketMessage(
|
||||||
ticket.sessionData?.ticketId,
|
ticket.sessionData?.ticketId,
|
||||||
messageField,
|
messageField,
|
||||||
systemError,
|
false,
|
||||||
);
|
);
|
||||||
successful = true;
|
successful = true;
|
||||||
|
|
||||||
|
@ -17,6 +17,7 @@ export const ButtonRecallQuiz = () => {
|
|||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (quiz && buttonText === "обработка...")
|
if (quiz && buttonText === "обработка...")
|
||||||
setButtonText(quiz?.status === "stop" ? "Опубликовать" : "Отозвать");
|
setButtonText(quiz?.status === "stop" ? "Опубликовать" : "Отозвать");
|
||||||
|
if (quiz?.status === "ai") setButtonText("Отозвать");
|
||||||
}, [quiz]);
|
}, [quiz]);
|
||||||
|
|
||||||
const handleClickStatusQuiz = () => {
|
const handleClickStatusQuiz = () => {
|
||||||
@ -31,7 +32,7 @@ export const ButtonRecallQuiz = () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
updateQuiz(quiz?.id, (state) => {
|
updateQuiz(quiz?.id, (state) => {
|
||||||
state.status = quiz?.status === "start" ? "stop" : "start";
|
state.status = (quiz?.status === "start" || quiz?.status === "ai") ? "stop" : "start";
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
updateModalInfoWhyCantCreate(true);
|
updateModalInfoWhyCantCreate(true);
|
||||||
|
92
src/ui_kit/crutchFunctionAI.tsx
Normal file
92
src/ui_kit/crutchFunctionAI.tsx
Normal file
@ -0,0 +1,92 @@
|
|||||||
|
import { updateQuiz } from "@/stores/quizes/actions";
|
||||||
|
import { useCurrentQuiz } from "@/stores/quizes/hooks";
|
||||||
|
import { Switch, Button, Modal, Typography, useTheme, Box } from "@mui/material"
|
||||||
|
import { useState } from "react";
|
||||||
|
import CustomizedSwitch from "@ui_kit/CustomSwitch";
|
||||||
|
import { useUserStore } from "@/stores/user";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
export const SwitchAI = () => {
|
||||||
|
const theme = useTheme();
|
||||||
|
|
||||||
|
const [open, setOpen] = useState(false);
|
||||||
|
const quiz = useCurrentQuiz();
|
||||||
|
const account = useUserStore()
|
||||||
|
console.log(account.userId)
|
||||||
|
if (account.userId === "6755b1ddd5802e9f13663f56") {
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<Box sx={{ display: "flex", gap: "20px", alignItems: "center", mt: "20px" }}>
|
||||||
|
<CustomizedSwitch
|
||||||
|
checked={quiz?.status === "ai"}
|
||||||
|
onChange={(e) => {
|
||||||
|
if (e.target.checked) {
|
||||||
|
setOpen(true);
|
||||||
|
} else {
|
||||||
|
updateQuiz(quiz?.id, (quiz) => {
|
||||||
|
quiz.status = "start"
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
<Typography
|
||||||
|
sx={{
|
||||||
|
fontWeight: 500,
|
||||||
|
color: theme.palette.grey3.main,
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
ИИ опрос
|
||||||
|
</Typography>
|
||||||
|
</Box>
|
||||||
|
<Modal
|
||||||
|
open={open}
|
||||||
|
onClose={() => setOpen(false)}
|
||||||
|
aria-labelledby="modal-modal-title"
|
||||||
|
aria-describedby="modal-modal-description"
|
||||||
|
>
|
||||||
|
<Box
|
||||||
|
sx={{
|
||||||
|
position: "absolute" as "absolute",
|
||||||
|
top: "50%",
|
||||||
|
left: "50%",
|
||||||
|
transform: "translate(-50%, -50%)",
|
||||||
|
maxWidth: "620px",
|
||||||
|
width: "100%",
|
||||||
|
bgcolor: "background.paper",
|
||||||
|
borderRadius: "12px",
|
||||||
|
|
||||||
|
boxShadow: 24,
|
||||||
|
p: 0,
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<Box
|
||||||
|
sx={{
|
||||||
|
display: "flex",
|
||||||
|
flexDirection: "column",
|
||||||
|
padding: "20px",
|
||||||
|
borderRadius: "12px 12px 0 0",
|
||||||
|
background: theme.palette.background.default,
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<Typography sx={{ p: "20px" }}>
|
||||||
|
Учтите, что в случае ИИ-опроса сперва будут заданы все созданные вопросы, и только потом — вопросы, сгенерированные ИИ.
|
||||||
|
</Typography>
|
||||||
|
<Button
|
||||||
|
variant="contained"
|
||||||
|
onClick={() => {
|
||||||
|
|
||||||
|
updateQuiz(quiz?.id, (state) => {
|
||||||
|
state.status = "ai";
|
||||||
|
});
|
||||||
|
setOpen(false);
|
||||||
|
}}
|
||||||
|
>Согласиться</Button>
|
||||||
|
</Box>
|
||||||
|
</Box>
|
||||||
|
</Modal>
|
||||||
|
</>
|
||||||
|
|
||||||
|
)
|
||||||
|
} else return <></>
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user