Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
P
poc-api
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
0
Merge Requests
0
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
poc
poc-api
Commits
e308ea99
Commit
e308ea99
authored
Jul 03, 2025
by
alex yao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: web search 插件读取pdf文件
parent
f99cad8c
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
1 deletion
+13
-1
WebSearchFunction.java
...ource/demand/ai/function/web_seach/WebSearchFunction.java
+13
-1
No files found.
src/main/java/cn/com/poc/thirdparty/resource/demand/ai/function/web_seach/WebSearchFunction.java
View file @
e308ea99
...
...
@@ -28,6 +28,8 @@ import org.slf4j.Logger;
import
org.slf4j.LoggerFactory
;
import
org.springframework.stereotype.Component
;
import
java.io.File
;
import
java.io.IOException
;
import
java.util.List
;
import
java.util.concurrent.*
;
...
...
@@ -115,7 +117,17 @@ public class WebSearchFunction extends AbstractLargeModelFunction {
for
(
Result
item
:
items
)
{
threadPoolExecutor
.
submit
(()
->
{
String
link
=
item
.
getLink
();
String
htmlContent
=
DocumentLoad
.
htmlToMarkdown
(
link
);
String
htmlContent
=
StringUtils
.
EMPTY
;
if
(
link
.
endsWith
(
"pdf"
))
{
try
{
File
file
=
DocumentLoad
.
downloadURLDocument
(
link
);
htmlContent
=
DocumentLoad
.
loadPDF
(
file
);
}
catch
(
IOException
e
)
{
throw
new
RuntimeException
(
e
);
}
}
else
{
htmlContent
=
DocumentLoad
.
htmlToMarkdown
(
link
);
}
if
(
StringUtils
.
isNotBlank
(
htmlContent
))
{
htmlContent
=
htmlContent
.
replaceAll
(
StringUtils
.
SPACE
,
StringUtils
.
EMPTY
);
if
(
htmlContent
.
length
()
>
1500
)
{
...
...
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