feat: virtual company module, team projects, PWA dishes app, and startup scripts overhaul
- Add company module (3-tier org, CEO planning, parallel departments) - Add company orchestrator, knowledge extractor, presets, scheduler - Add company API endpoints, models, and frontend views - Add 今天吃啥 PWA app (69 dishes, real images, offline support) - Add team_projects output directory structure - Add unified manage.ps1 for service lifecycle - Add Windows startup guide v1.0 - Add TTS troubleshooting doc - Update frontend (AgentChat UX overhaul, new views) - Update backend (voice engine fix, multi-tenant, RBAC) - Remove deprecated startup scripts and old docs Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -12,6 +12,7 @@ from app.models.execution import Execution
|
||||
from app.models.workflow import Workflow
|
||||
from app.models.agent import Agent
|
||||
from app.api.auth import get_current_user
|
||||
from app.api.deps import get_current_workspace_id
|
||||
from app.models.user import User
|
||||
from app.tasks.workflow_tasks import execute_workflow_task, resume_workflow_task
|
||||
from app.services.agent_workspace_chat_log import ensure_agent_dialogue_logged_from_db_execution
|
||||
@@ -124,7 +125,7 @@ class ResumeExecutionBody(BaseModel):
|
||||
def _can_view_execution(
|
||||
db: Session, current_user: User, execution: Execution
|
||||
) -> bool:
|
||||
if getattr(current_user, "role", None) == "admin":
|
||||
if current_user.has_permission("execution:view_all"):
|
||||
return True
|
||||
if execution.workflow_id:
|
||||
wf = db.query(Workflow).filter(Workflow.id == execution.workflow_id).first()
|
||||
@@ -241,11 +242,12 @@ async def get_executions(
|
||||
status: Optional[str] = None,
|
||||
search: Optional[str] = None,
|
||||
db: Session = Depends(get_db),
|
||||
current_user: User = Depends(get_current_user)
|
||||
current_user: User = Depends(get_current_user),
|
||||
workspace_id: str = Depends(get_current_workspace_id),
|
||||
):
|
||||
"""
|
||||
获取执行记录列表(支持分页、筛选、搜索)
|
||||
|
||||
|
||||
Args:
|
||||
skip: 跳过记录数(分页)
|
||||
limit: 每页记录数(分页,最大100)
|
||||
@@ -257,7 +259,7 @@ async def get_executions(
|
||||
limit = min(limit, 100)
|
||||
|
||||
# 管理员可看全部;普通用户:自己拥有的工作流或 Agent 上的执行记录(含纯 Agent 执行)
|
||||
if getattr(current_user, "role", None) == "admin":
|
||||
if current_user.has_permission("execution:view_all"):
|
||||
query = db.query(Execution)
|
||||
else:
|
||||
query = (
|
||||
@@ -265,6 +267,7 @@ async def get_executions(
|
||||
.outerjoin(Workflow, Execution.workflow_id == Workflow.id)
|
||||
.outerjoin(Agent, Execution.agent_id == Agent.id)
|
||||
.filter(
|
||||
Execution.workspace_id == workspace_id,
|
||||
or_(
|
||||
Workflow.user_id == current_user.id,
|
||||
Agent.user_id == current_user.id,
|
||||
|
||||
Reference in New Issue
Block a user