-
Notifications
You must be signed in to change notification settings - Fork 579
Add the terminal output to the chat context #1826
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
base: main
Are you sure you want to change the base?
Conversation
@Kitenite can you please review the changes and tell how to update the state. currently the app becomes full black when i try to add the terminal context. Your guidance will help me to fully solve the issue |
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.
Caution
Changes requested ❌
Reviewed everything up to b5d9f62 in 2 minutes and 39 seconds. Click for details.
- Reviewed
160
lines of code in4
files - Skipped
0
files when reviewing. - Skipped posting
8
draft comments. View those below. - Modify your settings and rules to customize what types of comments Ellipsis leaves. And don't forget to react with 👍 or 👎 to teach Ellipsis.
1. apps/studio/src/lib/editor/engine/chat/context.ts:129
- Draft comment:
When updating the observable context array in addTerminalContext (lines 129-134), consider using MobX's runInAction to ensure the update is atomic and reactive. - Reason this comment was not posted:
Decided after close inspection that this draft comment was likely wrong and/or not actionable: usefulness confidence = 20% vs. threshold = 50% While using runInAction can be a good practice for batching MobX updates, it's not strictly necessary here. The updates are simple and sequential. The class is already properly set up with makeAutoObservable. There's no complex state interaction that would benefit significantly from atomic updates. The current code is clear and works fine. The comment does point out a valid MobX best practice. In some cases, batching updates can improve performance and prevent unnecessary re-renders. However, in this specific case, the benefit would be minimal. The operations are simple, sequential, and the code is already working correctly with MobX's reactivity system. This comment, while technically valid, suggests an optimization that isn't clearly necessary or impactful enough to warrant a code change. It falls into the category of "not clearly requiring a code change."
2. apps/studio/src/routes/editor/EditPanel/ChatTab/ChatInput.tsx:429
- Draft comment:
The onClick handler for the Terminal button calls addTerminalContext without awaiting errors. Consider handling potential promise rejections (e.g., using async/await) to improve error handling. - Reason this comment was not posted:
Decided after close inspection that this draft comment was likely wrong and/or not actionable: usefulness confidence = 10% vs. threshold = 50% 1. The comment assumes addTerminalContext() returns a Promise that could reject, but we don't see the implementation. 2. Without seeing the implementation of addTerminalContext(), we can't verify if error handling is actually needed. 3. The comment is speculative since it's based on assumptions about the function's behavior. 4. The button is already disabled when appropriate via the disabled prop. I could be wrong about addTerminalContext() - maybe it does return a Promise and error handling is important here. The function implementation would clarify this. Without seeing clear evidence that addTerminalContext() returns a Promise or needs error handling, keeping this speculative comment would violate our rule about making speculative comments. Delete this comment since it makes assumptions about error handling needs without clear evidence that the function actually returns a Promise or requires error handling.
3. apps/studio/src/lib/editor/engine/chat/context.ts:7
- Draft comment:
Good addition: TerminalMessageContext is imported along with other context types. - Reason this comment was not posted:
Confidence changes required:0%
<= threshold50%
None
4. apps/studio/src/lib/editor/engine/chat/context.ts:48
- Draft comment:
Appending terminalContext to getChatContext is consistent; ensure this ordering meets intended UI logic. - Reason this comment was not posted:
Confidence changes required:0%
<= threshold50%
None
5. apps/studio/src/lib/editor/engine/chat/context.ts:129
- Draft comment:
The addTerminalContext method replaces previous terminal contexts before adding a new one. Consider adding error handling or logging if getTerminalContent returns unexpected results. - Reason this comment was not posted:
Confidence changes required:33%
<= threshold50%
None
6. apps/studio/src/lib/editor/engine/index.ts:353
- Draft comment:
The new getTerminalOutput method safely handles missing runner and errors. Implementation looks good. - Reason this comment was not posted:
Confidence changes required:0%
<= threshold50%
None
7. apps/studio/src/routes/editor/EditPanel/ChatTab/ChatInput.tsx:429
- Draft comment:
The terminal button triggers addTerminalContext on click. Consider handling the async result or potential rejections for completeness. - Reason this comment was not posted:
Confidence changes required:33%
<= threshold50%
None
8. packages/models/src/chat/message/context.ts:42
- Draft comment:
TerminalMessageContext re-specifies 'content' and 'displayName' despite inheriting from BaseMessageContext. Consider removing duplicates unless clarity is prioritized. - Reason this comment was not posted:
Confidence changes required:33%
<= threshold50%
None
Workflow ID: wflow_guDEAKgcncMgy2Mu
You can customize by changing your verbosity settings, reacting with 👍 or 👎, replying to comments, or adding code review rules.
@@ -38,9 +39,16 @@ export type ProjectMessageContext = BaseMessageContext & { | |||
path: string; | |||
}; | |||
|
|||
export type TerminalMessageContext = BaseMessageContext & { |
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 TerminalMessageContext
definition (lines 42-46) duplicates content
and displayName
from the base type. Consider if these are intentionally re-declared or if they can rely directly on BaseMessageContext
.
Description
Added the terminal message in the chat context
Related Issues
related #1593
Important
Add terminal output to chat context, enabling users to include terminal messages in chat interactions.
ChatContext
class incontext.ts
.getTerminalContext()
andaddTerminalContext()
inChatContext
to manage terminal messages.getTerminalOutput()
inEditorEngine
inindex.ts
to fetch terminal history.ChatInput.tsx
to trigger terminal output addition to chat context.TERMINAL
type toMessageContextType
incontext.ts
.TerminalMessageContext
type incontext.ts
.This description was created by
for b5d9f62. You can customize this summary. It will automatically update as commits are pushed.