81c736f873
- query_weather: {location, now: {temp,text}, forecast: [{date,day,night,tempMin,tempMax}]}
- search_web: {query, answer, results: [{title,url,content}]}
- get_current_datetime: {datetime}
- list_scheduled_tasks: {tasks: [{name,description,enabled,command,...}]}
- manage_scheduled_task: {ok, action, name} / {error}
LLM 直接看到结构化数据,不再依赖脚本拼接的中文自然语言
17 lines
460 B
Bash
Executable File
17 lines
460 B
Bash
Executable File
#!/bin/bash
|
|
# 读取 stdin JSON 参数
|
|
read -r input
|
|
format=$(echo "$input" | python3 -c "
|
|
import sys, json
|
|
try:
|
|
d = json.load(sys.stdin)
|
|
print(d.get('format', 'full'))
|
|
except: print('full')
|
|
" 2>/dev/null || echo "full")
|
|
|
|
case "$format" in
|
|
date) TZ='Asia/Shanghai' date '+{"datetime": "%Y-%m-%d"}' ;;
|
|
time) TZ='Asia/Shanghai' date '+{"datetime": "%H:%M:%S"}' ;;
|
|
*) TZ='Asia/Shanghai' date '+{"datetime": "%Y-%m-%d %H:%M:%S"}' ;;
|
|
esac
|