|
|
@@ -8,6 +8,7 @@ import json
|
|
|
from typing import Optional
|
|
|
|
|
|
import httpx
|
|
|
+import requests
|
|
|
|
|
|
from agent.tools import tool, ToolResult
|
|
|
|
|
|
@@ -46,14 +47,23 @@ async def get_account_fans_portrait(
|
|
|
|
|
|
request_timeout = timeout if timeout is not None else DEFAULT_TIMEOUT
|
|
|
|
|
|
- async with httpx.AsyncClient(timeout=request_timeout) as client:
|
|
|
- response = await client.post(
|
|
|
- ACCOUNT_FANS_PORTRAIT_API,
|
|
|
- json=payload,
|
|
|
- headers={"Content-Type": "application/json"},
|
|
|
- )
|
|
|
- response.raise_for_status()
|
|
|
- data = response.json()
|
|
|
+ # async with httpx.AsyncClient(timeout=request_timeout) as client:
|
|
|
+ # response = await client.post(
|
|
|
+ # ACCOUNT_FANS_PORTRAIT_API,
|
|
|
+ # json=payload,
|
|
|
+ # headers={"Content-Type": "application/json"},
|
|
|
+ # )
|
|
|
+ # response.raise_for_status()
|
|
|
+ # data = response.json()
|
|
|
+
|
|
|
+ response = requests.post(
|
|
|
+ ACCOUNT_FANS_PORTRAIT_API,
|
|
|
+ json=payload,
|
|
|
+ headers={"Content-Type": "application/json"},
|
|
|
+ timeout=request_timeout
|
|
|
+ )
|
|
|
+ response.raise_for_status()
|
|
|
+ data = response.json()
|
|
|
|
|
|
# 格式化输出摘要
|
|
|
summary_lines = [f"账号 {account_id} 的粉丝画像"]
|
|
|
@@ -152,14 +162,23 @@ async def get_content_fans_portrait(
|
|
|
|
|
|
request_timeout = timeout if timeout is not None else DEFAULT_TIMEOUT
|
|
|
|
|
|
- async with httpx.AsyncClient(timeout=request_timeout) as client:
|
|
|
- response = await client.post(
|
|
|
- CONTENT_FANS_PORTRAIT_API,
|
|
|
- json=payload,
|
|
|
- headers={"Content-Type": "application/json"},
|
|
|
- )
|
|
|
- response.raise_for_status()
|
|
|
- data = response.json()
|
|
|
+ # async with httpx.AsyncClient(timeout=request_timeout) as client:
|
|
|
+ # response = await client.post(
|
|
|
+ # CONTENT_FANS_PORTRAIT_API,
|
|
|
+ # json=payload,
|
|
|
+ # headers={"Content-Type": "application/json"},
|
|
|
+ # )
|
|
|
+ # response.raise_for_status()
|
|
|
+ # data = response.json()
|
|
|
+
|
|
|
+ response = requests.post(
|
|
|
+ CONTENT_FANS_PORTRAIT_API,
|
|
|
+ json=payload,
|
|
|
+ headers={"Content-Type": "application/json"},
|
|
|
+ timeout=request_timeout
|
|
|
+ )
|
|
|
+ response.raise_for_status()
|
|
|
+ data = response.json()
|
|
|
|
|
|
# 格式化输出摘要
|
|
|
summary_lines = [f"内容 {content_id} 的点赞用户画像"]
|