-
Notifications
You must be signed in to change notification settings - Fork 1
fix(): refine activity plan with serviceflow #495
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
22bf121 to
0e6140d
Compare
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## master #495 +/- ##
==========================================
- Coverage 75.16% 75.08% -0.09%
==========================================
Files 606 607 +1
Lines 18718 18741 +23
Branches 2884 2890 +6
==========================================
+ Hits 14070 14071 +1
- Misses 4105 4127 +22
Partials 543 543
🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR refines the activity plan functionality to better integrate with serviceflow, focusing on improving the askUser experience and adding plan-to-job mapping capabilities.
Key Changes:
- Added
planMapto track the relationship between jobs and plan steps, enabling better context display for askUser prompts - Introduced
expandAskUseroption to control whether askUser subtasks are expanded inline or displayed separately - Enhanced AskUser component with contextual tips showing the parent activity/step name
Reviewed changes
Copilot reviewed 16 out of 16 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| bricks/ai-portal/src/shared/getFlatChunks.ts | Core logic updates: added planMap generation, expandAskUser option, and refactored activeAskUser to include parent context |
| bricks/ai-portal/src/shared/getFlatChunks.spec.ts | Updated test expectations to include planMap in return value |
| bricks/ai-portal/src/shared/ChatBox/ChatBox.tsx | Added auto-focus functionality for chat input when it becomes available |
| bricks/ai-portal/src/shared/AskUser/i18n.ts | New i18n file with translated tips message for askUser context |
| bricks/ai-portal/src/shared/AskUser/AskUser.tsx | Enhanced with parent context props, tips display showing step name, and fixed done state logic |
| bricks/ai-portal/src/shared/AskUser/AskUser.module.css | Added styling for the contextual tips section |
| bricks/ai-portal/src/shared/ActivityPlan/PlanStateIcon.tsx | Simplified strokeWidth to use consistent value |
| bricks/ai-portal/src/shared/ActivityPlan/ActivityPlan.tsx | Added auto-scroll toggle logic with delay to prevent interference during collapse/expand |
| bricks/ai-portal/src/shared/ActivityPlan/ActivityPlan.module.css | Added hover effects for better interactivity |
| bricks/ai-portal/src/cruise-canvas/useConversationGraph.ts | Removed explicit option values to use defaults from getFlatChunks |
| bricks/ai-portal/src/cruise-canvas/reducers/tasks.ts | Added "summary" to the list of fields to merge from job updates |
| bricks/ai-portal/src/chat-stream/useConversationStream.ts | Propagated expandAskUser option and planMap throughout the stream processing |
| bricks/ai-portal/src/chat-stream/StreamContext.ts | Added planMap to context for downstream component access |
| bricks/ai-portal/src/chat-stream/ChatStream.tsx | Updated to pass planMap and activeAskUser parent context to components |
| bricks/ai-portal/src/chat-stream/Aside/FlowApp/FlowApp.tsx | Refactored to use rootTaskId option instead of manually filtering tasks, with expandAskUser enabled |
| bricks/ai-portal/src/chat-panel/index.tsx | Added planMap null initialization to StreamContext |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| chunks.push({ | ||
| type: "askUser", | ||
| job, | ||
| task: subTask?.task, |
Copilot
AI
Dec 3, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The optional chaining operator subTask?.task is redundant here since this code is already inside an if (subTask) block. Simplify to task: subTask.task.
| task: subTask?.task, | |
| task: subTask.task, |
|
|
||
| export interface StreamContextValue { | ||
| lastDetail: ActiveDetail | null; | ||
| planMap: Map<string, any> | null; |
Copilot
AI
Dec 3, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The planMap type should be Map<string, PlanStep> | null instead of Map<string, any> | null for better type safety. The PlanStep type is available from ../shared/interfaces.
| if (canChat) { | ||
| setTimeout(() => { | ||
| inputRef.current?.focus(); | ||
| }, 100); | ||
| } |
Copilot
AI
Dec 3, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The timeout created in this effect should be cleaned up to prevent it from firing after the component unmounts or when canChat changes. Add a cleanup function:
useEffect(() => {
if (canChat) {
const timeoutId = setTimeout(() => {
inputRef.current?.focus();
}, 100);
return () => clearTimeout(timeoutId);
}
}, [canChat]);| if (canChat) { | |
| setTimeout(() => { | |
| inputRef.current?.focus(); | |
| }, 100); | |
| } | |
| let timeoutId: ReturnType<typeof setTimeout> | undefined; | |
| if (canChat) { | |
| timeoutId = setTimeout(() => { | |
| inputRef.current?.focus(); | |
| }, 100); | |
| } | |
| return () => { | |
| if (timeoutId !== undefined) { | |
| clearTimeout(timeoutId); | |
| } | |
| }; |
| onClick={() => { | ||
| setCollapsed((prev) => !prev); | ||
| toggleAutoScroll(false); | ||
| if (toggleRef.current) { | ||
| clearTimeout(toggleRef.current); | ||
| } | ||
| toggleRef.current = setTimeout(() => { | ||
| toggleAutoScroll(true); | ||
| }, 100); | ||
| }} |
Copilot
AI
Dec 3, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The timeout stored in toggleRef.current should be cleaned up when the component unmounts to prevent calling toggleAutoScroll(true) on an unmounted component. Add a cleanup effect:
useEffect(() => {
return () => {
if (toggleRef.current) {
clearTimeout(toggleRef.current);
}
};
}, []);|
📐🤏 Size check result (ec2a2ba...f6d37bd): Load all bricks together
Critical changes: None. See full changes
Load bricks by each packageCritical changes: None. See full changes
Load by each brickCritical changes:
See full changes
Critical details for brick eo-checkbox
Critical details for brick eo-date-picker
Critical details for brick eo-input
Critical details for brick eo-radio
Critical details for brick eo-switch
Critical details for brick eo-time-range-picker
Critical details for brick form.general-checkbox
Critical details for brick form.general-radio
Critical details for brick form.general-search
Critical details for brick form.general-switch
Critical details for brick visual-builder.contract-select
|
依赖检查
组件之间的依赖声明,是微服务组件架构下的重要信息,请确保其正确性。
请勾选以下两组选项其中之一:
或者:
提交信息检查
Git 提交信息将决定包的版本发布及自动生成的 CHANGELOG,请检查工作内容与提交信息是否相符,并在以下每组选项中都依次确认。
破坏性变更:
feat作为提交类型。BREAKING CHANGE: 你的变更说明。新特性:
feat作为提交类型。问题修复:
fix作为提交类型。杂项工作:
即所有对下游使用者无任何影响、且没有必要显示在 CHANGELOG 中的改动,例如修改注释、测试用例、开发文档等:
chore,docs,test等作为提交类型。