-
Notifications
You must be signed in to change notification settings - Fork 177
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #212 from PolarishT/main
[reactor]: rename catalogue
- Loading branch information
Showing
230 changed files
with
264 additions
and
26,820 deletions.
There are no files selected for viewing
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
72 changes: 72 additions & 0 deletions
72
...ing-amap/src/main/java/com/alibaba/cloud/ai/functioncalling/amp/WeatherSearchService.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one or more | ||
* contributor license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright ownership. | ||
* The ASF licenses this file to You under the Apache License, Version 2.0 | ||
* (the "License"); you may not use this file except in compliance with | ||
* the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package com.alibaba.cloud.ai.functioncalling.amp; | ||
|
||
import com.fasterxml.jackson.annotation.JsonClassDescription; | ||
import com.fasterxml.jackson.annotation.JsonProperty; | ||
import com.fasterxml.jackson.annotation.JsonPropertyDescription; | ||
import com.google.gson.JsonArray; | ||
import com.google.gson.JsonObject; | ||
import com.google.gson.JsonParser; | ||
|
||
import java.util.function.Function; | ||
|
||
/** | ||
* @author YunLong | ||
*/ | ||
public class WeatherSearchService implements Function<WeatherSearchService.Request, WeatherSearchService.Response> { | ||
|
||
private final WeatherTools weatherTools; | ||
|
||
public WeatherSearchService (AmapProperties amapProperties) { | ||
this.weatherTools = new WeatherTools(amapProperties); | ||
} | ||
|
||
@Override | ||
public Response apply (Request request) { | ||
|
||
String responseBody = weatherTools.getAddressCityCode(request.address); | ||
|
||
String adcode = ""; | ||
|
||
try { | ||
JsonObject jsonObject = JsonParser.parseString(responseBody).getAsJsonObject(); | ||
JsonArray geocodesArray = jsonObject.getAsJsonArray("geocodes"); | ||
if (geocodesArray != null && !geocodesArray.isEmpty()) { | ||
JsonObject firstGeocode = geocodesArray.get(0).getAsJsonObject(); | ||
adcode = firstGeocode.get("adcode").getAsString(); | ||
} | ||
} | ||
catch (Exception e) { | ||
return new Response("Error occurred while processing the request."); | ||
} | ||
|
||
String weather = weatherTools.getWeather(adcode); | ||
|
||
return new Response(weather); | ||
} | ||
|
||
@JsonClassDescription("Get the weather conditions for a specified address.") | ||
public record Request( | ||
@JsonProperty(required = true, value = "address") @JsonPropertyDescription("The address") String address) { | ||
} | ||
|
||
public record Response(String message) { | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
...esources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
com.alibaba.cloud.ai.functioncalling.amp.AmapConfiguration |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
...esources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
com.alibaba.cloud.ai.functioncalling.baidusearch.BaiduSearchAutoConfiguration |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 2 additions & 0 deletions
2
...esources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
com.alibaba.cloud.ai.functioncalling.bingsearch.BingSearchAutoConfiguration | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,8 +14,7 @@ | |
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package com.alibaba.cloud.ai.plugin.crawler.service; | ||
package com.alibaba.cloud.ai.functioncalling.crawler; | ||
|
||
import java.io.BufferedReader; | ||
import java.io.IOException; | ||
|
@@ -27,10 +26,6 @@ | |
import java.util.Map; | ||
import java.util.Objects; | ||
|
||
import com.alibaba.cloud.ai.plugin.crawler.CrawlerJinaProperties; | ||
import com.alibaba.cloud.ai.plugin.crawler.exception.CrawlerServiceException; | ||
import com.alibaba.cloud.ai.plugin.crawler.util.UrlValidator; | ||
|
||
import org.springframework.http.HttpHeaders; | ||
import org.springframework.http.HttpMethod; | ||
import org.springframework.http.MediaType; | ||
|
@@ -39,7 +34,6 @@ | |
* @author yuluo | ||
* @author <a href="mailto:[email protected]">yuluo</a> | ||
*/ | ||
|
||
public abstract class AbstractCrawlerService implements CrawlerService { | ||
|
||
/** | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.