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
0673fca2
Commit
0673fca2
authored
Apr 20, 2023
by
文旺-丰林-DEV
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改公司名称/记录会话内容
parent
6732a4f7
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
47 additions
and
28 deletions
+47
-28
defaultSettings.ts
config/defaultSettings.ts
+1
-1
index.tsx
src/components/Footer/index.tsx
+1
-1
index.tsx
src/components/loginModal/index.tsx
+2
-2
issue.component.tsx
src/components/newSession/issue.component.tsx
+0
-2
zh-CN.ts
src/locales/zh-CN.ts
+1
-1
index.tsx
src/pages/Chat/index.tsx
+20
-3
index.tsx
src/pages/UserManage/index.tsx
+4
-4
api.ts
src/services/chatGLM/api.ts
+18
-14
No files found.
config/defaultSettings.ts
View file @
0673fca2
...
...
@@ -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
:
''
,
};
...
...
src/components/Footer/index.tsx
View file @
0673fca2
...
...
@@ -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
();
...
...
src/components/loginModal/index.tsx
View file @
0673fca2
...
...
@@ -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
>
...
...
src/components/newSession/issue.component.tsx
View file @
0673fca2
...
...
@@ -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
}
/>
...
...
src/locales/zh-CN.ts
View file @
0673fca2
...
...
@@ -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 开发,快速构建标准页面'
,
...
...
src/pages/Chat/index.tsx
View file @
0673fca2
...
...
@@ -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
}
>
...
...
src/pages/UserManage/index.tsx
View file @
0673fca2
...
...
@@ -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'
}
>
...
...
src/services/chatGLM/api.ts
View file @
0673fca2
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
,
});
};
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