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
3d187137
Commit
3d187137
authored
Jan 14, 2025
by
alex yao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix
parent
bfc5ed6c
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
43 additions
and
31 deletions
+43
-31
WebSearchFunction.java
...ource/demand/ai/function/web_seach/WebSearchFunction.java
+5
-3
WebSearchFunctionResult.java
...demand/ai/function/web_seach/WebSearchFunctionResult.java
+38
-28
No files found.
src/main/java/cn/com/poc/thirdparty/resource/demand/ai/function/web_seach/WebSearchFunction.java
View file @
3d187137
...
...
@@ -71,6 +71,7 @@ public class WebSearchFunction extends AbstractLargeModelFunction {
.
cse
().
list
().
setCx
(
CX
)
.
setKey
(
KEY
)
.
setQ
(
query
)
.
setStart
(
1L
)
.
setNum
(
3
)
.
execute
();
List
<
Result
>
items
=
execute
.
getItems
();
...
...
@@ -86,12 +87,13 @@ public class WebSearchFunction extends AbstractLargeModelFunction {
String
title
=
item
.
getTitle
();
String
snippet
=
item
.
getSnippet
();
WebSearchFunctionResult
webSearchResult
=
new
WebSearchFunctionResult
();
webSearchResult
.
setTitle
(
title
);
webSearchResult
.
setUrl
(
link
);
webSearchResult
.
setSnippet
(
snippet
);
//
webSearchResult.setTitle(title);
//
webSearchResult.setUrl(link);
//
webSearchResult.setSnippet(snippet);
webSearchResult
.
setContent
(
htmlContent
);
results
.
add
(
webSearchResult
);
}
logger
.
info
(
"web search result:{}"
,
results
.
toString
());
return
JsonUtils
.
serialize
(
results
);
}
catch
(
Exception
e
)
{
logger
.
error
(
"web search error:"
+
e
.
getMessage
());
...
...
src/main/java/cn/com/poc/thirdparty/resource/demand/ai/function/web_seach/WebSearchFunctionResult.java
View file @
3d187137
...
...
@@ -6,37 +6,37 @@ package cn.com.poc.thirdparty.resource.demand.ai.function.web_seach;
*/
public
class
WebSearchFunctionResult
{
private
String
title
;
private
String
url
;
private
String
snippet
;
//
private String title;
//
//
private String url;
//
//
private String snippet;
private
String
content
;
public
String
getTitle
()
{
return
title
;
}
public
void
setTitle
(
String
title
)
{
this
.
title
=
title
;
}
public
String
getUrl
()
{
return
url
;
}
public
void
setUrl
(
String
url
)
{
this
.
url
=
url
;
}
public
String
getSnippet
()
{
return
snippet
;
}
public
void
setSnippet
(
String
snippet
)
{
this
.
snippet
=
snippet
;
}
//
public String getTitle() {
//
return title;
//
}
//
//
public void setTitle(String title) {
//
this.title = title;
//
}
//
//
public String getUrl() {
//
return url;
//
}
//
//
public void setUrl(String url) {
//
this.url = url;
//
}
//
//
public String getSnippet() {
//
return snippet;
//
}
//
//
public void setSnippet(String snippet) {
//
this.snippet = snippet;
//
}
public
String
getContent
()
{
return
content
;
...
...
@@ -45,4 +45,14 @@ public class WebSearchFunctionResult {
public
void
setContent
(
String
content
)
{
this
.
content
=
content
;
}
@Override
public
String
toString
()
{
return
"{"
+
// "title='" + title + '\'' +
// ", url='" + url + '\'' +
// ", snippet='" + snippet + '\'' +
"content='"
+
content
+
'\''
+
'}'
;
}
}
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