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
a7c5d3cc
authored
Apr 04, 2023
by
archer
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'dev2.4' into dev2.5
parents
943abbe0
cc36a13f
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
12 deletions
+13
-12
src/pages/model/detail/components/SelectFileModal.tsx
+12
-11
src/utils/tools.ts
+1
-1
No files found.
src/pages/model/detail/components/SelectFileModal.tsx
View file @
a7c5d3cc
...
@@ -9,7 +9,8 @@ import {
...
@@ -9,7 +9,8 @@ import {
ModalHeader
,
ModalHeader
,
ModalCloseButton
,
ModalCloseButton
,
ModalBody
,
ModalBody
,
Input
Input
,
Textarea
}
from
'@chakra-ui/react'
;
}
from
'@chakra-ui/react'
;
import
{
useToast
}
from
'@/hooks/useToast'
;
import
{
useToast
}
from
'@/hooks/useToast'
;
import
{
useSelectFile
}
from
'@/hooks/useSelectFile'
;
import
{
useSelectFile
}
from
'@/hooks/useSelectFile'
;
...
@@ -66,8 +67,8 @@ const SelectFileModal = ({
...
@@ -66,8 +67,8 @@ const SelectFileModal = ({
})
})
)
)
)
)
.
join
(
'
\n
'
)
.
join
(
'
'
)
.
replace
(
/
\n
+/g
,
'\n'
);
.
replace
(
/
(\\
n|
\n)
+/g
,
'\n'
);
setFileText
(
fileTexts
);
setFileText
(
fileTexts
);
console
.
log
(
encode
(
fileTexts
));
console
.
log
(
encode
(
fileTexts
));
}
catch
(
error
:
any
)
{
}
catch
(
error
:
any
)
{
...
@@ -142,18 +143,18 @@ const SelectFileModal = ({
...
@@ -142,18 +143,18 @@ const SelectFileModal = ({
size=
{
'sm'
}
size=
{
'sm'
}
/>
/>
</
Flex
>
</
Flex
>
<
Box
<
Textarea
flex=
{
'1 0 0'
}
flex=
{
'1 0 0'
}
h=
{
0
}
h=
{
0
}
w=
{
'100%'
}
w=
{
'100%'
}
overflowY=
{
'auto'
}
placeholder=
"文件内容"
p=
{
2
}
maxLength=
{
-
1
}
backgroundColor=
{
'blackAlpha.50'
}
resize=
{
'none'
}
whiteSpace=
{
'pre-wrap'
}
fontSize=
{
'xs'
}
fontSize=
{
'xs'
}
>
whiteSpace=
{
'pre-wrap'
}
{
fileText
}
value=
{
fileText
}
</
Box
>
onChange=
{
(
e
)
=>
setFileText
(
e
.
target
.
value
)
}
/>
</
ModalBody
>
</
ModalBody
>
<
Flex
px=
{
6
}
pt=
{
2
}
pb=
{
4
}
>
<
Flex
px=
{
6
}
pt=
{
2
}
pb=
{
4
}
>
...
...
src/utils/tools.ts
View file @
a7c5d3cc
...
@@ -76,7 +76,7 @@ export const readPdfContent = (file: File) =>
...
@@ -76,7 +76,7 @@ export const readPdfContent = (file: File) =>
const
page
=
await
doc
.
getPage
(
pageNo
);
const
page
=
await
doc
.
getPage
(
pageNo
);
const
tokenizedText
=
await
page
.
getTextContent
();
const
tokenizedText
=
await
page
.
getTextContent
();
const
pageText
=
tokenizedText
.
items
.
map
((
token
:
any
)
=>
token
.
str
).
join
(
''
);
const
pageText
=
tokenizedText
.
items
.
map
((
token
:
any
)
=>
token
.
str
).
join
(
''
);
return
pageText
.
replaceAll
(
/
\s
+/g
,
'\n'
)
;
return
pageText
;
};
};
let
reader
=
new
FileReader
();
let
reader
=
new
FileReader
();
...
...
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