Commit 0673fca2 authored by 文旺-丰林-DEV's avatar 文旺-丰林-DEV

修改公司名称/记录会话内容

parent 6732a4f7
...@@ -13,7 +13,7 @@ const Settings: LayoutSettings & { ...@@ -13,7 +13,7 @@ const Settings: LayoutSettings & {
colorWeak: false, colorWeak: false,
pwa: false, pwa: false,
logo: 'https://baibaomen.oss-cn-hangzhou.aliyuncs.com/zhensheng/Logo.png', logo: 'https://baibaomen.oss-cn-hangzhou.aliyuncs.com/zhensheng/Logo.png',
title: '长沙振升集团后台系统', title: 'ZENSONG.AI',
iconfontUrl: '', iconfontUrl: '',
}; };
......
...@@ -5,7 +5,7 @@ const Footer: React.FC = () => { ...@@ -5,7 +5,7 @@ const Footer: React.FC = () => {
const intl = useIntl(); const intl = useIntl();
const defaultMessage = intl.formatMessage({ const defaultMessage = intl.formatMessage({
id: 'app.copyright.produced', id: 'app.copyright.produced',
defaultMessage: '2023 长沙振升集团有限公司', defaultMessage: '2023 ZENSONG.AI',
}); });
const currentYear = new Date().getFullYear(); const currentYear = new Date().getFullYear();
......
...@@ -80,7 +80,7 @@ const LoginModal = (props: ILoginModalProps) => { ...@@ -80,7 +80,7 @@ const LoginModal = (props: ILoginModalProps) => {
<div className={styles.modal_login}> <div className={styles.modal_login}>
<div className={styles.modal_title}> <div className={styles.modal_title}>
<img src={logoSvg} alt="" /> <img src={logoSvg} alt="" />
<p>欢迎来到 CHATGLM</p> <p>欢迎来到 ZENSONG.AI</p>
</div> </div>
<p className={styles.modal_tip}>账户密码登录</p> <p className={styles.modal_tip}>账户密码登录</p>
<Form <Form
...@@ -93,7 +93,7 @@ const LoginModal = (props: ILoginModalProps) => { ...@@ -93,7 +93,7 @@ const LoginModal = (props: ILoginModalProps) => {
<Input prefix={<UserOutlined />} placeholder="账户" value={''} /> <Input prefix={<UserOutlined />} placeholder="账户" value={''} />
</Form.Item> </Form.Item>
<Form.Item name="password" rules={[{ required: true, message: '请输入你的密码!' }]}> <Form.Item name="password" rules={[{ required: true, message: '请输入你的密码!' }]}>
<Input prefix={<LockOutlined />} type="password" placeholder="密码" value={''} /> <Input.Password prefix={<LockOutlined />} placeholder="密码" value={''} />
</Form.Item> </Form.Item>
<Form.Item name="checked" valuePropName="checked" className={styles.modal_checked}> <Form.Item name="checked" valuePropName="checked" className={styles.modal_checked}>
<Checkbox>自动登录</Checkbox> <Checkbox>自动登录</Checkbox>
......
...@@ -15,8 +15,6 @@ const Issue = (props: IIssueProps) => { ...@@ -15,8 +15,6 @@ const Issue = (props: IIssueProps) => {
const screens = useBreakpoint(); const screens = useBreakpoint();
const isMobile = screens.xs; const isMobile = screens.xs;
console.log('isMobile', isMobile);
return ( return (
<Col span={24} className={styles.question} style={{ marginTop: isMobile ? '0px' : '40px' }}> <Col span={24} className={styles.question} style={{ marginTop: isMobile ? '0px' : '40px' }}>
<img src={userSvg} alt="" className={styles.question_img} /> <img src={userSvg} alt="" className={styles.question_img} />
......
...@@ -11,7 +11,7 @@ export default { ...@@ -11,7 +11,7 @@ export default {
'layout.user.link.help': '帮助', 'layout.user.link.help': '帮助',
'layout.user.link.privacy': '隐私', 'layout.user.link.privacy': '隐私',
'layout.user.link.terms': '条款', 'layout.user.link.terms': '条款',
'app.copyright.produced': '长沙振升集团有限公司', 'app.copyright.produced': 'ZENSONG.AI',
'app.preview.down.block': '下载此页面到本地项目', 'app.preview.down.block': '下载此页面到本地项目',
'app.welcome.link.fetch-blocks': '获取全部区块', 'app.welcome.link.fetch-blocks': '获取全部区块',
'app.welcome.link.block-list': '基于 block 开发,快速构建标准页面', 'app.welcome.link.block-list': '基于 block 开发,快速构建标准页面',
......
...@@ -15,7 +15,12 @@ import { history } from 'umi'; ...@@ -15,7 +15,12 @@ import { history } from 'umi';
import LoginModal from '@/components/LoginModal'; import LoginModal from '@/components/LoginModal';
import NewSession from '@/components/NewSession'; import NewSession from '@/components/NewSession';
import { useWebSocket, useRequest } from 'ahooks'; import { useWebSocket, useRequest } from 'ahooks';
import { GetChatGLMToken, GetPromptList } from '@/services/chatGLM/api'; import {
GetChatGLMToken,
GetPromptList,
createSession,
updateSession,
} from '@/services/chatGLM/api';
import { useAccess } from 'umi'; import { useAccess } from 'umi';
import { PageLoading } from '@ant-design/pro-layout'; import { PageLoading } from '@ant-design/pro-layout';
import { checkIsTokenExpires } from '@/access'; import { checkIsTokenExpires } from '@/access';
...@@ -38,6 +43,7 @@ interface IHistory { ...@@ -38,6 +43,7 @@ interface IHistory {
const Chat: React.FC = () => { const Chat: React.FC = () => {
const screens = useBreakpoint(); const screens = useBreakpoint();
const isMobile = screens.xs; const isMobile = screens.xs;
const [sessionId, setSessionId] = useState<string>('');
const [chat, setChat] = useState(''); const [chat, setChat] = useState('');
const [showSider, setShowSider] = useState(!isMobileDevice()); const [showSider, setShowSider] = useState(!isMobileDevice());
const [firstChat, setFirstChat] = useState(false); const [firstChat, setFirstChat] = useState(false);
...@@ -60,6 +66,7 @@ const Chat: React.FC = () => { ...@@ -60,6 +66,7 @@ const Chat: React.FC = () => {
const text = event.data; const text = event.data;
if (text == '{{BBMCPLT}}') { if (text == '{{BBMCPLT}}') {
setLoading(false); setLoading(false);
createChatSession();
} else { } else {
setAnswer(text); setAnswer(text);
window.scrollTo(0, document.body.scrollHeight); window.scrollTo(0, document.body.scrollHeight);
...@@ -74,6 +81,16 @@ const Chat: React.FC = () => { ...@@ -74,6 +81,16 @@ const Chat: React.FC = () => {
}, },
}); });
function createChatSession() {
if (sessionId) {
updateSession({ id: sessionId, content: JSON.stringify(messageHistory.current) });
} else {
createSession({ content: JSON.stringify(messageHistory.current) }).then((data) => {
data?.id && setSessionId(data.id);
});
}
}
messageHistory.current = useMemo(() => { messageHistory.current = useMemo(() => {
if (messageHistory.current.length > 0) if (messageHistory.current.length > 0)
messageHistory.current[messageHistory.current.length - 1].answer += answer; messageHistory.current[messageHistory.current.length - 1].answer += answer;
...@@ -141,7 +158,7 @@ const Chat: React.FC = () => { ...@@ -141,7 +158,7 @@ const Chat: React.FC = () => {
}} }}
/> />
</Col> </Col>
<Col>长沙振升集团</Col> <Col>ZENSONG.AI</Col>
<Col pull={1} /> <Col pull={1} />
</Row> </Row>
); );
...@@ -229,7 +246,7 @@ const Chat: React.FC = () => { ...@@ -229,7 +246,7 @@ const Chat: React.FC = () => {
alt="logo" alt="logo"
/> />
<Title level={2} style={{ marginBottom: 8, fontSize: 32 }}> <Title level={2} style={{ marginBottom: 8, fontSize: 32 }}>
长沙振升集团 ZENSONG.AI
</Title> </Title>
</Col> </Col>
<Col span={24}> <Col span={24}>
......
...@@ -67,13 +67,13 @@ const UserManage = () => { ...@@ -67,13 +67,13 @@ const UserManage = () => {
const columns: any[] = [ const columns: any[] = [
{ {
title: '用户账号', title: '用户姓名',
dataIndex: 'name', dataIndex: 'name',
ellipsis: true, ellipsis: true,
width: '20%', width: '20%',
}, },
{ {
title: '用户账号', title: '登录账号',
dataIndex: 'userName', dataIndex: 'userName',
hideInSearch: true, hideInSearch: true,
ellipsis: true, ellipsis: true,
...@@ -310,7 +310,7 @@ const UserManage = () => { ...@@ -310,7 +310,7 @@ const UserManage = () => {
label={'新密码'} label={'新密码'}
rules={[{ required: true, message: '请输入密码' }, { validator: validatePassword }]} rules={[{ required: true, message: '请输入密码' }, { validator: validatePassword }]}
> >
<Input placeholder="请输入6-12位的数字或者字母" /> <Password placeholder="请输入6-12位的数字或者字母" />
</Item> </Item>
<Item <Item
name={'confirmNewPassword'} name={'confirmNewPassword'}
...@@ -330,7 +330,7 @@ const UserManage = () => { ...@@ -330,7 +330,7 @@ const UserManage = () => {
}), }),
]} ]}
> >
<Input placeholder="请确认你的新密码" /> <Password placeholder="请确认你的新密码" />
</Item> </Item>
<Divider /> <Divider />
<Row justify={'center'}> <Row justify={'center'}>
......
import { extend } from 'umi-request'; import { extend } from 'umi-request';
import { history } from 'umi';
interface ILoginParams { interface ILoginParams {
name: string; name: string;
...@@ -7,6 +6,7 @@ interface ILoginParams { ...@@ -7,6 +6,7 @@ interface ILoginParams {
} }
const request = extend({}); const request = extend({});
const host = 'https://glm-mangement-api.baibaomen.com';
request.interceptors.request.use((url, options) => { request.interceptors.request.use((url, options) => {
const token = JSON.parse(localStorage.getItem('user') || '{}')?.token; const token = JSON.parse(localStorage.getItem('user') || '{}')?.token;
const authHeader = { const authHeader = {
...@@ -33,7 +33,7 @@ request.interceptors.response.use(async (response): Promise<any> => { ...@@ -33,7 +33,7 @@ request.interceptors.response.use(async (response): Promise<any> => {
}); });
export function loginChatGLM(options: ILoginParams) { export function loginChatGLM(options: ILoginParams) {
return request('https://glm-mangement-api.baibaomen.com/api/app/account/login', { return request(host + '/api/app/account/login', {
method: 'POST', method: 'POST',
data: options, data: options,
}); });
...@@ -44,13 +44,13 @@ export interface IPromptWord { ...@@ -44,13 +44,13 @@ export interface IPromptWord {
content: string; content: string;
} }
export function GetChatGLMToken(): Promise<string> { export function GetChatGLMToken(): Promise<string> {
return request('https://glm-mangement-api.baibaomen.com/user/token', { return request(host + '/user/token', {
method: 'POST', method: 'POST',
}); });
} }
export function GetPromptList(): Promise<{ items: IPromptWord[] }> { export function GetPromptList(): Promise<{ items: IPromptWord[] }> {
return request('https://glm-mangement-api.baibaomen.com/promptwords/page', { return request(host + '/promptwords/page', {
method: 'POST', method: 'POST',
headers: { headers: {
Authorization: 'Bearer ' + JSON.parse(localStorage.getItem('user') || '')?.token, Authorization: 'Bearer ' + JSON.parse(localStorage.getItem('user') || '')?.token,
...@@ -60,16 +60,6 @@ export function GetPromptList(): Promise<{ items: IPromptWord[] }> { ...@@ -60,16 +60,6 @@ export function GetPromptList(): Promise<{ items: IPromptWord[] }> {
}); });
} }
type History = [string, string];
interface ITalkParams {
prompt: string;
history: History[];
max_length?: number;
top_p?: number;
temperature?: number;
}
const host = 'https://glm-mangement-api.baibaomen.com';
export const CreatedAccount = (params: any): Promise<string> => { export const CreatedAccount = (params: any): Promise<string> => {
return request(host + '/User/create', { return request(host + '/User/create', {
method: 'POST', method: 'POST',
...@@ -173,3 +163,17 @@ export const postEditUser = (params?: any): Promise<string> => { ...@@ -173,3 +163,17 @@ export const postEditUser = (params?: any): Promise<string> => {
body: JSON.stringify(params), body: JSON.stringify(params),
}); });
}; };
export const createSession = (params: any): Promise<any> => {
return request(host + '/ChatSessions/create', {
method: 'POST',
data: params,
});
};
export const updateSession = (params: any): Promise<any> => {
return request(host + '/ChatSessions/update', {
method: 'POST',
data: params,
});
};
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment