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
c330a658
Commit
c330a658
authored
Apr 18, 2023
by
文旺-丰林-DEV
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add retry feature
parent
18d92ecd
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
68 additions
and
36 deletions
+68
-36
answer.component.tsx
src/components/newSession/answer.component.tsx
+20
-4
index.less
src/components/newSession/index.less
+2
-12
index.tsx
src/components/newSession/index.tsx
+8
-2
global.less
src/global.less
+8
-4
productionCard.less
src/pages/Chat/components/productionCard.less
+7
-6
index.tsx
src/pages/Chat/index.tsx
+22
-7
api.ts
src/services/chatGLM/api.ts
+1
-1
No files found.
src/components/newSession/answer.component.tsx
View file @
c330a658
...
...
@@ -7,13 +7,13 @@ import { CopyOutlined } from '@ant-design/icons';
interface
IAnswerProps
{
answerValue
:
string
;
isShowRetry
?:
boolean
;
onRetry
?:
()
=>
void
;
}
const
{
useBreakpoint
}
=
Grid
;
const
Answer
=
(
props
:
IAnswerProps
)
=>
{
const
{
answerValue
,
isShow
Retry
}
=
props
;
const
{
answerValue
,
on
Retry
}
=
props
;
const
screens
=
useBreakpoint
();
const
isMobile
=
screens
.
xs
;
...
...
@@ -64,7 +64,16 @@ const Answer = (props: IAnswerProps) => {
</
p
>
)
}
</
div
>
{
/* {isShowRetry && !isMobile && <Button className={styles.chat_retry}>重试</Button>} */
}
{
!
isMobile
&&
(
<
Button
className=
{
styles
.
chat_retry
}
onClick=
{
()
=>
{
onRetry
&&
onRetry
();
}
}
>
重试
</
Button
>
)
}
</
Col
>
<
Col
>
{
isMobile
&&
answerValue
&&
(
...
...
@@ -78,7 +87,14 @@ const Answer = (props: IAnswerProps) => {
>
复制回答
</
Button
>
{
/* <Button className={styles.mobile_chat_retry}>重试</Button> */
}
<
Button
className=
{
styles
.
mobile_chat_retry
}
onClick=
{
()
=>
{
onRetry
&&
onRetry
();
}
}
>
重试
</
Button
>
</
Row
>
)
}
</
Col
>
...
...
src/components/newSession/index.less
View file @
c330a658
...
...
@@ -71,21 +71,11 @@
}
}
.chat_retry {
width: 90px;
height: 48px;
// margin-left: 10px;
margin-left: 10px;
color: #009b95;
background: #ffffff;
border: 1px solid #009b95;
border-radius: 6px;
span {
width: 40px;
height: 28px;
color: #009b95;
font-weight: 400;
font-size: 20px;
font-family: PingFangSC-Regular, PingFang SC;
line-height: 28px;
}
}
}
.mobile_button {
...
...
src/components/newSession/index.tsx
View file @
c330a658
...
...
@@ -7,12 +7,13 @@ import classNames from 'classnames';
interface
INewSessionProps
{
questionValue
:
string
;
answerValue
:
string
;
onRetry
?:
(
prompt
:
string
)
=>
void
;
}
const
{
useBreakpoint
}
=
Grid
;
const
NewSession
=
(
props
:
INewSessionProps
)
=>
{
const
{
questionValue
,
answerValue
}
=
props
;
const
{
questionValue
,
answerValue
,
onRetry
}
=
props
;
const
screens
=
useBreakpoint
();
const
isMobile
=
screens
.
xs
;
...
...
@@ -26,7 +27,12 @@ const NewSession = (props: INewSessionProps) => {
className=
{
classNames
(
isMobile
&&
styles
.
mobile_newSession
,
styles
.
newSession
)
}
>
<
Issue
questionValue=
{
questionValue
}
/>
<
Answer
answerValue=
{
answerValue
}
/>
<
Answer
answerValue=
{
answerValue
}
onRetry=
{
()
=>
{
onRetry
&&
onRetry
(
questionValue
);
}
}
/>
</
Row
>
);
};
...
...
src/global.less
View file @
c330a658
...
...
@@ -25,6 +25,10 @@
}
}
html {
overflow-x: hidden;
}
html,
body,
#root {
...
...
@@ -100,12 +104,12 @@ ol {
.ant-btn:active,
.ant-btn:focus {
background-color: #
00beb6
!important;
border-color: #
00beb6
!important;
background-color: #
68beb9
!important;
border-color: #
68beb9
!important;
}
.ant-btn:hover {
color: #fff;
background-color: #
00beb6
!important;
border-color: #
00beb6
!important;
background-color: #
68beb9
!important;
border-color: #
68beb9
!important;
}
src/pages/Chat/components/productionCard.less
View file @
c330a658
...
...
@@ -4,10 +4,10 @@
cursor: pointer;
&:hover .CardContent {
background-color: #0a7a73;
&:hover
.content {
.content {
color: white;
}
&:hover
.button {
.button {
color: #0a7a73;
background-color: white;
border: solid 1px white;
...
...
@@ -27,16 +27,17 @@
transition: all 0.25s;
.content {
display: -webkit-box;
height:
202
px;
height:
174
px;
overflow: hidden;
color: #666666;
font-weight: 400;
font-size: 18px;
line-height: 28px;
letter-spacing: 4px;
white-space: normal;
text-overflow: ellipsis;
-webkit-box-orient: vertical;
-webkit-line-clamp:
7
;
-webkit-line-clamp:
6
;
}
.button {
width: 180px;
...
...
@@ -55,10 +56,10 @@
.CardWrapperMobile {
&:hover .CardContent {
background-color: #f8f9fb;
&:hover
.content {
.content {
color: #0a7a73;
}
&:hover
.button {
.button {
color: #0a7a73;
background-color: #f8f9fb;
border: solid 1px #0a7a73;
...
...
src/pages/Chat/index.tsx
View file @
c330a658
...
...
@@ -19,6 +19,7 @@ import { GetChatGLMToken, GetPromptList } from '@/services/chatGLM/api';
import
{
useAccess
}
from
'umi'
;
import
{
PageLoading
}
from
'@ant-design/pro-layout'
;
import
{
checkIsTokenExpires
}
from
'@/access'
;
import
TextArea
from
'antd/lib/input/TextArea'
;
const
{
useBreakpoint
}
=
Grid
;
const
{
Title
}
=
Typography
;
...
...
@@ -252,6 +253,10 @@ const Chat: React.FC = () => {
<
div
style=
{
{
marginBottom
:
150
}
}
>
{
messageHistory
.
current
.
map
((
item
,
index
)
=>
(
<
NewSession
onRetry=
{
(
value
)
=>
{
setChat
(
value
);
handleSendMessage
();
}
}
key=
{
'new'
+
index
}
questionValue=
{
item
.
prompt
}
answerValue=
{
item
.
answer
}
...
...
@@ -276,8 +281,8 @@ const Chat: React.FC = () => {
}
}
>
<
Row
justify=
{
'center'
}
align=
{
'middle'
}
style=
{
{
textAlign
:
'center'
}
}
>
<
Col
span=
{
24
}
style=
{
{
textAlign
:
'center'
}
}
>
<
Space
style=
{
{
textAlign
:
'center'
}
}
>
<
Col
span=
{
24
}
style=
{
{
textAlign
:
'center'
,
marginTop
:
12
}
}
>
<
Space
style=
{
{
textAlign
:
'center'
,
height
:
40
}
}
>
<
div
className=
{
styles
.
chatWrapper
}
style=
{
{
...
...
@@ -290,11 +295,16 @@ const Chat: React.FC = () => {
}
}
>
<
Item
name=
"chatInput"
>
<
Input
required
placeholder=
"在这里输入你想知道的问题,给我几句提示,我来帮你回答"
size=
"large"
/>
{
isMobile
?
(
<
TextArea
autoSize=
{
{
minRows
:
1
,
maxRows
:
2
}
}
required
placeholder=
{
'在这里输入你想知道的问题'
}
size=
"large"
/>
)
:
(
<
Input
required
placeholder=
{
'在这里输入你想知道的问题'
}
size=
"large"
/>
)
}
</
Item
>
</
div
>
<
div
className=
{
styles
.
outputButtonWrapper
}
>
...
...
@@ -314,6 +324,11 @@ const Chat: React.FC = () => {
</
div
>
</
Space
>
</
Col
>
<
Col
span=
{
24
}
>
<
span
style=
{
{
color
:
'#999'
,
fontSize
:
13
,
marginTop
:
isMobile
?
10
:
0
}
}
>
技术支持方 ChatMAP.AI
</
span
>
</
Col
>
</
Row
>
</
div
>
</
Row
>
...
...
src/services/chatGLM/api.ts
View file @
c330a658
...
...
@@ -24,7 +24,7 @@ request.interceptors.response.use(async (response): Promise<any> => {
if
(
response
.
status
===
401
)
{
localStorage
.
removeItem
(
'user'
);
localStorage
.
removeItem
(
'expires'
);
history
.
push
(
'/chat'
)
;
location
.
href
=
'/chat'
;
}
else
if
(
response
.
status
===
200
)
{
return
response
;
}
else
{
...
...
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