fix: manage_scheduled_task + search_web 注入 + 删除 LM Studio
- manage_scheduled_task: INSERT 加 user_id='', 检查 psql 退出码 - search_web: 用 python json.dumps 构造请求体(防止注入) - 删除 lmstudio.rs / LmStudioConfig,仅保留 DeepSeek - config.json 移除 lmstudio 段
This commit is contained in:
@@ -9,9 +9,16 @@ COUNT=$(echo "$input" | python3 -c "import sys,json; print(json.load(sys.stdin).
|
||||
API_KEY="${TAVILY_API_KEY}"
|
||||
[ -z "$API_KEY" ] && echo '{"error":"请设置 TAVILY_API_KEY"}' && exit 0
|
||||
|
||||
RESP=$(curl -s -X POST "https://api.tavily.com/search" \
|
||||
-H "Content-Type: application/json" \
|
||||
-d "{\"api_key\":\"$API_KEY\",\"query\":\"$QUERY\",\"max_results\":$COUNT,\"include_answer\":true}")
|
||||
export SEARCH_QUERY="$QUERY" SEARCH_COUNT="$COUNT"
|
||||
RESP=$(python3 -c "
|
||||
import urllib.request, json, os
|
||||
key = os.environ['TAVILY_API_KEY']
|
||||
query = os.environ['SEARCH_QUERY']
|
||||
count = int(os.environ.get('SEARCH_COUNT', 5))
|
||||
body = json.dumps({'api_key': key, 'query': query, 'max_results': count, 'include_answer': True}).encode()
|
||||
req = urllib.request.Request('https://api.tavily.com/search', data=body, headers={'Content-Type': 'application/json'})
|
||||
print(urllib.request.urlopen(req).read().decode())
|
||||
" 2>/dev/null)
|
||||
|
||||
export RESP QUERY COUNT
|
||||
python3 -c "
|
||||
|
||||
Reference in New Issue
Block a user