Commit Graph

11 Commits

Author SHA1 Message Date
liyizhouAI 1fef01d979 feat: v0.3 - Manus replay + token tracking + SIGTERM fix + accelerate button
This is the v0.3 milestone commit before the v0.4 big version push.
Major themes: process replay, runtime stability, cost observability.

## New Features

- **Manus-style process replay** (frontend + backend)
  - `GET /api/simulation/<id>/replay` returns full workflow + agents + rounds + aggregate
  - `frontend/src/views/SimulationReplayView.vue` 3-column layout (workflow / actions / stats)
  - bottom scrubber with play/pause/step + 5 speed levels (0.5x-10x)
  - filters out stale actions from previous runs via latest simulation_start timestamp

- **Token usage tracking** (`backend/app/utils/token_tracker.py`)
  - process-wide stage→model→tokens counter
  - LLMClient auto-records prompt/completion tokens after each call
  - stages tagged at API entry: step1_ontology, step2_graph_build, step3_prepare, step5_report
  - `GET /api/usage/summary` for live stats + CNY cost estimate
  - `GET /api/usage/estimate-simulation` for OASIS subprocess estimation
  - pricing table for GLM/SiliconFlow/MiniMax/OpenAI/Anthropic models
  - documented as internal-use, removed from customer-facing builds

- **Step 2 "Skip & Continue" button**
  - lets user stop profile generation early and proceed with what's already generated
  - `simulation_manager.request_accelerate()` + cancel_check in oasis_profile_generator
  - new endpoint `POST /api/simulation/prepare/accelerate`

## Critical Bug Fix

- **SIGTERM no longer kills running simulation subprocess**
  - root cause: `SimulationRunner.register_cleanup()` registered SIGTERM/SIGINT/SIGHUP handlers
    that called `os.killpg` on every tracked sim child, even though spawn already used
    `start_new_session=True` to give children isolated sessions
  - fix: neutered `register_cleanup` to a no-op; `cleanup_all_simulations` itself preserved
    for explicit stop_simulation paths
  - validated: killed Flask backend twice, simulation subprocess kept running
  - impact: hot-reload backend code without interrupting in-flight simulations

## Performance & Tuning

- semaphore 30 → 100 (twitter + reddit) for higher LLM concurrency
- discovered 200 agents as memory/cost/statistical sweet spot for 8G server
  (503 agents OOMs both platforms; 200 agents fits cleanly with 95% confidence margin)

## Documentation

- **PRD.md** rewritten as v0.3 baseline (10 chapters + 2 appendices, 639 lines)
  - product positioning across 3 usage modes (one-shot / model-reuse / SaaS)
  - v0.4 roadmap: domestic platforms (douyin/wechat/xiaohongshu/weibo), fork sim, multi-tenant
  - operational lessons: HF mirror, Tencent PyPI mirror, GLM-4-Flash choice, agent count
  - decision log with dates
  - per-stage token/cost breakdown for typical 200-agent run
- **README.md / README-ZH.md** updated with replay step + Graphiti+Neo4j

## Files Touched

