Commit f0a4671b authored by littleforest's avatar littleforest
parents 4d71e5cc 7e89d1e9
......@@ -12,8 +12,8 @@ const Settings: LayoutSettings & {
fixSiderbar: true,
colorWeak: false,
pwa: false,
logo: '/logo.png',
title: '',
logo: 'https://baibaomen.oss-cn-hangzhou.aliyuncs.com/zhensheng/Logo.png',
title: '长沙振升集团后台系统',
iconfontUrl: '',
};
......
export default [
{
name: 'chat',
path: '/chat',
component: './Chat',
layout: false,
},
{
path: '/welcome',
name: 'welcome',
......@@ -12,20 +6,11 @@
component: './Welcome',
},
{
path: '/admin',
name: 'admin',
icon: 'crown',
name: 'user',
path: '/user',
icon: 'UserOutlined',
component: './UserManage',
access: 'canAdmin',
routes: [
{
name: 'user',
path: '/admin/user',
component: './UserManage',
},
{
component: './404',
},
],
},
{
name: 'prompt',
......@@ -33,6 +18,13 @@
path: '/prompt',
component: './PromptWord',
},
{
name: 'chat',
path: '/chat',
component: './Chat',
icon: 'RobotOutlined',
layout: false,
},
{
path: '/',
redirect: '/welcome',
......
......@@ -14,7 +14,6 @@ export const initialStateConfig = {
* @see https://umijs.org/zh-CN/plugins/plugin-initial-state
* */
export async function getInitialState() {
const userInfo = JSON.parse(localStorage.getItem('user') || '{}');
......@@ -48,8 +47,8 @@ export const layout = ({ initialState, setInitialState }) => {
enableDarkTheme
settings={initialState?.settings}
onSettingChange={(settings) => {
setInitialState((preInitialState) => ({
...preInitialState,
setInitialState(() => ({
...initialState,
settings,
}));
}}
......
......@@ -21,8 +21,8 @@ const GlobalHeaderRight: React.FC = () => {
}
return (
<Space className={className}>
<Avatar />
<SelectLang className={styles.action} />
{/* <Avatar /> */}
{/* <SelectLang className={styles.action} /> */}
</Space>
);
};
......
......@@ -91,3 +91,9 @@ ol {
background-color: #009b95 !important;
border-radius: 4px;
}
.ant-pro-sider-logo {
a h1 {
font-size: 12px !important;
}
}
export default {
'menu.chat': 'ChatGLM',
'menu.chat': 'AI助手',
'menu.welcome': '欢迎',
'menu.user': '用户管理',
'menu.more-blocks': '更多区块',
'menu.home': '首页',
'menu.admin': '账号管理',
......
......@@ -6,10 +6,10 @@ const NoFoundPage: React.FC = () => (
<Result
status="404"
title="404"
subTitle="Sorry, the page you visited does not exist."
subTitle="很抱歉,您访问的页面不存在。"
extra={
<Button type="primary" onClick={() => history.push('/')}>
Back Home
返回
</Button>
}
/>
......
import { Row, Col, Grid } from 'antd';
import { Row, Col } from 'antd';
import type { FC } from 'react';
import styles from './content.less';
import ProductionCard from './productionCard';
import { IPromptWord } from '@/services/chatGLM/api';
const { useBreakpoint } = Grid;
interface ChatFirstContentProps {
list: IPromptWord[];
onChange?: (text: string) => void;
......@@ -27,12 +25,12 @@ const ChatFirstContent: FC<ChatFirstContentProps> = (props) => {
sm={12}
xl={8}
xxl={8}
key={`${item.title}-card-${index}`}
key={`${item.type}-card-${index}`}
>
<Row justify={'start'} style={{ marginBottom: 16, minWidth: 306 }}>
<ProductionCard
index={index}
title={item.title}
title={item.type}
content={item.content}
onChange={() => {
onChange && onChange(item.content);
......
import type { ReactNode } from 'react';
import styles from './productionCard.less';
import classnames from 'classnames';
interface ProductionCardProps {
index: number;
title?: string;
content: ReactNode;
content: string;
onChange: (content: string) => void;
}
const ProductionCard = (props: ProductionCardProps) => {
const { index, title, content, onChange } = props;
const { title, content, onChange } = props;
const handleClick = () => {
onChange && onChange(content);
......
......@@ -4,13 +4,11 @@ import React, { useState, useEffect, useRef, useMemo } from 'react';
import styles from './index.less';
import ChatFirstContent from './components/content';
import {
FieldTimeOutlined,
LoadingOutlined,
MenuOutlined,
PlusOutlined,
SettingOutlined,
UserOutlined,
WechatOutlined,
} from '@ant-design/icons';
import classNames from 'classnames';
import { history } from 'umi';
......@@ -81,6 +79,7 @@ const Chat: React.FC = () => {
messageHistory.current.push({ prompt: chat, answer: '' });
setLoading(true);
sendMessage &&
glmToken &&
sendMessage(
JSON.stringify({
prompt: chat,
......@@ -131,7 +130,7 @@ const Chat: React.FC = () => {
/>
</Col>
<Col>AI改变世界</Col>
<Col pull={1}>{/* <FieldTimeOutlined /> */}</Col>
<Col pull={1}></Col>
</Row>
);
};
......@@ -164,7 +163,7 @@ const Chat: React.FC = () => {
<Space
wrap
onClick={() => {
history.push('/admin/user');
history.push('/');
}}
>
<SettingOutlined />
......@@ -203,12 +202,12 @@ const Chat: React.FC = () => {
<Row>
<Col span={24}>
<Title level={2} style={{ marginBottom: 8, fontSize: 32 }}>
产品名称
长沙振升集团
</Title>
</Col>
<Col span={24}>
<Title level={5} className={styles.subTitle}>
AI改变世界
AI智能小助手
</Title>
</Col>
</Row>
......
......@@ -5,8 +5,6 @@ import { FormattedMessage, useIntl } from 'umi';
const { Content } = Layout;
const Welcome: React.FC = () => {
const intl = useIntl();
return (
<Layout>
<Content>欢迎进入后台管理页面</Content>
......
......@@ -42,7 +42,7 @@ export function loginChatGLM(options: ILoginParams) {
}
export interface IPromptWord {
title: string;
type: string;
content: string;
}
export function GetChatGLMToken(): Promise<string> {
......@@ -106,7 +106,7 @@ export const postResetUser = (params?: any): Promise<string> => {
});
};
export const postEditUser = (params?: any): Promise<string> => {
export const postEditUser = (params?: any): Promise<string> => {
return request('https://glm-mangement-api.baibaomen.com/User/update', {
method: 'POST',
body: JSON.stringify(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