Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -26,26 +26,26 @@ def my_custom_tool(arg1:str, arg2:int)-> str: #it's import to specify the return
|
|
26 |
|
27 |
@tool
|
28 |
def query_weather(location: str, days: int = 1) -> str:
|
29 |
-
"""
|
30 |
|
31 |
Args:
|
32 |
-
location
|
33 |
-
days
|
34 |
|
35 |
Returns:
|
36 |
-
|
37 |
"""
|
38 |
|
39 |
if days < 1 or days > 3:
|
40 |
return "查询天数必须在1-3之间"
|
41 |
|
42 |
-
# 使用wttr
|
43 |
base_url = "https://wttr.in/"
|
44 |
|
45 |
# 构建API请求URL
|
46 |
params = {
|
47 |
-
"format": "j1",
|
48 |
-
"lang": "zh-cn"
|
49 |
}
|
50 |
|
51 |
try:
|
|
|
26 |
|
27 |
@tool
|
28 |
def query_weather(location: str, days: int = 1) -> str:
|
29 |
+
"""查询指定地点的天气预报。
|
30 |
|
31 |
Args:
|
32 |
+
location: 要查询天气的地点名称,如"北京"、"上海"等。
|
33 |
+
days: 要查询的天数,默认为1天。
|
34 |
|
35 |
Returns:
|
36 |
+
包含天气预报信息的字符串。
|
37 |
"""
|
38 |
|
39 |
if days < 1 or days > 3:
|
40 |
return "查询天数必须在1-3之间"
|
41 |
|
42 |
+
# 使用wttr
|
43 |
base_url = "https://wttr.in/"
|
44 |
|
45 |
# 构建API请求URL
|
46 |
params = {
|
47 |
+
"format": "j1",
|
48 |
+
"lang": "zh-cn"
|
49 |
}
|
50 |
|
51 |
try:
|