Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
C
chatGLM
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
刘坚-丰林-DEV
chatGLM
Commits
977dae7f
Commit
977dae7f
authored
Apr 17, 2023
by
Ylg
Browse files
Options
Browse Files
Download
Plain Diff
resove file conflict
parents
3ee09474
f0a4671b
Show whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
55 additions
and
69 deletions
+55
-69
defaultSettings.ts
config/defaultSettings.ts
+2
-2
routes.ts
config/routes.ts
+11
-19
app.tsx
src/app.tsx
+2
-3
index.tsx
src/components/RightContent/index.tsx
+2
-2
global.less
src/global.less
+6
-0
menu.ts
src/locales/zh-CN/menu.ts
+2
-1
404.tsx
src/pages/404.tsx
+2
-2
content.tsx
src/pages/Chat/components/content.tsx
+3
-5
productionCard.tsx
src/pages/Chat/components/productionCard.tsx
+2
-3
index.tsx
src/pages/Chat/index.tsx
+5
-6
index.tsx
src/pages/UserManage/index.tsx
+16
-22
Welcome.tsx
src/pages/Welcome.tsx
+0
-2
api.ts
src/services/chatGLM/api.ts
+2
-2
No files found.
config/defaultSettings.ts
View file @
977dae7f
...
...
@@ -12,8 +12,8 @@ const Settings: LayoutSettings & {
fixSiderbar
:
true
,
colorWeak
:
false
,
pwa
:
false
,
logo
:
'
/l
ogo.png'
,
title
:
''
,
logo
:
'
https://baibaomen.oss-cn-hangzhou.aliyuncs.com/zhensheng/L
ogo.png'
,
title
:
'
长沙振升集团后台系统
'
,
iconfontUrl
:
''
,
};
...
...
config/routes.ts
View file @
977dae7f
export
default
[
{
name
:
'chat'
,
path
:
'/chat'
,
component
:
'./Chat'
,
layout
:
false
,
},
{
path
:
'/welcome'
,
name
:
'welcome'
,
icon
:
'smile'
,
component
:
'./Welcome'
,
},
{
path
:
'/admin'
,
name
:
'admin'
,
icon
:
'crown'
,
access
:
'canAdmin'
,
routes
:
[
{
name
:
'user'
,
path
:
'/admin/user'
,
path
:
'/user'
,
icon
:
'UserOutlined'
,
component
:
'./UserManage'
,
},
{
component
:
'./404'
,
},
],
access
:
'canAdmin'
,
},
{
name
:
'prompt'
,
...
...
@@ -33,6 +18,13 @@
path
:
'/prompt'
,
component
:
'./PromptWord'
,
},
{
name
:
'chat'
,
path
:
'/chat'
,
component
:
'./Chat'
,
icon
:
'RobotOutlined'
,
layout
:
false
,
},
{
path
:
'/'
,
redirect
:
'/welcome'
,
...
...
src/app.tsx
View file @
977dae7f
...
...
@@ -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
)
=>
({
...
preI
nitialState
,
setInitialState
(()
=>
({
...
i
nitialState
,
settings
,
}));
}
}
...
...
src/components/RightContent/index.tsx
View file @
977dae7f
...
...
@@ -21,8 +21,8 @@ const GlobalHeaderRight: React.FC = () => {
}
return
(
<
Space
className=
{
className
}
>
<
Avatar
/>
<
SelectLang
className=
{
styles
.
action
}
/>
{
/* <Avatar /> */
}
{
/* <SelectLang className={styles.action} /> */
}
</
Space
>
);
};
...
...
src/global.less
View file @
977dae7f
...
...
@@ -91,3 +91,9 @@ ol {
background-color: #009b95 !important;
border-radius: 4px;
}
.ant-pro-sider-logo {
a h1 {
font-size: 12px !important;
}
}
src/locales/zh-CN/menu.ts
View file @
977dae7f
export
default
{
'menu.chat'
:
'
ChatGLM
'
,
'menu.chat'
:
'
AI助手
'
,
'menu.welcome'
:
'欢迎'
,
'menu.user'
:
'用户管理'
,
'menu.more-blocks'
:
'更多区块'
,
'menu.home'
:
'首页'
,
'menu.admin'
:
'账号管理'
,
...
...
src/pages/404.tsx
View file @
977dae7f
...
...
@@ -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
>
}
/>
...
...
src/pages/Chat/components/content.tsx
View file @
977dae7f
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.t
itl
e}-card-${index}`
}
key=
{
`${item.t
yp
e}-card-${index}`
}
>
<
Row
justify=
{
'start'
}
style=
{
{
marginBottom
:
16
,
minWidth
:
306
}
}
>
<
ProductionCard
index=
{
index
}
title=
{
item
.
t
itl
e
}
title=
{
item
.
t
yp
e
}
content=
{
item
.
content
}
onChange=
{
()
=>
{
onChange
&&
onChange
(
item
.
content
);
...
...
src/pages/Chat/components/productionCard.tsx
View file @
977dae7f
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
);
...
...
src/pages/Chat/index.tsx
View file @
977dae7f
...
...
@@ -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
>
...
...
src/pages/UserManage/index.tsx
View file @
977dae7f
...
...
@@ -10,19 +10,7 @@ import { PlusOutlined } from '@ant-design/icons';
import
type
{
ActionType
}
from
'@ant-design/pro-components'
;
import
{
PageContainer
}
from
'@ant-design/pro-components'
;
import
{
ProTable
}
from
'@ant-design/pro-components'
;
import
{
Button
,
Col
,
Divider
,
Form
,
Input
,
Modal
,
Radio
,
Row
,
Select
,
Switch
,
message
,
}
from
'antd'
;
import
{
Button
,
Col
,
Divider
,
Form
,
Input
,
Modal
,
Radio
,
Row
,
Switch
,
message
}
from
'antd'
;
import
classNames
from
'classnames'
;
import
{
isEmpty
}
from
'lodash'
;
import
{
useRef
,
useState
}
from
'react'
;
...
...
@@ -30,6 +18,8 @@ import styles from './index.less';
import
{
Exclamtion
}
from
'@/components/Icons/Icons'
;
const
{
Item
}
=
Form
;
const
{
Password
}
=
Input
;
const
layout
=
{
labelCol
:
{
span
:
4
},
wrapperCol
:
{
span
:
18
},
...
...
@@ -59,11 +49,7 @@ const UserManage = () => {
const
[
ressetLoading
,
setResetLoading
]
=
useState
(
false
);
const
[
accountModalName
,
setAccountModalName
]
=
useState
(
'新建账号'
);
const
[
accountForm
]
=
Form
.
useForm
();
const
isActiveSelectOption
=
[
{
label
:
'启用'
,
value
:
true
},
{
label
:
'禁用'
,
value
:
false
},
];
const
[
resetPasswordForm
]
=
Form
.
useForm
();
const
showModal
=
()
=>
{
getRole
().
then
((
res
)
=>
{
...
...
@@ -131,7 +117,7 @@ const UserManage = () => {
title
:
'操作'
,
valueType
:
'option'
,
key
:
'option'
,
render
:
(
text
,
record
,
_
,
action
)
=>
[
render
:
(
_text
,
record
,
_
,
_
action
)
=>
[
<
a
key=
"editable"
onClick=
{
()
=>
{
...
...
@@ -194,6 +180,7 @@ const UserManage = () => {
.
then
((
res
)
=>
{
setLoading
(
false
);
setIsModalAccountOpen
(
false
);
accountForm
.
resetFields
();
actionRef
.
current
?.
reload
();
})
.
catch
((
error
)
=>
{
...
...
@@ -212,6 +199,7 @@ const UserManage = () => {
setLoading
(
false
);
setIsModalAccountOpen
(
false
);
message
.
success
(
'编辑成功'
);
accountForm
.
resetFields
();
actionRef
.
current
?.
reload
();
})
.
catch
((
error
)
=>
{
...
...
@@ -277,6 +265,7 @@ const UserManage = () => {
setResetLoading
(
false
);
setIsModalResetPassword
(
false
);
actionRef
.
current
?.
reload
();
resetPasswordForm
.
resetFields
();
message
.
success
(
'重置成功'
);
})
.
catch
((
err
)
=>
{
...
...
@@ -312,7 +301,12 @@ const UserManage = () => {
}
}
footer=
{
null
}
>
<
Form
{
...
resetLayout
}
onFinish=
{
handleClickOpenModalReset
}
name=
"resetPassword"
>
<
Form
form=
{
resetPasswordForm
}
{
...
resetLayout
}
onFinish=
{
handleClickOpenModalReset
}
name=
"resetPassword"
>
<
Item
name=
{
'newPassword'
}
label=
{
'新密码'
}
...
...
@@ -387,7 +381,7 @@ const UserManage = () => {
{
validator
:
validatePassword
},
]
}
>
<
Input
/>
<
Password
/>
</
Item
>
</>
)
}
...
...
@@ -448,7 +442,7 @@ const UserManage = () => {
}
}
rowKey=
"id"
pagination=
{
{
pageSize
:
5
,
pageSize
:
9
,
onChange
:
(
page
)
=>
{},
}
}
options=
{
false
}
...
...
src/pages/Welcome.tsx
View file @
977dae7f
...
...
@@ -5,8 +5,6 @@ import { FormattedMessage, useIntl } from 'umi';
const
{
Content
}
=
Layout
;
const
Welcome
:
React
.
FC
=
()
=>
{
const
intl
=
useIntl
();
return
(
<
Layout
>
<
Content
>
欢迎进入后台管理页面
</
Content
>
...
...
src/services/chatGLM/api.ts
View file @
977dae7f
...
...
@@ -42,7 +42,7 @@ export function loginChatGLM(options: ILoginParams) {
}
export
interface
IPromptWord
{
t
itl
e
:
string
;
t
yp
e
:
string
;
content
:
string
;
}
export
function
GetChatGLMToken
():
Promise
<
string
>
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment