生成模块提示

This commit is contained in:
lyp 2024-12-23 11:42:46 +08:00
parent 4e31ab1f55
commit 1c18be4d47
2 changed files with 44 additions and 33 deletions

View File

@ -4,7 +4,7 @@ import { GlobalContext } from "../../context/GlobalContext.ts";
import { del, get, post, put, websocketUrl, Axios } from "../../util/AjaxUtils.ts";
import {
// Col, Divider, Row,
Spin, Image, Pagination,Modal
Spin, Image, Pagination
} from "antd";
import { AxiosResponse } from "axios";
import useMessage from "antd/es/message/useMessage";
@ -74,7 +74,7 @@ export default function AiHelper(props: PropsType) {
const height = window.innerHeight - 265;
// 提示是否可以生成模块
const [modal, setModal] = useState(false)
// const [modal, setModal] = useState(false)
// const pathParams = useParams();
// const [openModal ,setOpenModal] = useState(false) //是提示替换弹框
// const height = window.innerHeight - 280;
@ -231,21 +231,21 @@ export default function AiHelper(props: PropsType) {
}
})
}
const getProjDesc = () => {
get<any>({
messageApi: messageApi,
url: `/api/proj/get/${props.projId}`,
onSuccess({ data }) {
console.log(data.projDesc);
if(data.projDesc) {
generateProjModArray();
}else{
setModal(true)
}
// const getProjDesc = () => {
// get<any>({
// messageApi: messageApi,
// url: `/api/proj/get/${props.projId}`,
// onSuccess({ data }) {
// console.log(data.projDesc);
// if(data.projDesc) {
// generateProjModArray();
// }else{
// // setModal(true)
// }
}
})
}
// }
// })
// }
const generateProjIntroduction = () => {
ws.current?.send(JSON.stringify({
@ -548,8 +548,8 @@ export default function AiHelper(props: PropsType) {
<AiHelperMod mods={projModArray}
newMods={newProjModArray}
handleGenerate={() => {
getProjDesc()
// generateProjModArray();
// getProjDesc()
generateProjModArray();
}}
handleSave={(index, mod) => {
if (projModArray.length > MAX_MOD_SIZE) {
@ -764,7 +764,7 @@ export default function AiHelper(props: PropsType) {
</div> */}
<Modal
{/* <Modal
title={'提示'}
destroyOnClose={true}
open={modal}
@ -788,7 +788,7 @@ export default function AiHelper(props: PropsType) {
<div style={{ }}>
</div>
</Modal>
</Modal> */}
</div>
)

View File

@ -75,7 +75,7 @@ export default function AiHelperMod(props: PropsType) {
})
}, [])
const returnValue = (value:string) => {
const returnValue = (value: string) => {
// 如果value包含. / \ ` ! @ # $ % ^ & * ( ) 等特殊符号 去掉
// return value.replace(/[\\/:*?"<>|]/g, '');
return value.replace(/[./\\`!@#$%^&*()]/g, '');
@ -91,7 +91,8 @@ export default function AiHelperMod(props: PropsType) {
return index + 1
}
},
{ title: '模块名称', dataIndex: 'modName', key: 'name', width: 200, align: 'center',
{
title: '模块名称', dataIndex: 'modName', key: 'name', width: 200, align: 'center',
render: (value) => {
return (
<div>
@ -99,7 +100,7 @@ export default function AiHelperMod(props: PropsType) {
</div>
)
}
},
},
{ title: '模块描述', dataIndex: 'modDesc', key: 'desc', align: 'center' },
{
title: 'AI状态',
@ -380,22 +381,32 @@ export default function AiHelperMod(props: PropsType) {
:
<div style={{
display: 'flex',
alignItems: 'center',
justifyContent: 'center',
fontSize: '14px',
}}
>
<div style={{ width: 300, height: 300, marginTop: 10, position: 'relative' }}>
<div style={{ width: 300, height: 300, marginTop: 10, position: 'relative' ,
// backgroundColor:'pink'
}}>
<img src={noTextImg} alt="" width={'100%'} />
<div style={{ position: 'absolute', left: 90, bottom: 100 }}>
<span style={{ color: '#FF9D00', cursor: 'pointer' }}
onClick={() => {
props.handleGenerate()
}}
></span>
<div style={{ position: 'absolute', left: 90, bottom: 100, color: '#99A5B7' }}>
<div>
,
<span style={{ color: '#FF9D00', cursor: 'pointer' }}
onClick={() => {
props.handleGenerate()
}}
></span>
</div>
</div>
<div style={{color:'red',position: 'absolute', bottom: 70,textAlign:'center',width:600 , left: -140}}></div>
</div>
</div>
}