Skip to content

fix ai agent#405

Merged
zxh326 merged 2 commits intomainfrom
fix-ai-agent
Mar 5, 2026
Merged

fix ai agent#405
zxh326 merged 2 commits intomainfrom
fix-ai-agent

Conversation

@zxh326
Copy link
Member

@zxh326 zxh326 commented Mar 5, 2026

No description provided.

Signed-off-by: Zzde <zhangxh1997@gmail.com>
@chatgpt-codex-connector
Copy link

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

Copy link
Contributor

Copilot AI left a 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 updates the AI agent experience end-to-end: improving the chat UI/UX (mobile + loading indicator), enhancing suggested prompts/i18n, and making backend tool handling more robust (tool error signaling and dynamic resource resolution for RBAC/tool execution).

Changes:

  • UI: Make the chatbox responsive on mobile, improve the “thinking” indicator, and expand suggested prompts with template placeholders.
  • Frontend SSE handling: Improve tool_result parsing and reflect tool success/failure via actionStatus.
  • Backend AI tools: Resolve Kubernetes resources via discovery (with static fallback), add CRD support, and add tests for resource matching.

Reviewed changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
ui/src/styles/base.css Adds animated “thinking dots” styling.
ui/src/i18n/locales/zh.json Updates/expands AI suggested prompts (with placeholder templates).
ui/src/i18n/locales/en.json Updates/expands AI suggested prompts (with placeholder templates).
ui/src/hooks/use-ai-chat.ts Improves tool result handling, including error inference and status updates.
ui/src/components/ai-chat/ai-chatbox.tsx Mobile-friendly layout, viewport-bound resizing on desktop, richer suggested prompts, and new loading indicator.
pkg/ai/tools_test.go Adds tests for CRD static resolution and resource input matching.
pkg/ai/tools.go Adds discovery-based resource resolution + CRD mapping; updates permission resolution and object building accordingly.
pkg/ai/openai.go Increases tool-call iteration limit; includes is_error in tool_result SSE.
pkg/ai/anthropic.go Increases tool-call iteration limit; includes is_error in tool_result SSE.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 487 to 508
@@ -376,7 +504,7 @@ func requiredToolPermissions(toolName string, args map[string]interface{}) ([]to
return nil, err
}
namespace, _ := args["namespace"].(string)
resource := resolveResourceInfo(kind)
resource := resolveResourceInfo(ctx, cs, kind)
return []toolPermission{{
Copy link

Copilot AI Mar 5, 2026

Choose a reason for hiding this comment

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

requiredToolPermissions now calls discovery-based resolveResourceInfo(...). For a single tool invocation, AuthorizeTool calls this and then ExecuteTool/execute* calls resolveResourceInfo again, so discovery can run twice per tool call (and ServerPreferredResources() is relatively expensive). Consider caching discovery results per request/cluster, or resolving once and reusing the resourceInfo between auth and execution.

Copilot uses AI. Check for mistakes.
Signed-off-by: Zzde <zhangxh1997@gmail.com>
@zxh326 zxh326 merged commit 5d111e0 into main Mar 5, 2026
3 checks passed
@zxh326 zxh326 deleted the fix-ai-agent branch March 5, 2026 15:44
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.

2 participants