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
c49c0059
Commit
c49c0059
authored
Apr 17, 2023
by
文旺-丰林-DEV
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix ui style
parent
cd9f490e
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
67 additions
and
26 deletions
+67
-26
package.json
package.json
+1
-0
dbPromise.ts
src/db/dbPromise.ts
+10
-0
productionCard.less
src/pages/Chat/components/productionCard.less
+14
-0
productionCard.tsx
src/pages/Chat/components/productionCard.tsx
+4
-2
index.tsx
src/pages/Chat/index.tsx
+17
-3
index.tsx
src/pages/PromptWord/index.tsx
+4
-4
index.tsx
src/pages/UserManage/index.tsx
+2
-1
api.ts
src/services/chatGLM/api.ts
+15
-16
No files found.
package.json
View file @
c49c0059
...
...
@@ -53,6 +53,7 @@
"
ahooks
"
:
"^3.7.6"
,
"
antd
"
:
"^4.20.0"
,
"
classnames
"
:
"^2.3.0"
,
"
idb
"
:
"^7.1.1"
,
"
lodash
"
:
"^4.17.0"
,
"
moment
"
:
"^2.29.0"
,
"
omit.js
"
:
"^2.0.2"
,
...
...
src/db/dbPromise.ts
0 → 100644
View file @
c49c0059
import
{
openDB
}
from
'idb'
;
const
dbPromise
=
openDB
(
'chats'
,
1
,
{
upgrade
(
db
)
{
db
.
createObjectStore
(
'titles'
,
{
keyPath
:
'titles'
});
db
.
createObjectStore
(
'history'
,
{
keyPath
:
'history'
});
},
});
export
default
dbPromise
;
src/pages/Chat/components/productionCard.less
View file @
c49c0059
...
...
@@ -51,3 +51,17 @@
}
}
}
.CardWrapperMobile {
&:hover .CardContent {
background-color: #f8f9fb;
&:hover .content {
color: #0a7a73;
}
&:hover .button {
color: #0a7a73;
background-color: #f8f9fb;
border: solid 1px #0a7a73;
}
}
}
src/pages/Chat/components/productionCard.tsx
View file @
c49c0059
import
{
Grid
}
from
'antd'
;
import
styles
from
'./productionCard.less'
;
import
classnames
from
'classnames'
;
const
{
useBreakpoint
}
=
Grid
;
interface
ProductionCardProps
{
index
:
number
;
title
?:
string
;
...
...
@@ -11,13 +11,15 @@ interface ProductionCardProps {
const
ProductionCard
=
(
props
:
ProductionCardProps
)
=>
{
const
{
title
,
content
,
onChange
}
=
props
;
const
screens
=
useBreakpoint
();
const
isMobile
=
screens
.
xs
;
const
handleClick
=
()
=>
{
onChange
&&
onChange
(
content
);
};
return
(
<
div
className=
{
classnames
(
styles
.
CardWrapper
)
}
>
<
div
className=
{
classnames
(
`${styles.CardWrapper} ${isMobile && styles.CardWrapperMobile}`
)
}
>
<
div
className=
{
styles
.
title
}
>
{
title
}
</
div
>
<
div
className=
{
styles
.
CardContent
}
>
<
div
className=
{
styles
.
content
}
>
{
content
}
</
div
>
...
...
src/pages/Chat/index.tsx
View file @
c49c0059
...
...
@@ -100,6 +100,12 @@ const Chat: React.FC = () => {
}
}
function
newChat
()
{
messageHistory
.
current
.
splice
(
0
,
messageHistory
.
current
.
length
||
0
);
isMobile
&&
setShowSider
(
false
);
setFirstChat
(
false
);
}
useEffect
(()
=>
{
if
(
access
?.
token
)
{
getChatGLMToken
();
...
...
@@ -162,8 +168,8 @@ const Chat: React.FC = () => {
>
<
div
className=
{
styles
.
siderChatContent
}
>
<
div
style=
{
{
padding
:
'30px 20px 0 20px'
}
}
>
<
Button
size=
"large"
block
type=
"primary"
icon=
{
<
PlusOutlined
/>
}
>
新
建
对话
<
Button
size=
"large"
block
type=
"primary"
icon=
{
<
PlusOutlined
/>
}
onClick=
{
newChat
}
>
新
的
对话
</
Button
>
</
div
>
</
div
>
...
...
@@ -214,7 +220,15 @@ const Chat: React.FC = () => {
{
!
isMobile
&&
(
<
div
className=
{
styles
.
header
}
hidden=
{
firstChat
}
>
<
Row
>
<
Col
span=
{
24
}
>
<
Col
span=
{
24
}
style=
{
{
display
:
'flex'
,
justifyContent
:
'center'
,
alignItems
:
'center'
}
}
>
<
img
style=
{
{
marginRight
:
12
,
height
:
40
,
marginBottom
:
6
}
}
src=
"https://baibaomen.oss-cn-hangzhou.aliyuncs.com/zhensheng/Logo.png"
alt=
"logo"
/>
<
Title
level=
{
2
}
style=
{
{
marginBottom
:
8
,
fontSize
:
32
}
}
>
长沙振升集团
</
Title
>
...
...
src/pages/PromptWord/index.tsx
View file @
c49c0059
...
...
@@ -141,7 +141,7 @@ const PromptWord = () => {
actionRef
.
current
?.
reload
();
}
catch
(
error
)
{
setAllLoading
({
...
allLoading
,
editModalLoading
:
false
});
message
.
error
(
'编辑提示用语失败,请重试
!
'
);
message
.
error
(
'编辑提示用语失败,请重试'
);
}
};
...
...
@@ -156,7 +156,7 @@ const PromptWord = () => {
actionRef
.
current
?.
reload
();
}
catch
(
error
)
{
setAllLoading
({
...
allLoading
,
createModalLoading
:
false
});
message
.
error
(
'新增提示用语失败,请重试
!
'
);
message
.
error
(
'新增提示用语失败,请重试'
);
}
};
...
...
@@ -171,7 +171,7 @@ const PromptWord = () => {
actionRef
.
current
?.
reload
();
}
catch
(
error
)
{
setAllLoading
({
...
allLoading
,
deleteModalLoading
:
false
});
message
.
error
(
'删除提示用语失败,请重试
!
'
);
message
.
error
(
'删除提示用语失败,请重试'
);
}
};
...
...
@@ -217,7 +217,7 @@ const PromptWord = () => {
};
}
catch
(
error
)
{
setAllLoading
({
...
allLoading
,
listLoading
:
false
});
message
.
error
(
'请求列表失败,请重试
!
'
);
message
.
error
(
'请求列表失败,请重试'
);
return
{
data
:
[],
total
:
0
,
...
...
src/pages/UserManage/index.tsx
View file @
c49c0059
...
...
@@ -229,7 +229,8 @@ const UserManage = () => {
};
const
validatePassword
=
(
_
,
value
:
any
)
=>
{
const
regex
=
/^
(?=
.*
\d)(?=
.*
[
a-z
])(?=
.*
[
A-Z
])[
a-zA-Z
\d]{8,16}
$/
;
const
regex
=
/^
(?=
.*
\d)(?=
.*
[
a-z
])(?=
.*
[
A-Z
])[
a-zA-Z
\d
!@#$%^&*()_+}{":?><,.
/
;'
\[\]\\
=-
]{8,16}
$/
;
if
(
regex
.
test
(
value
))
{
return
Promise
.
resolve
();
}
...
...
src/services/chatGLM/api.ts
View file @
c49c0059
import
{
extend
}
from
'umi-request'
;
import
{
history
}
from
'umi'
;
import
{
message
}
from
'antd'
;
interface
ILoginParams
{
name
:
string
;
...
...
@@ -22,9 +21,9 @@ request.interceptors.request.use((url, options) => {
});
request
.
interceptors
.
response
.
use
(
async
(
response
):
Promise
<
any
>
=>
{
console
.
log
(
'response'
,
response
);
if
(
response
.
status
===
401
)
{
localStorage
.
removeItem
(
'user'
);
localStorage
.
removeItem
(
'expires'
);
history
.
push
(
'/chat'
);
}
else
if
(
response
.
status
===
200
)
{
return
response
;
...
...
@@ -94,36 +93,36 @@ export const getUserMessage = (params?: any): Promise<string> => {
export
const
createPromptWords
=
(
params
:
any
):
Promise
<
any
>
=>
{
return
request
(
'https://glm-mangement-api.baibaomen.com/PromptWords/create'
,
{
method
:
'POST'
,
data
:
params
})
}
data
:
params
,
})
;
}
;
export
const
updatePromptWords
=
(
params
:
any
):
Promise
<
any
>
=>
{
return
request
(
'https://glm-mangement-api.baibaomen.com/PromptWords/update'
,
{
method
:
'POST'
,
data
:
params
})
}
data
:
params
,
})
;
}
;
export
const
deletePromptWords
=
(
params
:
any
):
Promise
<
any
>
=>
{
return
request
(
'https://glm-mangement-api.baibaomen.com/PromptWords/delete'
,
{
method
:
'POST'
,
data
:
params
})
}
data
:
params
,
})
;
}
;
export
const
pagePromptWords
=
(
params
:
any
):
Promise
<
any
>
=>
{
return
request
(
'https://glm-mangement-api.baibaomen.com/PromptWords/page'
,
{
method
:
'POST'
,
data
:
params
})
}
data
:
params
,
})
;
}
;
export
const
typePromptWords
=
():
Promise
<
any
>
=>
{
return
request
(
'https://glm-mangement-api.baibaomen.com/PromptWords/type'
,
{
method
:
'POST'
,
})
}
})
;
}
;
export
const
postDeleteUser
=
(
params
?:
any
):
Promise
<
string
>
=>
{
return
request
(
'https://glm-mangement-api.baibaomen.com/User/delete'
,
{
...
...
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