Conversation
Signed-off-by: Zzde <zhangxh1997@gmail.com>
Signed-off-by: Zzde <zhangxh1997@gmail.com>
Signed-off-by: Zzde <zhangxh1997@gmail.com>
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
There was a problem hiding this comment.
Pull request overview
This PR improves the AI assistant UX and safety by adding client-side chat session history, enhancing tool-call confirmation flow with server-side pending sessions, and simplifying the chatbox open/close behavior.
Changes:
- Add per-user chat session history (localStorage-backed) and history UI panel with load/delete/new chat actions.
- Replace stateless mutation execution with server-side pending sessions + SSE continuation endpoint (
/ai/execute/continue) usingsession_id. - Refine system prompt language guidance to prefer the user’s latest message language.
Reviewed changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| ui/src/hooks/use-ai-chat.ts | Adds session/history state, localStorage persistence, and new execute/continue streaming flow. |
| ui/src/contexts/auth-context.tsx | Adds Key() helper on user object for per-user history keying. |
| ui/src/contexts/ai-chat-context.tsx | Removes minimized state; simplifies toggle to open/close only. |
| ui/src/components/selector/namespace-selector.tsx | Minor formatting/quote normalization. |
| ui/src/components/ai-chat/ai-chatbox.tsx | Adds history overlay UI and YAML preview for tool calls; adjusts header actions. |
| pkg/ai/pending_session.go | Introduces in-memory pending session store for confirmed mutation continuation. |
| pkg/ai/openai.go | Saves pending sessions on mutation tools and adds continuation path to resume conversation. |
| pkg/ai/anthropic.go | Same as OpenAI path: pending sessions + continuation execution and resume. |
| pkg/ai/handler.go | Replaces /ai/execute with SSE /ai/execute/continue handler. |
| pkg/ai/agent.go | Adds ContinuePendingAction and updates language prompt behavior. |
| main.go | Wires new /ai/execute/continue route. |
Comments suppressed due to low confidence (1)
ui/src/components/ai-chat/ai-chatbox.tsx:284
wrap-break-wordis not a standard Tailwind utility class, and there are no other occurrences in the repo. This likely results in missing word-wrapping for chat bubbles. Consider using Tailwind'sbreak-words(orbreak-all/whitespace-pre-wrapas appropriate) instead.
<div
className={`max-w-[85%] rounded-lg px-3 py-2 text-sm wrap-break-word ${
isUser
? 'bg-primary text-primary-foreground whitespace-pre-wrap'
: 'bg-muted text-foreground'
}`}
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Signed-off-by: Zzde <zhangxh1997@gmail.com>
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 19 out of 19 changed files in this pull request and generated 6 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Signed-off-by: Zzde <zhangxh1997@gmail.com>
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 19 out of 19 changed files in this pull request and generated 6 comments.
Comments suppressed due to low confidence (1)
ui/src/components/ai-chat/ai-chatbox.tsx:284
wrap-break-wordisn’t a standard Tailwind utility and doesn’t appear elsewhere in the UI, so this likely has no effect and messages may not wrap as intended. Use Tailwind’sbreak-words/break-all(or define a custom utility) instead.
className={`max-w-[85%] rounded-lg px-3 py-2 text-sm wrap-break-word ${
isUser
? 'bg-primary text-primary-foreground whitespace-pre-wrap'
: 'bg-muted text-foreground'
}`}
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| // Cleanup expired sessions asynchronously | ||
| go func() { | ||
| if err := model.CleanupExpiredPendingSessions(); err != nil { | ||
| klog.V(4).Infof("Failed to cleanup expired pending sessions: %v", err) | ||
| } |
There was a problem hiding this comment.
Spawning a goroutine to clean up expired sessions on every save can create many goroutines and repeated DELETE queries under load. Prefer a periodic cleanup job (ticker/background worker) or otherwise rate-limit cleanup.
Signed-off-by: Zzde <zhangxh1997@gmail.com>
No description provided.