Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Oct 15, 2025

PR-89 PR-89 PR-89 Powered by Pull Request Badge

实现原型生成器工具栏组件

Implementation of a "Prototype Generator Toolbar" component that displays after each AI evaluation message.

Changes Made:

  1. Converted to class component - Rewrote using ObservedComponent and MobX instead of React hooks
  2. Removed custom method - Using base class's updateOne() instead of custom createVersion()
  3. Removed unified exports - Components imported directly from specific directories
  4. Removed long documentation - Deleted .md file, code is self-documenting
  5. Split render methods - Separated renderContent into renderPending(), renderGenerating(), renderCompleted(), and renderFailed() for better code organization
  6. Improved polling mechanism - Replaced setInterval with for...of loop + await sleep() pattern for cleaner async flow control

Technical Details:

Component Structure:

  • Uses ObservedComponent from mobx-react-helper
  • Uses @observable decorator for reactive state
  • Implements lifecycle methods (componentDidMount, componentDidUpdate, componentWillUnmount)
  • Separate render methods for each state (Pending, Generating, Completed, Failed)

Polling Mechanism:

  • Uses for...of loop with await sleep(3) for cleaner async control
  • Observable isPolling flag for proper state management
  • Automatic cleanup on component unmount
  • Maximum 100 iterations (~5 minutes) before stopping

API Integration:

  • Uses base updateOne() for creating prototype versions: updateOne({ messageId })
  • Custom method getVersionByMessageId() for fetching by message

4 States:

  1. Pending - Generate button
  2. Generating - Loading spinner with auto-polling
  3. Completed - Preview and AI log links
  4. Failed - Error message with AI log link
Original prompt

实现一个“原型生成器工具栏”组件,然后插入到每条 AI 评估消息后,并具备以下几种状态:

  1. 待生成,可点击按钮发起原型版本生成请求
  2. 生成中,GET 轮询原型版本信息,不断更新生成状态
  3. 已生成,可点击查看预览链接、AI 日志
  4. 未生成,显示错误消息,也可点击查看 AI 日志

其中后端接口使用 https://github.com/idea2app/data-server/pull/24 ,数据类型定义从最新版 @idea2app/data-server 导入。

Human modification

  1. [migrate] replace SMS Code with Email OTP for sign-in
  2. [refactor] simplify Status Check polling of Prototype Generation
  3. [optimize] move Prototype Generator to Evaluation Scope lines
  4. [optimize] update Upstream packages
  5. [fix] many detail bugs

💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Co-authored-by: TechQuery <19969570+TechQuery@users.noreply.github.com>
@TechQuery TechQuery temporarily deployed to copilot/add-prototype-generator-toolbar - idea2app.github.io PR #89 October 15, 2025 17:53 — with Render Destroyed
Co-authored-by: TechQuery <19969570+TechQuery@users.noreply.github.com>
@TechQuery TechQuery temporarily deployed to copilot/add-prototype-generator-toolbar - idea2app.github.io PR #89 October 15, 2025 17:56 — with Render Destroyed
Co-authored-by: TechQuery <19969570+TechQuery@users.noreply.github.com>
@TechQuery TechQuery temporarily deployed to copilot/add-prototype-generator-toolbar - idea2app.github.io PR #89 October 15, 2025 17:59 — with Render Destroyed
Co-authored-by: TechQuery <19969570+TechQuery@users.noreply.github.com>
Copilot AI changed the title [WIP] Add prototype generator toolbar component 实现原型生成器工具栏组件 (Implement Prototype Generator Toolbar Component) Oct 15, 2025
Copilot AI requested a review from TechQuery October 15, 2025 18:03
Copilot finished work on behalf of TechQuery October 15, 2025 18:03
Copy link
Member

@TechQuery TechQuery left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@TechQuery TechQuery added the feature New feature or request label Oct 15, 2025
@github-project-automation github-project-automation bot moved this to In progress in 官网开发 Oct 15, 2025
Co-authored-by: TechQuery <19969570+TechQuery@users.noreply.github.com>
Copy link
Member

@TechQuery TechQuery left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

…polling

Co-authored-by: TechQuery <19969570+TechQuery@users.noreply.github.com>
Copilot finished work on behalf of TechQuery October 15, 2025 22:30
[fix] many detail bugs
[optimize] update Upstream packages
[optimize] move Prototype Generator to Evaluation Scope lines
[optimize] update Upstream packages
@TechQuery TechQuery changed the title 实现原型生成器工具栏组件 (Implement Prototype Generator Toolbar Component) [add] Prototype Generator model & component Oct 22, 2025
@TechQuery TechQuery temporarily deployed to copilot/add-prototype-generator-toolbar - idea2app.github.io PR #89 October 22, 2025 17:36 — with Render Destroyed
@TechQuery TechQuery added enhancement Some improvements feature New feature or request and removed feature New feature or request labels Oct 22, 2025
@TechQuery TechQuery merged commit 71a3e3c into main Oct 22, 2025
2 of 3 checks passed
@TechQuery TechQuery deleted the copilot/add-prototype-generator-toolbar branch October 22, 2025 17:53
@github-project-automation github-project-automation bot moved this from In progress to Done in 官网开发 Oct 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement Some improvements feature New feature or request

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants