Skip to content

feat(frontend): add streaming progress bar for schedule creation#276

Merged
hrygo merged 23 commits into
mainfrom
feat/schedule-streaming-progress
Feb 21, 2026
Merged

feat(frontend): add streaming progress bar for schedule creation#276
hrygo merged 23 commits into
mainfrom
feat/schedule-streaming-progress

Conversation

@hrygo

@hrygo hrygo commented Feb 21, 2026

Copy link
Copy Markdown
Owner

Summary

为日程创建流程添加 4 阶段流式进度条,实时展示 AI 处理进度(理解意图 → 解析时间 → 检查冲突 → 创建日程)

Resolves #269

Changes

前端 (StreamingFeedback)

  • 新增 PhaseProgress.tsx:4 阶段进度条组件(带标签、动画、状态图标)
  • 新增 phaseConfig.ts:阶段配置和辅助函数
  • 增强 StreamingFeedback.tsx:集成进度条和状态文字显示
  • 新增 i18n 翻译键:schedule.phase.*schedule.ai.*
  • 修复 phase 检测逻辑(支持 JSON 格式事件数据)

后端修复

  • 修复 isTempConversation 处理:前端传递 isTempConversation=true,后端正确跳过会话创建
  • 修复 handleConversationStart:检查 IsTempConversation 跳过临时会话
  • 修复 find_free_time:严格过滤过去时间段(时光不回溯)

Agent Prompt 优化

  • 添加冲突解决示例:查询 → 找空闲时间 → 直接创建日程
  • 强化指令:冲突时自动找空闲时间并创建日程,不要询问用户

Test plan

  • 构建通过
  • 进度条正确显示 4 个阶段
  • 状态文字与当前操作匹配
  • 错误状态正确高亮
  • 中英文翻译完整
  • 移动端显示正常

- Add github.com/hrygo/hotplex dependency
- Replace ai/agents/runner with hotplex.Engine wrapper
- Define CCRunner as wrapper around hotplex.Engine
- Preserve DivineSense-specific types (Config, SessionStatsData, etc.)
- Maintain backward compatibility with existing APIs
- Remove ~1500 lines of internal runner code
- Delete obsolete test scripts

Closes #274
…unnerConfig

- Add StopSessionByConversationID method for convenience
- Remove unused AllowedPaths and ForbiddenPaths from CCRunnerConfig
- Add documentation comments for CCRunnerConfig
- Add PhaseProgress.tsx component with 4-stage progress indicator
- Add phaseConfig.ts with phase definitions and helper functions
- Enhance StreamingFeedback.tsx to show real-time progress
- Add i18n translations for phase labels (en/zh-Hans)

Implements: #269
@hrygo

hrygo commented Feb 21, 2026

Copy link
Copy Markdown
Owner Author

Code review

Found 1 issue:

  1. Missing i18n translation key "schedule.ai.parsing" - the code returns this key for task_start events but it doesn't exist in locale files (.claude/rules/i18n.md says "同步翻译:key 必须同时存在于 en.json 和 zh-Hans.json")

return event.data ? "" : "schedule.ai.understanding";
case "task_start":
return "schedule.ai.parsing";
case "tool_use": {

The PR adds these keys: understanding, generating, processing-result, phase.* - but parsing is missing. This will cause the UI to display the raw key "schedule.ai.parsing" instead of translated text when a task_start event is received.

Fix: Add to both locale files:

  • en.json: "parsing": "Parsing schedule..."
  • zh-Hans.json: "parsing": "正在解析日程..."

🤖 Generated with Claude Code

- If this code review was useful, please react with 👍. Otherwise, react with 👎.

Backend sends plain text for thinking/answer events, not JSON.
parseEvent now handles both formats gracefully.

Refs #269
SCHEDULE agent is used for quick schedule creation via ScheduleQuickInput,
which doesn't need conversation title generation.

Refs #269
- Revert incorrect backend agentType check
- Pass isTempConversation=true to skip conversation/block creation
- This properly fixes the issue at the root cause

Refs #269
Check IsTempConversation flag in handleConversationStart to avoid
creating unnecessary conversations for temporary chat sessions.

Refs #269
- Check tool_name in tool_use events to correctly identify phases
- schedule_add → create phase
- schedule_query/find_free_time → check phase

Refs #269
When user-specified time is occupied, LLM should call find_free_time
to find available slots instead of asking user via text.

Refs #269
FindAllFreeSlots now skips time slots that are in the past
when the date is today. This prevents returning unavailable slots.

Refs #269
Add additional filtering to remove any slots that start before now,
ensuring strict no time travel policy.

Refs #269
Add concrete example showing: query conflict -> find_free_time -> schedule_add
to ensure LLM understands the auto-creation workflow.

Refs #269
- Add phase labels under each node for clarity
- Enlarge nodes (w-10 h-10) for better visibility
- Add status description with event details
- Add completed i18n key
- Improve visual feedback with icons and colors

Refs #269
Previously iterated backwards which returned phase 0 if last event was answer.
Now iterates forward to find the last valid phase.

Refs #269
Event data is JSON format, not plain text. Parse JSON to get tool_name.

Refs #269
- Remove duplicate PhaseProgress component definition
- Extract magic numbers to constants (MAX_PHASE, PREVIEW_MAX_LENGTH)
- Add extractToolName helper for parsing tool names
- Simplify string truncation logic

Refs #269
@hrygo

hrygo commented Feb 21, 2026

Copy link
Copy Markdown
Owner Author

Code review

No issues found. Checked for bugs and CLAUDE.md compliance.

🤖 Generated with Claude Code

- If this code review was useful, please react with 👍. Otherwise, react with 👎.

@hrygo hrygo merged commit 6491c7e into main Feb 21, 2026
9 checks passed
@hrygo hrygo deleted the feat/schedule-streaming-progress branch February 21, 2026 14:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[feat] 日程创建流式进度条 - 实时展示 AI 处理阶段

2 participants