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
8954c246
Commit
8954c246
authored
Apr 15, 2023
by
Ylg
Browse files
Options
Browse Files
Download
Plain Diff
resolve file conflict
parents
1bf28e3e
2c899e2a
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
64 additions
and
51 deletions
+64
-51
content.tsx
src/pages/Chat/components/content.tsx
+6
-2
index.less
src/pages/Chat/index.less
+8
-3
index.tsx
src/pages/Chat/index.tsx
+50
-46
No files found.
src/pages/Chat/components/content.tsx
View file @
8954c246
import
{
Row
,
Col
}
from
'antd'
;
import
{
Row
,
Col
,
Grid
}
from
'antd'
;
import
type
{
FC
}
from
'react'
;
import
styles
from
'./content.less'
;
import
ProductionCard
from
'./productionCard'
;
const
{
useBreakpoint
}
=
Grid
;
interface
ChatFirstContentProps
{
onChange
?:
(
text
:
string
)
=>
void
;
}
const
ChatFirstContent
:
FC
<
ChatFirstContentProps
>
=
(
props
)
=>
{
const
{
onChange
}
=
props
;
const
screen
=
useBreakpoint
();
const
isMobile
=
screen
.
xs
;
const
cardList
=
[
{
title
:
'市场营销'
,
...
...
@@ -75,7 +79,7 @@ const ChatFirstContent: FC<ChatFirstContentProps> = (props) => {
<
Row
gutter=
{
1
}
>
{
cardList
.
map
((
item
,
index
)
=>
{
return
(
<
Col
lg=
{
8
}
md=
{
12
}
span=
{
8
}
xs=
{
16
}
sm=
{
16
}
key=
{
`${item.title}-card-${index}`
}
>
<
Col
lg=
{
8
}
md=
{
12
}
span=
{
8
}
xs=
{
24
}
sm=
{
16
}
key=
{
`${item.title}-card-${index}`
}
>
<
div
className=
{
styles
.
cardPadding
}
>
<
ProductionCard
title=
{
item
.
title
}
content=
{
item
.
content
}
onChange=
{
item
.
onclick
}
/>
</
div
>
...
...
src/pages/Chat/index.less
View file @
8954c246
...
...
@@ -7,6 +7,7 @@
background: white;
.sider {
position: fixed;
top: 0;
left: 0;
z-index: 100;
width: 240px;
...
...
@@ -24,8 +25,6 @@
}
.siderTabs {
}
.noMentionLogin {
}
}
}
.header {
...
...
@@ -74,7 +73,8 @@
.footer {
position: fixed;
bottom: 0;
width: calc(100% - 200px);
left: 0;
width: 100%;
height: 150px;
padding: 16px;
background-color: white;
...
...
@@ -104,6 +104,11 @@
}
.mobileHeader {
position: fixed;
top: 0;
left: 0;
z-index: 99;
width: 100%;
height: 44px;
color: white;
font-size: 15px;
...
...
src/pages/Chat/index.tsx
View file @
8954c246
/* eslint-disable @typescript-eslint/no-unused-expressions */
import
{
Form
,
Button
,
Col
,
Row
,
Input
,
Typography
,
message
}
from
'antd'
;
import
{
Form
,
Button
,
Col
,
Row
,
Input
,
Typography
}
from
'antd'
;
import
React
,
{
useState
,
useEffect
}
from
'react'
;
import
styles
from
'./index.less'
;
import
ChatFirstContent
from
'./components/content'
;
...
...
@@ -18,9 +18,7 @@ import LoginModal from '@/components/loginModal';
import
NewSession
from
'@/components/newSession'
;
const
{
useBreakpoint
}
=
Grid
;
const
{
Title
}
=
Typography
;
const
{
Item
}
=
Form
;
const
Chat
:
React
.
FC
=
()
=>
{
...
...
@@ -35,12 +33,17 @@ const Chat: React.FC = () => {
const
[
open
,
setOpen
]
=
useState
(
false
);
const
tabShow
=
showSider
;
useEffect
(()
=>
{
if
(
!
isMobile
)
{
setShowSider
(
true
);
}
},
[
isMobile
]);
useEffect
(()
=>
{
let
token
=
''
;
if
(
localStorage
.
getItem
(
'user'
))
{
token
=
JSON
.
parse
(
localStorage
.
user
)?.
token
;
}
if
(
token
)
{
setOpen
(
false
);
}
else
{
...
...
@@ -109,61 +112,62 @@ const Chat: React.FC = () => {
return
(
<>
<
LoginModal
open=
{
open
}
setOpen=
{
setOpen
}
/>
<
LoginModal
open=
{
open
}
setOpen=
{
setOpen
}
/>
{
isMobile
&&
renderMobileHeader
()
}
<
Row
>
{
tabShow
&&
(
<
Col
span=
{
4
}
sm=
{
10
}
md=
{
7
}
xs=
{
12
}
lg=
{
5
}
className=
{
styles
.
siderWrapper
}
>
<
div
className=
{
styles
.
sider
}
>
<
div
style=
{
{
top
:
isMobile
&&
'44px'
}
}
className=
{
styles
.
sider
}
>
<
div
className=
{
styles
.
siderChatContent
}
>
<
Button
size=
"large"
block
type=
"primary"
icon=
{
<
PlusOutlined
/>
}
>
新建对话
</
Button
>
</
div
>
<
div
className=
{
styles
.
siderTabs
}
>
<
Row
>
{
siderTabsList
.
map
((
item
)
=>
{
return
(
<
Col
key=
{
item
.
text
}
>
<
Row
>
{
siderTabsList
.
map
((
item
)
=>
{
return
(
<
Col
key=
{
item
.
text
}
>
<
div
className=
{
styles
.
chatSiderChatTabsCard
}
onClick=
{
()
=>
{
selectSliderTabsHandleClick
(
item
.
checked
);
}
}
>
<
div
className=
{
styles
.
chatSiderChatTabsCard
}
onClick=
{
()
=>
{
selectSliderTabsHandleClick
(
item
.
checked
);
}
}
className=
{
classNames
(
styles
.
chatSiderChatTabsCardIcons
,
selectSiderTabs
===
item
.
checked
&&
styles
.
checkedChatSiderChatTabsCardIcons
,
)
}
>
<
div
className=
{
classNames
(
styles
.
chatSiderChatTabsCardIcons
,
selectSiderTabs
===
item
.
checked
&&
styles
.
checkedChatSiderChatTabsCardIcons
,
)
}
>
{
item
.
icons
}
</
div
>
<
div
className=
{
classNames
(
styles
.
chatSiderChatTabsCardText
,
selectSiderTabs
===
item
.
checked
&&
styles
.
checkedChatSiderChatTabsCardText
,
)
}
>
{
item
.
text
}
</
div
>
{
item
.
icons
}
</
div
>
</
Col
>
);
})
}
</
Row
>
</
div
>
<
div
className=
{
styles
.
noMentionLogin
}
/>
<
div
className=
{
classNames
(
styles
.
chatSiderChatTabsCardText
,
selectSiderTabs
===
item
.
checked
&&
styles
.
checkedChatSiderChatTabsCardText
,
)
}
>
{
item
.
text
}
</
div
>
</
div
>
</
Col
>
);
})
}
</
Row
>
</
div
>
</
Col
>
)
}
<
Col
className=
{
styles
.
chatContent
}
span=
{
20
}
lg=
{
19
}
sm=
{
14
}
md=
{
17
}
xs=
{
12
}
>
<
Col
className=
{
styles
.
chatContent
}
span=
{
20
}
lg=
{
19
}
sm=
{
14
}
md=
{
17
}
xs=
{
isMobile
?
24
:
12
}
>
<
div
className=
{
styles
.
header
}
>
<
Row
>
<
Col
span=
{
24
}
>
...
...
@@ -194,8 +198,8 @@ const Chat: React.FC = () => {
)
}
<
div
className=
{
styles
.
footer
}
>
<
Row
>
<
Col
span=
{
20
}
>
<
div
className=
{
styles
.
chatWrapper
}
>
<
Col
span=
{
16
}
push=
{
4
}
>
<
div
className=
{
styles
.
chatWrapper
}
style=
{
{
margin
:
isMobile
&&
'o auto'
}
}
>
<
Item
name=
"chatInput"
>
<
Input
placeholder=
"在这里输入你想知道的问题,给我几句提示,我来帮你回答"
...
...
@@ -204,7 +208,7 @@ const Chat: React.FC = () => {
</
Item
>
</
div
>
</
Col
>
<
Col
span=
{
4
}
>
<
Col
span=
{
4
}
push=
{
4
}
>
<
div
className=
{
styles
.
outputButtonWrapper
}
>
<
Item
name=
"outputButton"
>
<
Button
htmlType=
"submit"
type=
"primary"
size=
"large"
disabled=
{
chat
.
length
===
0
}
>
...
...
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