对接AI
This commit is contained in:
parent
4235a6fe56
commit
99b65965c6
@ -1,7 +1,7 @@
|
||||
import {useContext, useEffect, useRef, useState} from "react";
|
||||
import {GlobalContext} from "../../context/GlobalContext.ts";
|
||||
import {put, WebSocketBaseUrl} from "../../util/AjaxUtils.ts";
|
||||
import {Button, Divider, Empty, Space, Spin, Table, TableProps} from "antd";
|
||||
import {Button, Col, Divider, Empty, Row, Space, Spin, Table, TableProps} from "antd";
|
||||
import {CheckOutlined, ReloadOutlined} from "@ant-design/icons";
|
||||
import useMessage from "antd/es/message/useMessage";
|
||||
|
||||
@ -78,7 +78,8 @@ export default function AiHelper(props: PropsType) {
|
||||
}
|
||||
|
||||
const projModColumnArray: TableProps<ProjModType>['columns'] = [
|
||||
{title: '模块名称', dataIndex: 'name', key: 'name', width: 150, align: 'center'},
|
||||
{title: '序号', dataIndex: 'index', key: 'index', width: 60, align: 'center', render: (value, record, index) => {return index + 1}},
|
||||
{title: '模块名称', dataIndex: 'name', key: 'name', width: 200, align: 'center'},
|
||||
{title: '模块描述', dataIndex: 'desc', key: 'desc', align: 'center'},
|
||||
];
|
||||
|
||||
@ -167,92 +168,100 @@ export default function AiHelper(props: PropsType) {
|
||||
return (
|
||||
<>
|
||||
{messageApiHolder}
|
||||
<div style={{padding: '5px 0 0 0', fontWeight: 'bold'}}>项目简介</div>
|
||||
<Spin tip="正在处理,请稍后..." size="small" spinning={isProjIntroductionLoading}>
|
||||
<div style={{padding: '5px 0 0 0'}}>
|
||||
{newProjIntroduction ? <Divider orientation="right" plain>原简介</Divider> : <></>}
|
||||
{projIntroduction ? <div>{projIntroduction}</div> : <Empty description="暂无内容"/>}
|
||||
{
|
||||
newProjIntroduction ? (
|
||||
<>
|
||||
<Divider orientation="right" plain>新简介</Divider>
|
||||
<div>{newProjIntroduction}</div>
|
||||
</>
|
||||
) : <></>
|
||||
}
|
||||
</div>
|
||||
<div style={{padding: '5px 0 0 0', textAlign: 'center'}}>
|
||||
{
|
||||
newProjIntroduction ? (
|
||||
<Space>
|
||||
<Button type="link" style={{cursor: 'pointer'}}
|
||||
onClick={updateProjIntroduction}><CheckOutlined/> 保存结果</Button>
|
||||
<Button type="link" style={{cursor: 'pointer'}}
|
||||
onClick={generateProjIntroduction}><ReloadOutlined/> 重新生成</Button>
|
||||
</Space>
|
||||
) : <Button type="link" style={{cursor: 'pointer'}}
|
||||
onClick={generateProjIntroduction}>AI生成</Button>
|
||||
}
|
||||
</div>
|
||||
</Spin>
|
||||
<Divider dashed/>
|
||||
<div style={{padding: '5px 0 0 0', fontWeight: 'bold'}}>项目详情</div>
|
||||
<Spin tip="正在处理,请稍后..." size="small" spinning={isProjDescLoading}>
|
||||
<div style={{padding: '5px 0 0 0'}}>
|
||||
{newProjDesc ? <Divider orientation="right" plain>原详情</Divider> : <></>}
|
||||
{projDesc ? <div>{projDesc}</div> : <Empty description="暂无内容"/>}
|
||||
{
|
||||
newProjDesc ? (
|
||||
<>
|
||||
<Divider orientation="right" plain>新详情</Divider>
|
||||
<div>{newProjDesc}</div>
|
||||
</>
|
||||
) : <></>
|
||||
}
|
||||
</div>
|
||||
<div style={{padding: '5px 0 0 0', textAlign: 'center'}}>
|
||||
{
|
||||
newProjDesc ? (
|
||||
<Space>
|
||||
<Button type="link" style={{cursor: 'pointer'}}
|
||||
onClick={updateProjDesc}><CheckOutlined/> 保存结果</Button>
|
||||
<Button type="link" style={{cursor: 'pointer'}}
|
||||
onClick={generateProjDesc}><ReloadOutlined/> 重新生成</Button>
|
||||
</Space>
|
||||
) : <Button type="link" style={{cursor: 'pointer'}}
|
||||
onClick={generateProjDesc}>AI生成</Button>
|
||||
}
|
||||
</div>
|
||||
</Spin>
|
||||
<Divider dashed/>
|
||||
<div style={{padding: '5px 0 0 0', fontWeight: 'bold'}}>项目模块</div>
|
||||
<Spin tip="正在处理,请稍后..." size="small" spinning={isProjModArrayLoading}>
|
||||
<div style={{padding: '5px 0 0 0'}}>
|
||||
{newProjModArray.length > 0 ? <Divider orientation="right" plain>原模块</Divider> : <></>}
|
||||
<Table columns={projModColumnArray} dataSource={projModArray} size="middle" bordered={true}/>
|
||||
{
|
||||
newProjModArray.length > 0 ? (
|
||||
<>
|
||||
<Divider orientation="right" plain>新模块</Divider>
|
||||
<Table columns={projModColumnArray} dataSource={newProjModArray} size="middle" bordered={true}/>
|
||||
</>
|
||||
) : <></>
|
||||
}
|
||||
</div>
|
||||
<div style={{padding: '5px 0 0 0', textAlign: 'center'}}>
|
||||
{
|
||||
newProjModArray.length > 0 ? (
|
||||
<Space>
|
||||
<Button type="link" style={{cursor: 'pointer'}}
|
||||
onClick={generateProjModArray}><CheckOutlined/> 保存结果</Button>
|
||||
<Button type="link" style={{cursor: 'pointer'}}
|
||||
onClick={generateProjModArray}><ReloadOutlined/> 重新生成</Button>
|
||||
</Space>
|
||||
) : <Button type="link" style={{cursor: 'pointer'}}
|
||||
onClick={generateProjModArray}>AI生成</Button>
|
||||
}
|
||||
</div>
|
||||
</Spin>
|
||||
<Row>
|
||||
<Col span={24}>
|
||||
<div style={{padding: '5px 0 0 0', fontWeight: 'bold'}}>项目简介</div>
|
||||
<Spin tip="正在处理,请稍后..." size="small" spinning={isProjIntroductionLoading}>
|
||||
<div style={{padding: '5px 0 0 0'}}>
|
||||
{newProjIntroduction ? <Divider orientation="right" plain>原简介</Divider> : <></>}
|
||||
{projIntroduction ? <div>{projIntroduction}</div> : <Empty description="暂无内容"/>}
|
||||
{
|
||||
newProjIntroduction ? (
|
||||
<>
|
||||
<Divider orientation="right" plain>新简介</Divider>
|
||||
<div>{newProjIntroduction}</div>
|
||||
</>
|
||||
) : <></>
|
||||
}
|
||||
</div>
|
||||
<div style={{padding: '5px 0 0 0', textAlign: 'center'}}>
|
||||
{
|
||||
newProjIntroduction ? (
|
||||
<Space>
|
||||
<Button type="link" style={{cursor: 'pointer'}}
|
||||
onClick={updateProjIntroduction}><CheckOutlined/> 保存结果</Button>
|
||||
<Button type="link" style={{cursor: 'pointer'}}
|
||||
onClick={generateProjIntroduction}><ReloadOutlined/> 重新生成</Button>
|
||||
</Space>
|
||||
) : <Button type="link" style={{cursor: 'pointer'}}
|
||||
onClick={generateProjIntroduction}>AI生成</Button>
|
||||
}
|
||||
</div>
|
||||
</Spin>
|
||||
</Col>
|
||||
<Col span={24}>
|
||||
<Divider dashed/>
|
||||
<div style={{padding: '5px 0 0 0', fontWeight: 'bold'}}>项目详情</div>
|
||||
<Spin tip="正在处理,请稍后..." size="small" spinning={isProjDescLoading}>
|
||||
<div style={{padding: '5px 0 0 0'}}>
|
||||
{newProjDesc ? <Divider orientation="right" plain>原详情</Divider> : <></>}
|
||||
{projDesc ? <div>{projDesc}</div> : <Empty description="暂无内容"/>}
|
||||
{
|
||||
newProjDesc ? (
|
||||
<>
|
||||
<Divider orientation="right" plain>新详情</Divider>
|
||||
<div>{newProjDesc}</div>
|
||||
</>
|
||||
) : <></>
|
||||
}
|
||||
</div>
|
||||
<div style={{padding: '5px 0 0 0', textAlign: 'center'}}>
|
||||
{
|
||||
newProjDesc ? (
|
||||
<Space>
|
||||
<Button type="link" style={{cursor: 'pointer'}}
|
||||
onClick={updateProjDesc}><CheckOutlined/> 保存结果</Button>
|
||||
<Button type="link" style={{cursor: 'pointer'}}
|
||||
onClick={generateProjDesc}><ReloadOutlined/> 重新生成</Button>
|
||||
</Space>
|
||||
) : <Button type="link" style={{cursor: 'pointer'}}
|
||||
onClick={generateProjDesc}>AI生成</Button>
|
||||
}
|
||||
</div>
|
||||
</Spin>
|
||||
</Col>
|
||||
<Col span={24}>
|
||||
<Divider dashed/>
|
||||
<div style={{padding: '5px 0 0 0', fontWeight: 'bold'}}>项目模块</div>
|
||||
<Spin tip="正在处理,请稍后..." size="small" spinning={isProjModArrayLoading}>
|
||||
<div style={{padding: '5px 0 0 0'}}>
|
||||
{newProjModArray.length > 0 ? <Divider orientation="right" plain>原模块</Divider> : <></>}
|
||||
<Table columns={projModColumnArray} dataSource={projModArray} size="small" bordered={true} scroll={{y: 240}} pagination={{pageSize: 20}}/>
|
||||
{
|
||||
newProjModArray.length > 0 ? (
|
||||
<>
|
||||
<Divider orientation="right" plain>新模块</Divider>
|
||||
<Table columns={projModColumnArray} dataSource={newProjModArray} size="small" bordered={true} scroll={{y: 240}} pagination={{pageSize: 20}}/>
|
||||
</>
|
||||
) : <></>
|
||||
}
|
||||
</div>
|
||||
<div style={{padding: '5px 0 0 0', textAlign: 'center'}}>
|
||||
{
|
||||
newProjModArray.length > 0 ? (
|
||||
<Space>
|
||||
<Button type="link" style={{cursor: 'pointer'}}
|
||||
onClick={generateProjModArray}><CheckOutlined/> 保存结果</Button>
|
||||
<Button type="link" style={{cursor: 'pointer'}}
|
||||
onClick={generateProjModArray}><ReloadOutlined/> 重新生成</Button>
|
||||
</Space>
|
||||
) : <Button type="link" style={{cursor: 'pointer'}}
|
||||
onClick={generateProjModArray}>AI生成</Button>
|
||||
}
|
||||
</div>
|
||||
</Spin>
|
||||
</Col>
|
||||
</Row>
|
||||
</>
|
||||
)
|
||||
)
|
||||
}
|
@ -434,6 +434,7 @@ export default function ProjEdit() {
|
||||
</Modal>
|
||||
<Modal open={aiHelperModalOpen}
|
||||
title="AI助手"
|
||||
width={1200}
|
||||
footer={false}
|
||||
onCancel={() => {
|
||||
setAiHelperModalOpen(false);
|
||||
|
Loading…
Reference in New Issue
Block a user