fix: 修改评论描述
This commit is contained in:
parent
59f8a9da73
commit
d90c716775
@ -258,6 +258,7 @@ async def initialize_admin(admin_data: InitializeAdmin, db: AsyncSession = Depen
|
||||
|
||||
@auth.get("/me", response_model=UserResponse)
|
||||
async def read_users_me(current_user: User = Depends(get_current_user)):
|
||||
"""获取当前登录用户的个人信息"""
|
||||
return current_user.to_dict()
|
||||
|
||||
|
||||
@ -336,6 +337,8 @@ async def create_user(
|
||||
current_user: User = Depends(get_admin_user),
|
||||
db: AsyncSession = Depends(get_db),
|
||||
):
|
||||
"""创建新用户(管理员权限)"""
|
||||
|
||||
# 验证用户名
|
||||
is_valid, error_msg = validate_username(user_data.username)
|
||||
if not is_valid:
|
||||
@ -483,6 +486,14 @@ async def update_user(
|
||||
user.role = user_data.role
|
||||
update_details.append(f"角色: {user_data.role}")
|
||||
|
||||
if user_data.phone_number is not None:
|
||||
user.phone_number = user_data.phone_number
|
||||
update_details.append(f"手机号: {user_data.phone_number or '已清空'}")
|
||||
|
||||
if user_data.avatar is not None:
|
||||
user.avatar = user_data.avatar
|
||||
update_details.append(f"头像: {user_data.avatar or '已清空'}")
|
||||
|
||||
await db.commit()
|
||||
|
||||
# 记录操作
|
||||
|
||||
@ -956,6 +956,7 @@ async def get_agent_state(
|
||||
current_user: User = Depends(get_required_user),
|
||||
db: AsyncSession = Depends(get_db),
|
||||
):
|
||||
"""获取智能体当前状态(需要登录)"""
|
||||
try:
|
||||
if not agent_manager.get_agent(agent_id):
|
||||
raise HTTPException(status_code=404, detail=f"智能体 {agent_id} 不存在")
|
||||
@ -1250,7 +1251,7 @@ async def submit_message_feedback(
|
||||
db: AsyncSession = Depends(get_db),
|
||||
current_user: User = Depends(get_required_user),
|
||||
):
|
||||
"""Submit user feedback for a specific message"""
|
||||
"""提交消息反馈(需要登录)"""
|
||||
try:
|
||||
# Validate rating
|
||||
if feedback_data.rating not in ["like", "dislike"]:
|
||||
@ -1314,7 +1315,7 @@ async def get_message_feedback(
|
||||
db: AsyncSession = Depends(get_db),
|
||||
current_user: User = Depends(get_required_user),
|
||||
):
|
||||
"""Get feedback status for a specific message (for current user)"""
|
||||
"""获取指定消息的用户反馈(需要登录)"""
|
||||
try:
|
||||
# Get user's feedback for this message
|
||||
feedback_result = await db.execute(
|
||||
|
||||
@ -1,7 +1,9 @@
|
||||
"""
|
||||
Dashboard Router - Statistics and monitoring endpoints
|
||||
仪表板 - 统计和监控端点
|
||||
|
||||
Provides centralized dashboard APIs for monitoring system-wide statistics.
|
||||
提供系统级统计和监控的API接口,用于监控系统运行状态、用户活动、工具调用、知识库使用等。
|
||||
"""
|
||||
|
||||
import traceback
|
||||
@ -99,7 +101,7 @@ class ConversationDetailResponse(BaseModel):
|
||||
|
||||
|
||||
# =============================================================================
|
||||
# Conversation Management
|
||||
# Conversation Management - 对话管理
|
||||
# =============================================================================
|
||||
|
||||
|
||||
@ -113,7 +115,7 @@ async def get_all_conversations(
|
||||
db: AsyncSession = Depends(get_db),
|
||||
current_user: User = Depends(get_admin_user),
|
||||
):
|
||||
"""Get all conversations (Admin only)"""
|
||||
"""获取所有对话(管理员权限)"""
|
||||
from src.storage.db.models import Conversation, ConversationStats
|
||||
|
||||
try:
|
||||
@ -161,7 +163,7 @@ async def get_conversation_detail(
|
||||
db: AsyncSession = Depends(get_db),
|
||||
current_user: User = Depends(get_admin_user),
|
||||
):
|
||||
"""Get conversation detail (Admin only)"""
|
||||
"""获取指定对话详情(管理员权限)"""
|
||||
try:
|
||||
conv_manager = ConversationManager(db)
|
||||
conversation = await conv_manager.get_conversation_by_thread_id(thread_id)
|
||||
@ -220,7 +222,7 @@ async def get_conversation_detail(
|
||||
|
||||
|
||||
# =============================================================================
|
||||
# User Activity Statistics
|
||||
# 用户活动统计(管理员权限)
|
||||
# =============================================================================
|
||||
|
||||
|
||||
@ -229,7 +231,7 @@ async def get_user_activity_stats(
|
||||
db: AsyncSession = Depends(get_db),
|
||||
current_user: User = Depends(get_admin_user),
|
||||
):
|
||||
"""Get user activity statistics (Admin only)"""
|
||||
"""获取用户活动统计(管理员权限)"""
|
||||
try:
|
||||
from src.storage.db.models import User, Conversation
|
||||
|
||||
@ -292,7 +294,7 @@ async def get_user_activity_stats(
|
||||
|
||||
|
||||
# =============================================================================
|
||||
# Tool Call Statistics
|
||||
# Tool Call Statistics - 工具调用统计
|
||||
# =============================================================================
|
||||
|
||||
|
||||
@ -301,7 +303,7 @@ async def get_tool_call_stats(
|
||||
db: AsyncSession = Depends(get_db),
|
||||
current_user: User = Depends(get_admin_user),
|
||||
):
|
||||
"""Get tool call statistics (Admin only)"""
|
||||
"""获取工具调用统计(管理员权限)"""
|
||||
try:
|
||||
from src.storage.db.models import ToolCall
|
||||
|
||||
@ -365,7 +367,7 @@ async def get_tool_call_stats(
|
||||
|
||||
|
||||
# =============================================================================
|
||||
# Knowledge Base Statistics
|
||||
# 知识库统计(管理员权限)
|
||||
# =============================================================================
|
||||
|
||||
|
||||
@ -374,7 +376,7 @@ async def get_knowledge_stats(
|
||||
db: AsyncSession = Depends(get_db),
|
||||
current_user: User = Depends(get_admin_user),
|
||||
):
|
||||
"""Get knowledge base statistics (Admin only)"""
|
||||
"""获取知识库统计(管理员权限)"""
|
||||
try:
|
||||
from src.knowledge.manager import KnowledgeBaseManager
|
||||
import json
|
||||
@ -495,7 +497,7 @@ async def get_knowledge_stats(
|
||||
|
||||
|
||||
# =============================================================================
|
||||
# Agent Analytics
|
||||
# 智能体分析(管理员权限)
|
||||
# =============================================================================
|
||||
|
||||
|
||||
@ -504,7 +506,7 @@ async def get_agent_analytics(
|
||||
db: AsyncSession = Depends(get_db),
|
||||
current_user: User = Depends(get_admin_user),
|
||||
):
|
||||
"""Get AI agent analytics (Admin only)"""
|
||||
"""获取智能体分析(管理员权限)"""
|
||||
try:
|
||||
from src.storage.db.models import Conversation, MessageFeedback, Message, ToolCall
|
||||
|
||||
@ -592,7 +594,7 @@ async def get_agent_analytics(
|
||||
|
||||
|
||||
# =============================================================================
|
||||
# Basic Statistics (保留原有接口)
|
||||
# 基础统计(管理员权限)
|
||||
# =============================================================================
|
||||
|
||||
|
||||
@ -601,7 +603,7 @@ async def get_dashboard_stats(
|
||||
db: AsyncSession = Depends(get_db),
|
||||
current_user: User = Depends(get_admin_user),
|
||||
):
|
||||
"""Get dashboard statistics (Admin only)"""
|
||||
"""获取基础统计(管理员权限)"""
|
||||
from src.storage.db.models import Conversation, Message, MessageFeedback
|
||||
|
||||
try:
|
||||
@ -649,12 +651,12 @@ async def get_dashboard_stats(
|
||||
|
||||
|
||||
# =============================================================================
|
||||
# Feedback Management
|
||||
# 反馈管理(管理员权限)
|
||||
# =============================================================================
|
||||
|
||||
|
||||
class FeedbackListItem(BaseModel):
|
||||
"""Feedback list item"""
|
||||
"""反馈列表项"""
|
||||
|
||||
id: int
|
||||
user_id: str
|
||||
@ -675,7 +677,7 @@ async def get_all_feedbacks(
|
||||
db: AsyncSession = Depends(get_db),
|
||||
current_user: User = Depends(get_admin_user),
|
||||
):
|
||||
"""Get all feedback records (Admin only)"""
|
||||
"""获取所有反馈记录(管理员权限)"""
|
||||
from src.storage.db.models import MessageFeedback, Message, Conversation, User
|
||||
|
||||
try:
|
||||
@ -730,7 +732,7 @@ async def get_all_feedbacks(
|
||||
|
||||
|
||||
# =============================================================================
|
||||
# Time Series Statistics for Call Analytics
|
||||
# 调用分析时间序列统计(管理员权限)
|
||||
# =============================================================================
|
||||
|
||||
|
||||
@ -752,7 +754,7 @@ async def get_call_timeseries_stats(
|
||||
db: AsyncSession = Depends(get_db),
|
||||
current_user: User = Depends(get_admin_user),
|
||||
):
|
||||
"""Get time series statistics for call analytics (Admin only)"""
|
||||
"""获取调用分析时间序列统计(管理员权限)"""
|
||||
try:
|
||||
from src.storage.db.models import Conversation, Message, ToolCall
|
||||
|
||||
|
||||
@ -10,7 +10,9 @@ evaluation = APIRouter(prefix="/evaluation", tags=["evaluation"])
|
||||
|
||||
|
||||
# 移除旧详情接口,统一使用带 db_id 的接口
|
||||
|
||||
# ============================================================================
|
||||
# 评估基准
|
||||
# ============================================================================
|
||||
|
||||
@evaluation.get("/databases/{db_id}/benchmarks/{benchmark_id}")
|
||||
async def get_evaluation_benchmark_by_db(
|
||||
@ -94,7 +96,7 @@ async def delete_evaluation_result_by_db(db_id: str, task_id: str, current_user:
|
||||
|
||||
|
||||
# ============================================================================
|
||||
# === Knowledge-specific evaluation endpoints ===
|
||||
# RAG评估
|
||||
# ============================================================================
|
||||
|
||||
|
||||
|
||||
@ -57,7 +57,7 @@ media_types = {
|
||||
}
|
||||
|
||||
# =============================================================================
|
||||
# === 数据库管理分组 ===
|
||||
# === 知识库管理分组 ===
|
||||
# =============================================================================
|
||||
|
||||
|
||||
@ -215,7 +215,7 @@ async def export_database(
|
||||
|
||||
|
||||
# =============================================================================
|
||||
# === 文档管理分组 ===
|
||||
# === 知识库文档管理分组 ===
|
||||
# =============================================================================
|
||||
|
||||
|
||||
@ -728,7 +728,7 @@ async def download_document(db_id: str, doc_id: str, request: Request, current_u
|
||||
|
||||
|
||||
# =============================================================================
|
||||
# === 查询分组 ===
|
||||
# === 知识库查询分组 ===
|
||||
# =============================================================================
|
||||
|
||||
|
||||
@ -1202,7 +1202,7 @@ async def get_all_embedding_models_status(current_user: User = Depends(get_admin
|
||||
|
||||
|
||||
# =============================================================================
|
||||
# === AI 辅助功能分组 ===
|
||||
# === 知识库 AI 辅助功能分组 ===
|
||||
# =============================================================================
|
||||
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user