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