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
Unverified
Commit
dd4ca27d
authored
Jun 19, 2023
by
archer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
perf: deploy
parent
f2d37c30
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
13 deletions
+22
-13
client/src/components/Markdown/MermaidCodeBlock.tsx
+14
-6
docs/deploy/fastgpt/docker-compose.yml
+8
-7
No files found.
client/src/components/Markdown/MermaidCodeBlock.tsx
View file @
dd4ca27d
...
@@ -50,13 +50,13 @@ const MermaidBlock = ({ code }: { code: string }) => {
...
@@ -50,13 +50,13 @@ const MermaidBlock = ({ code }: { code: string }) => {
useEffect
(()
=>
{
useEffect
(()
=>
{
(
async
()
=>
{
(
async
()
=>
{
if
(
!
code
||
!
ref
.
current
)
return
;
if
(
!
code
)
return
;
try
{
try
{
const
formatCode
=
code
.
replace
(
const
formatCode
=
code
.
replace
(
new
RegExp
(
`[
${
Object
.
keys
(
punctuationMap
).
join
(
''
)}
]`
,
'g'
),
new
RegExp
(
`[
${
Object
.
keys
(
punctuationMap
).
join
(
''
)}
]`
,
'g'
),
(
match
)
=>
punctuationMap
[
match
]
(
match
)
=>
punctuationMap
[
match
]
);
);
const
{
svg
}
=
await
mermaid
API
.
render
(
`mermaid-
${
Date
.
now
()}
`
,
formatCode
);
const
{
svg
}
=
await
mermaid
.
render
(
`mermaid-
${
Date
.
now
()}
`
,
formatCode
);
setSvg
(
svg
);
setSvg
(
svg
);
}
catch
(
e
:
any
)
{
}
catch
(
e
:
any
)
{
console
.
log
(
'[Mermaid] '
,
e
?.
message
);
console
.
log
(
'[Mermaid] '
,
e
?.
message
);
...
@@ -101,17 +101,25 @@ const MermaidBlock = ({ code }: { code: string }) => {
...
@@ -101,17 +101,25 @@ const MermaidBlock = ({ code }: { code: string }) => {
},
[]);
},
[]);
return
(
return
(
<
Box
position=
{
'relative'
}
>
<
Box
position=
{
'relative'
}
_hover=
{
{
'& > .export'
:
{
display
:
'block'
}
}
}
>
<
Box
<
Box
ref=
{
ref
}
ref=
{
ref
}
className=
{
styles
.
mermaid
}
className=
{
`${styles.mermaid}`
}
minW=
{
'100px'
}
minW=
{
'100px'
}
minH=
{
'50px'
}
minH=
{
'50px'
}
py=
{
4
}
py=
{
4
}
dangerouslySetInnerHTML=
{
{
__html
:
svg
}
}
dangerouslySetInnerHTML=
{
{
__html
:
svg
}
}
/>
/>
<
MyIcon
<
MyIcon
className=
"export"
display=
{
'none'
}
name=
{
'export'
}
name=
{
'export'
}
w=
{
'20px'
}
w=
{
'20px'
}
position=
{
'absolute'
}
position=
{
'absolute'
}
...
@@ -128,4 +136,4 @@ const MermaidBlock = ({ code }: { code: string }) => {
...
@@ -128,4 +136,4 @@ const MermaidBlock = ({ code }: { code: string }) => {
);
);
};
};
export
default
memo
(
MermaidBlock
)
;
export
default
MermaidBlock
;
docs/deploy/fastgpt/docker-compose.yml
View file @
dd4ca27d
version
:
'
3.3'
version
:
'
3.3'
services
:
services
:
pg
:
pg
:
image
:
ankane/pgvector:v0.4.2
# dockerhub
#
image: ankane/pgvector:v0.4.2 # dockerhub
#
image: registry.cn-hangzhou.aliyuncs.com/fastgpt/pgvector:v0.4.2 # 阿里云
image
:
registry.cn-hangzhou.aliyuncs.com/fastgpt/pgvector:v0.4.2
# 阿里云
container_name
:
pg
container_name
:
pg
restart
:
always
restart
:
always
ports
:
ports
:
...
@@ -17,8 +17,8 @@ services:
...
@@ -17,8 +17,8 @@ services:
-
/root/fastgpt/pg/init.sql:/docker-entrypoint-initdb.d/init.sh
-
/root/fastgpt/pg/init.sql:/docker-entrypoint-initdb.d/init.sh
-
/root/fastgpt/pg/data:/var/lib/postgresql/data
-
/root/fastgpt/pg/data:/var/lib/postgresql/data
mongodb
:
mongodb
:
image
:
mongo:5.0.18
#
image: mongo:5.0.18
# image
: registry.cn-hangzhou.aliyuncs.com/fastgpt/mongo:5.0.18 # 阿里云
image
:
registry.cn-hangzhou.aliyuncs.com/fastgpt/mongo:5.0.18
# 阿里云
container_name
:
mongo
container_name
:
mongo
restart
:
always
restart
:
always
ports
:
ports
:
...
@@ -31,9 +31,9 @@ services:
...
@@ -31,9 +31,9 @@ services:
-
/root/fastgpt/mongo/data:/data/db
-
/root/fastgpt/mongo/data:/data/db
-
/root/fastgpt/mongo/logs:/var/log/mongodb
-
/root/fastgpt/mongo/logs:/var/log/mongodb
fastgpt
:
fastgpt
:
image
:
ghcr.io/c121914yu/fastgpt:latest
# github
#
image: ghcr.io/c121914yu/fastgpt:latest # github
# image: c121914yu/fast-gpt:latest # docker hub
# image: c121914yu/fast-gpt:latest # docker hub
#
image: registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt:latest # 阿里云
image
:
registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt:latest
# 阿里云
network_mode
:
host
network_mode
:
host
restart
:
always
restart
:
always
container_name
:
fastgpt
container_name
:
fastgpt
...
@@ -76,7 +76,8 @@ services:
...
@@ -76,7 +76,8 @@ services:
-
OPENAI_BASE_URL=https://api.openai.com/v1
-
OPENAI_BASE_URL=https://api.openai.com/v1
-
OPENAI_BASE_URL_AUTH=可选的安全凭证
-
OPENAI_BASE_URL_AUTH=可选的安全凭证
nginx
:
nginx
:
image
:
nginx:alpine3.17
image
:
registry.cn-hangzhou.aliyuncs.com/fastgpt/nginx:alpine3.17
# image: nginx:alpine3.17
container_name
:
nginx
container_name
:
nginx
restart
:
always
restart
:
always
network_mode
:
host
network_mode
:
host
...
...
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