tmp
This commit is contained in:
@@ -205,6 +205,12 @@ def _setup_static_files(app: FastAPI):
|
||||
|
||||
|
||||
def _resolve_static_path() -> Path | None:
|
||||
# 开发环境优先允许复用仓库里的现成 dist
|
||||
base_dir = _get_project_root()
|
||||
static_path = base_dir / "dashboard" / "dist"
|
||||
if static_path.exists():
|
||||
return static_path
|
||||
|
||||
try:
|
||||
module = import_module("maibot_dashboard")
|
||||
get_dist_path = getattr(module, "get_dist_path", None)
|
||||
@@ -215,11 +221,6 @@ def _resolve_static_path() -> Path | None:
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
# 开发环境允许复用仓库里的现成 dist,但不再在用户机器上触发任何前端自愈构建。
|
||||
base_dir = _get_project_root()
|
||||
static_path = base_dir / "dashboard" / "dist"
|
||||
if static_path.exists():
|
||||
return static_path
|
||||
return None
|
||||
|
||||
|
||||
|
||||
@@ -124,6 +124,11 @@ class DeletePurgeRequest(BaseModel):
|
||||
limit: int = Field(1000, ge=1, le=5000)
|
||||
|
||||
|
||||
class FeedbackRollbackRequest(BaseModel):
|
||||
requested_by: str = "webui"
|
||||
reason: str = ""
|
||||
|
||||
|
||||
def _build_import_guide_markdown(settings: dict[str, Any]) -> str:
|
||||
path_aliases_raw = settings.get("path_aliases")
|
||||
path_aliases = path_aliases_raw if isinstance(path_aliases_raw, dict) else {}
|
||||
@@ -359,6 +364,29 @@ async def _profile_delete_override(person_id: str) -> dict:
|
||||
return await memory_service.profile_admin(action="delete_override", person_id=person_id)
|
||||
|
||||
|
||||
async def _feedback_list(limit: int, status: str, rollback_status: str, query: str) -> dict:
|
||||
return await memory_service.feedback_admin(
|
||||
action="list",
|
||||
limit=limit,
|
||||
status=status,
|
||||
rollback_status=rollback_status,
|
||||
query=query,
|
||||
)
|
||||
|
||||
|
||||
async def _feedback_get(task_id: int) -> dict:
|
||||
return await memory_service.feedback_admin(action="get", task_id=task_id)
|
||||
|
||||
|
||||
async def _feedback_rollback(task_id: int, payload: FeedbackRollbackRequest) -> dict:
|
||||
return await memory_service.feedback_admin(
|
||||
action="rollback",
|
||||
task_id=task_id,
|
||||
requested_by=payload.requested_by,
|
||||
reason=payload.reason,
|
||||
)
|
||||
|
||||
|
||||
async def _runtime_save() -> dict:
|
||||
return await memory_service.runtime_admin(action="save")
|
||||
|
||||
@@ -830,6 +858,26 @@ async def delete_memory_profile_override(person_id: str):
|
||||
return await _profile_delete_override(person_id)
|
||||
|
||||
|
||||
@router.get("/feedback-corrections")
|
||||
async def list_memory_feedback_corrections(
|
||||
limit: int = Query(50, ge=1, le=200),
|
||||
status: str = Query(""),
|
||||
rollback_status: str = Query(""),
|
||||
query: str = Query(""),
|
||||
):
|
||||
return await _feedback_list(limit, status, rollback_status, query)
|
||||
|
||||
|
||||
@router.get("/feedback-corrections/{task_id}")
|
||||
async def get_memory_feedback_correction(task_id: int):
|
||||
return await _feedback_get(task_id)
|
||||
|
||||
|
||||
@router.post("/feedback-corrections/{task_id}/rollback")
|
||||
async def rollback_memory_feedback_correction(task_id: int, payload: FeedbackRollbackRequest):
|
||||
return await _feedback_rollback(task_id, payload)
|
||||
|
||||
|
||||
@router.post("/runtime/save")
|
||||
async def save_memory_runtime():
|
||||
return await _runtime_save()
|
||||
|
||||
Reference in New Issue
Block a user