Commit 03a0ab73 authored by alex yao's avatar alex yao

fix

parent 3d187137
......@@ -45,7 +45,7 @@ public class WebSearchFunction extends AbstractLargeModelFunction {
private final String KEY = Config.get("google.custom.search.key");
private final String CX = Config.get("google.custom.search.cx");
private final String DESC = "该方法是通过Bing所有对用户给出的关键词进行网站、网页搜索检索获取网页内容";
private final String DESC = "该方法是使用Google搜索,对用户给出的关键词进行网页搜索检索并且获取网页内容";
private final FunctionLLMConfig functionLLMConfig = new FunctionLLMConfig.FunctionLLMConfigBuilder()
.name("web_search")
......@@ -61,6 +61,7 @@ public class WebSearchFunction extends AbstractLargeModelFunction {
}
JSONObject jsonObject = JSONObject.parseObject(content);
String query = jsonObject.getString("query");
query = query.replaceAll(StringUtils.SPACE, StringUtils.EMPTY);
List<WebSearchFunctionResult> results = new ArrayList<>();
try {
CustomSearchAPI customSearchAPI = new CustomSearchAPI.Builder(transport, jsonFactory, GoogleNetHttpTransport.newTrustedTransport().createRequestFactory().getInitializer())
......@@ -84,12 +85,7 @@ public class WebSearchFunction extends AbstractLargeModelFunction {
htmlContent = htmlContent.substring(0, 10000);
}
}
String title = item.getTitle();
String snippet = item.getSnippet();
WebSearchFunctionResult webSearchResult = new WebSearchFunctionResult();
// webSearchResult.setTitle(title);
// webSearchResult.setUrl(link);
// webSearchResult.setSnippet(snippet);
webSearchResult.setContent(htmlContent);
results.add(webSearchResult);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment