Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 0 additions & 48 deletions main_routers/system_router.py
Original file line number Diff line number Diff line change
Expand Up @@ -7481,54 +7481,6 @@ async def translate_text_api(request: Request):
"target_lang": "zh"
}

# ========== 个性化内容接口 ==========

@router.post('/personal_dynamics')
async def get_personal_dynamics(request: Request):
"""
获取个性化内容数据
"""
validation_error = _validate_local_mutation_request(request)
if validation_error is not None:
return validation_error

from utils.web_scraper import fetch_personal_dynamics, format_personal_dynamics
try:

data = await request.json()
limit = data.get('limit', 10)

# 获取个性化内容
personal_content = await fetch_personal_dynamics(limit=limit)

if not personal_content['success']:
return JSONResponse({
"success": False,
"error": "无法获取个性化内容",
"detail": personal_content.get('error', '未知错误')
}, status_code=500)

# 格式化内容用于前端显示
formatted_content = format_personal_dynamics(personal_content)

return JSONResponse({
"success": True,
"data": {
"raw": personal_content,
"formatted": formatted_content,
"platforms": [k for k in personal_content.keys() if k not in ('success', 'error', 'region')]
}
})

except Exception as e:
logger.error(f"获取个性化内容失败: {e}")
return JSONResponse({
"success": False,
"error": "服务器内部错误",
"detail": str(e)
}, status_code=500)


# Self-register the mini-game-invite keyword matcher with main_logic's
# event bus. Same rationale as plugin/core/state.py: ``main_logic.core``
# previously imported this function directly (a layering inversion);
Expand Down
1 change: 0 additions & 1 deletion tests/unit/test_uncovered_endpoints_csrf.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ def unauthenticated_client():
("/api/proactive_chat", {"json": {"lanlan_name": "Yui"}}),
("/api/proactive/music_played_through", {"json": {"lanlan_name": "Yui"}}),
("/api/translate", {"json": {"text": "hello", "target_lang": "zh"}}),
("/api/personal_dynamics", {"json": {"limit": 5}}),
]


Expand Down
Loading