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

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

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