ai状态修改

This commit is contained in:
lyp 2025-03-04 13:18:18 +08:00
parent 2e30be6830
commit 4fe4aa1e6b

View File

@ -30,7 +30,7 @@ type PropsType = {
projDesc?: string; projDesc?: string;
isFree: boolean; isFree: boolean;
renderData: any; renderData: any;
chargeType:any chargeType: any
} }
type ProjModType = { type ProjModType = {
@ -188,13 +188,15 @@ export default function AiHelper(props: PropsType) {
ping(); ping();
} }
ws.current.onmessage = (event) => { ws.current.onmessage = (event) => {
// console.log('message', event); console.log('message', event.data);
// console.log(event.data);
if (event.data == 'PONE') { if (event.data == 'PONE') {
return; return;
} }
const data = JSON.parse(event.data); const data = JSON.parse(event.data);
// console.log('data',data.type);
if (data.projId != props.projId) { if (data.projId != props.projId) {
return; return;
} }
@ -249,9 +251,50 @@ export default function AiHelper(props: PropsType) {
// setIsProjModArrayLoading(true); // setIsProjModArrayLoading(true);
listMods(); listMods();
} }
// else if (data.type == 'SYSTEM_ERROR') {
// console.log(data.content);
// // console.log(JSON.parse());
// // messageApi.error(data.content)
// // const con = JSON.parse(data.content)
// const parts = data.content.split(':');
// const errorType = parts[1].trim();
// if (errorType == 'introduction') {
// messageApi.error('请重试')
// setIsProjIntroductionLoading(false);
// setIsProjDescLoading(false);
// setIsProjModArrayLoading(false);
// }else if(errorType == 'desc'){
// messageApi.error('请重试')
// setIsProjDescLoading(false);
// }else if(errorType == 'mods'){
// messageApi.error('请重试')
// setIsProjModArrayLoading(false);
// }
// }
else if (data.type == 'PROJ_INTRODUCTION_ERROR') {
messageApi.error('请重试')
setIsProjIntroductionLoading(false);
setIsProjDescLoading(false);
setIsProjModArrayLoading(false);
// return;
}
else if (data.type == 'PROJ_DESC_ERROR') {
messageApi.error('系统详情生成失败 , 请重试')
setIsProjDescLoading(false);
}
else if (data.type == 'PROJ_MODS_ERROR') {
messageApi.error('功能列表生成失败 , 请重试')
setIsProjModArrayLoading(false);
}
} }
ws.current.onerror = (event) => { ws.current.onerror = (event) => {
console.log('error', event); console.log('error', event);
// setIsProjModArrayLoading(false);
// setIsProjDescLoading(false);
// setIsProjIntroductionLoading(false);
// messageApi.error('请重试')
} }
ws.current.onclose = (event) => { ws.current.onclose = (event) => {
console.log('close', event); console.log('close', event);
@ -313,14 +356,14 @@ export default function AiHelper(props: PropsType) {
url: `/api/proj/auto/get-introduction-desc-mods/${props.projId}`, url: `/api/proj/auto/get-introduction-desc-mods/${props.projId}`,
config: { config: {
params: { params: {
} }
}, },
onBefore() { onBefore() {
}, },
onSuccess() { onSuccess() {
}, },
onFinally() { onFinally() {
@ -341,14 +384,14 @@ export default function AiHelper(props: PropsType) {
url: `/api/proj/auto/get-desc/${props.projId}`, url: `/api/proj/auto/get-desc/${props.projId}`,
config: { config: {
params: { params: {
} }
}, },
onBefore() { onBefore() {
}, },
onSuccess() { onSuccess() {
}, },
onFinally() { onFinally() {
@ -368,14 +411,14 @@ export default function AiHelper(props: PropsType) {
url: `/api/proj/auto/get-mods/${props.projId}`, url: `/api/proj/auto/get-mods/${props.projId}`,
config: { config: {
params: { params: {
} }
}, },
onBefore() { onBefore() {
}, },
onSuccess() { onSuccess() {
}, },
onFinally() { onFinally() {