Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
赵月辉
/
fastgpt-migrated
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
c03a7db6
authored
Mar 05, 2023
by
archer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
perf: 聊天页优化
parent
2cc32d18
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
10 additions
and
6 deletions
+10
-6
src/components/Markdown/index.module.scss
+1
-0
src/components/Markdown/index.tsx
+1
-1
src/pages/api/chat/chatGpt.ts
+0
-1
src/pages/chat/index.tsx
+8
-4
No files found.
src/components/Markdown/index.module.scss
View file @
c03a7db6
...
@@ -353,6 +353,7 @@
...
@@ -353,6 +353,7 @@
line-height
:
1
.6
;
line-height
:
1
.6
;
letter-spacing
:
0
.5px
;
letter-spacing
:
0
.5px
;
text-align
:
justify
;
text-align
:
justify
;
white-space
:
pre
;
pre
{
pre
{
display
:
block
;
display
:
block
;
width
:
100%
;
width
:
100%
;
...
...
src/components/Markdown/index.tsx
View file @
c03a7db6
...
@@ -42,7 +42,7 @@ const Markdown = ({ source, isChatting }: { source: string; isChatting: boolean
...
@@ -42,7 +42,7 @@ const Markdown = ({ source, isChatting }: { source: string; isChatting: boolean
</
Flex
>
</
Flex
>
<
SyntaxHighlighter
<
SyntaxHighlighter
style=
{
codeLight
as
any
}
style=
{
codeLight
as
any
}
language=
{
match
?.[
1
]
||
'bash'
}
language=
{
match
?.[
1
]
}
PreTag=
"pre"
PreTag=
"pre"
{
...
props
}
{
...
props
}
>
>
...
...
src/pages/api/chat/chatGpt.ts
View file @
c03a7db6
...
@@ -50,7 +50,6 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse)
...
@@ -50,7 +50,6 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse)
content
:
item
.
value
content
:
item
.
value
})
})
);
);
// 获取 chatAPI
// 获取 chatAPI
const
chatAPI
=
getOpenAIApi
(
userApiKey
);
const
chatAPI
=
getOpenAIApi
(
userApiKey
);
const
chatResponse
=
await
chatAPI
.
createChatCompletion
(
const
chatResponse
=
await
chatAPI
.
createChatCompletion
(
...
...
src/pages/chat/index.tsx
View file @
c03a7db6
...
@@ -300,10 +300,14 @@ const Chat = () => {
...
@@ -300,10 +300,14 @@ const Chat = () => {
></
Image
>
></
Image
>
</
Box
>
</
Box
>
<
Box
flex=
{
'1 0 0'
}
w=
{
0
}
overflowX=
{
'auto'
}
>
<
Box
flex=
{
'1 0 0'
}
w=
{
0
}
overflowX=
{
'auto'
}
>
<
Markdown
{
item
.
obj
===
'AI'
?
(
source=
{
item
.
value
}
<
Markdown
isChatting=
{
isChatting
&&
index
===
chatList
.
length
-
1
}
source=
{
item
.
value
}
/>
isChatting=
{
isChatting
&&
index
===
chatList
.
length
-
1
}
/>
)
:
(
<
Box
whiteSpace=
{
'pre'
}
>
{
item
.
value
}
</
Box
>
)
}
</
Box
>
</
Box
>
</
Flex
>
</
Flex
>
</
Box
>
</
Box
>
...
...
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