19 files changed, 1105 insertions(+), 246 deletions(-)
2026-04-15 09:37:22 +08:00
ghostubborn 2ffadd3038 feat(i18n): add Accept-Language header to all API requests 2026-04-01 15:22:07 +08:00
666ghj e6da45ee63 feat(history): 添加首页历史项目展示组件
- 新增 HistoryDatabase.vue 组件,实现扇形堆叠到网格展开的动画效果
- 后端 simulation.py 添加历史模拟数据 API 支持
- 修复 SimulationManager 过滤隐藏文件问题
- 前端 simulation.js 添加获取历史模拟数据的 API 方法
- Home.vue 集成历史项目展示组件
- 实现正方形网格背景装饰效果
2025-12-31 17:54:39 +08:00
666ghj 70922a3525 Implement interaction features in Step5Interaction component and add routing for interaction view
- Introduced the Step5Interaction component for user interaction with report agents and simulation profiles.
- Added chat functionality to communicate with report agents and selected simulation agents.
- Implemented a survey feature to gather responses from multiple agents.
- Enhanced routing by adding a new InteractionView for seamless navigation to the interaction interface.
- Updated the router configuration to include the new interaction route.
- Improved UI elements and styles for better user experience in the interaction process.
2025-12-16 17:50:43 +08:00
666ghj f904407741 Implement report generation features and UI enhancements
- Added a new API for generating reports, including functions to retrieve report status, agent logs, console logs, and report details.
- Enhanced the Step3Simulation component to manage report generation with loading indicators and improved user feedback during the process.
- Introduced a new Step4Report component to display report details and logs, providing a comprehensive view of the report generation workflow.
- Updated routing to include a dedicated report view, improving navigation and user experience in the application.
2025-12-13 21:49:34 +08:00
666ghj ec418c1def Implement simulation environment management features in frontend
- Added new API functions for closing the simulation environment and retrieving its status.
- Enhanced the SimulationRunView and SimulationView components to gracefully handle simulation termination when navigating between steps.
- Introduced logging for better user feedback during the simulation closure process, including attempts to force stop if graceful closure fails.
2025-12-12 16:25:28 +08:00
666ghj f8a58819fa Enhance simulation functionality and frontend components for improved user experience
- Updated the simulation API to include a new 'force' parameter, allowing users to restart simulations while cleaning up previous logs.
- Enhanced the simulation status detail retrieval to include all actions and platform-specific actions for better monitoring.
- Introduced a new SimulationRunView component to manage the simulation process, providing a clear interface for users to start and monitor simulations.
- Improved the Step3Simulation component with detailed logging and progress indicators, ensuring users receive real-time updates during the simulation.
- Added new API endpoints for retrieving simulation posts and actions, enhancing the overall functionality and user engagement.
2025-12-12 14:44:10 +08:00
666ghj 8b5d082fb1 Add real-time simulation configuration endpoint and update frontend components
- Introduced a new API endpoint for retrieving real-time simulation configuration, allowing users to view progress and metadata during simulation generation.
- Updated frontend API service to include the new real-time configuration method.
- Enhanced Step2EnvSetup.vue to support real-time polling for configuration updates, improving user experience during simulation setup.
- Revised display logic to show detailed configuration summaries and orchestration content, enriching the simulation setup process.
2025-12-11 18:44:00 +08:00
666ghj 01d94f3d21 Update simulation components and descriptions for clarity and functionality
- Added a new method in simulation.js for retrieving detailed run status.
- Revised descriptions in Step1GraphBuild.vue and Step2EnvSetup.vue for improved clarity on simulation processes.
- Updated titles and labels in Step2EnvSetup.vue to better reflect the initialization and setup stages.
- Enhanced styling and layout in Step2EnvSetup.vue for a more cohesive user experience.
- Adjusted descriptions in Home.vue to accurately represent the simulation workflow.
2025-12-11 17:02:17 +08:00
666ghj fc95cc6595 Add simulation API and environment setup components
- Introduced simulation.js API for creating and managing simulations, including methods for creating, preparing, and retrieving simulation statuses.
- Added Step1GraphBuild.vue and Step2EnvSetup.vue components to facilitate the graph building and environment setup processes, enhancing user interaction and workflow.
- Updated MainView.vue to integrate new components and manage the simulation workflow, including step indicators and navigation between steps.
- Created SimulationView.vue for displaying simulation details and managing the simulation environment, improving overall user experience and functionality.
2025-12-11 15:09:24 +08:00
666ghj b67e14cced Add project status report and frontend documentation
- Introduced `PROJECT_STATUS.md` to provide a comprehensive overview of the MiroFish project, detailing the current status, completed features, and future development plans.
- Added multiple documentation files in the frontend directory, including detailed descriptions of the homepage functionality, startup guide, and project completion summary.
- Implemented a structured approach to document the project's architecture, API integration, and user interaction processes, enhancing clarity for developers and users alike.
- Included a `.gitignore` file to manage ignored files and directories in the frontend project, improving project organization and cleanliness.
2025-12-10 14:49:11 +08:00